Skip to content

Commit

Permalink
major update to the Rakefile and steps try to reproduce issue 259
Browse files Browse the repository at this point in the history
* added tests for issue 259
    - cannot reproduce
    - calabash/calabash-ios#259

* updates to Rakefile
    - removed irb scripts in favor of rake tasks
    - now using ideviceinstaller to remove and deploy (removed ios-deploy)
    - added rake task for setting the simulator default device (WIP)
  • Loading branch information
jmoody committed Dec 19, 2013
1 parent 8c7330e commit 0a84917
Show file tree
Hide file tree
Showing 52 changed files with 630 additions and 1,566 deletions.
147 changes: 118 additions & 29 deletions Briar/.irbrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ require 'irb/ext/save-history'
require 'awesome_print'
AwesomePrint.irb!

ARGV.concat [ "--readline",
"--prompt-mode",
"simple" ]
ARGV.concat [ '--readline', '--prompt-mode', 'simple']

# 25 entries in the list
IRB.conf[:SAVE_HISTORY] = 50

# Store results in home directory with specified file name
IRB.conf[:HISTORY_FILE] = ".irb-history"
IRB.conf[:HISTORY_FILE] = '.irb-history'

require 'calabash-cucumber/operations'
extend Calabash::Cucumber::Operations
Expand All @@ -30,7 +28,7 @@ end

#### begin briar ####

if IO.popen("rbenv version").readlines.first.split(/-/).first.eql?('1.8.7')
if IO.popen('rbenv version').readlines.first.split(/-/).first.eql?('1.8.7')
puts "briar not available for '1.8.7'"
else
require 'briar'
Expand All @@ -46,53 +44,144 @@ else
include Briar::Picker::DateManipulation
include Briar::Picker::DateSteps
include Briar::Core
include Briar::UIA
include Briar::UIA::IPadEmulation
include Briar::Table
include Briar::ImageView
include Briar::Label
include Briar::Keyboard
include Briar::UIAKeyboard
include Briar::UIAKeyboard::Numeric
include Briar::UIAKeyboard::Language
include Briar::Email
include Briar::TextField
include Briar::TextView

puts 'loaded briar'
end

@ai=:accessibilityIdentifier
@al=:accessibilityLabel

def print_marks(marks, max_width)
counter = -1
marks.sort.each { |elm|
printf("%4s %#{max_width + 2}s => %s\n", "[#{counter = counter + 1}]", elm[0], elm[1])
}
end

def accessibility_marks(kind, opts={})
opts = {:print => true, :return => false}.merge(opts)

kinds = [:id, :label]
raise "'#{kind}' is not one of '#{kinds}'" unless kinds.include?(kind)

res = Array.new
max_width = 0
query('*').each { |view|
aid = view[kind.to_s]
unless aid.nil? or aid.eql?('')
cls = view['class']
len = cls.length
max_width = len if len > max_width
res << [cls, aid]
end
}
print_marks(res, max_width) if opts[:print]
opts[:return] ? res : nil
end

def text_marks(opts={})
opts = {:print => true, :return => false}.merge(opts)

indexes = Array.new
idx = 0
all_texts = query('*', :text)
all_texts.each { |view|
indexes << idx unless view.eql?('*****') or view.eql?('')
idx = idx + 1
}

res = Array.new

all_views = query('*')
max_width = 0
indexes.each { |idx|
view = all_views[idx]
cls = view['class']
text = all_texts[idx]
len = cls.length
max_width = len if len > max_width
res << [cls, text]
}

print_marks(res, max_width) if opts[:print]
opts[:return] ? res : nil
end


def ids
query("view", @ai).compact.sort.each {|x| puts "* #{x}" }
accessibility_marks(:id)
end

def labels
query("view", @al).compact.sort.each {|x| puts "* #{x}" }
accessibility_marks(:label)
end

def nbl
query("navigationButton", :accessibilityLabel)
def text
text_marks
end

def row_ids
query("tableViewCell", @ai).compact.sort.each {|x| puts "* #{x}" }
def marks
opts = {:print => false, :return => true }
res = accessibility_marks(:id, opts).each { |elm|elm << :ai }
res.concat(accessibility_marks(:label, opts).each { |elm| elm << :al })
res.concat(text_marks(opts).each { |elm| elm << :text })
max_width = 0
res.each { |elm|
len = elm[0].length
max_width = len if len > max_width
}

counter = -1
res.sort.each { |elm|
printf("%4s %-4s => %#{max_width}s => %s\n",
"[#{counter = counter + 1}]",
elm[2], elm[0], elm[1])
}
nil
end


def swipe_on_text_field(dir, field)
dev = device
if dev.ios7? && dev.simulator?
pending 'iOS 7 simulator detected: due to a bug in the iOS
Simulator, swiping does not work'
end
tf = "#{field} tf"
wait_for_view tf, 2
swipe(dir, {:query => "textField marked:'#{tf}'"})
2.times { step_pause }
tf
def nbl
query('navigationButton', :accessibilityLabel)
end

def row_ids
query('tableViewCell', @ai).compact.sort.each {|x| puts "* #{x}" }
end


puts "loaded #{Dir.pwd}/.irbrc"
puts "RESET_BETWEEN_SCENARIOS => '#{ENV['RESET_BETWEEN_SCENARIOS']}'"
puts " DEVICE_ENDPOINT => '#{ENV['DEVICE_ENDPOINT']}'"
puts " DEVICE_TARGET => '#{ENV['DEVICE_TARGET']}'"
puts " DEVICE => '#{ENV['DEVICE']}'"
puts " BUNDLE_ID => '#{ENV['BUNDLE_ID']}'"
puts " PLAYBACK_DIR => '#{ENV['PLAYBACK_DIR']}'"
puts " SDK_VERSION => '#{ENV['SDK_VERSION']}'"
puts "DEVICE_ENDPOINT => '#{ENV['DEVICE_ENDPOINT']}'"
puts " DEVICE_TARGET => '#{ENV['DEVICE_TARGET']}'"
puts " DEVICE => '#{ENV['DEVICE']}'"
puts " BUNDLE_ID => '#{ENV['BUNDLE_ID']}'"
puts " SDK_VERSION => '#{ENV['SDK_VERSION']}'"
puts " PLAYBACK_DIR => '#{ENV['PLAYBACK_DIR']}'"
puts "SCREENSHOT_PATH => '#{ENV['SCREENSHOT_PATH']}'"

puts '*** useful functions defined in .irbrc ***'
puts '> ids => all accessibilityIdentifiers'
puts '> labels => all accessibilityLabels'
puts "> text => all views that respond to the 'text' selector"
puts "> marks => all visible 'marks'"
puts '> nbl => all navigation bar button item labels'
puts '> row_ids => all tableViewCell ids'
puts ''
motd=["Let's get this done!", 'Ready to rumble.', 'Enjoy.', 'Remember to breathe.',
'Take a deep breath.', "Isn't it time for a break?", 'Can I get you a coffee?',
'What is a calabash anyway?', 'Smile! You are on camera!', 'Let op! Wild Rooster!',
"Don't touch that button!", "I'm gonna take this to 11.", 'Console. Engaged.',
'Your wish is my command.', 'This console session was created just for you.']
puts "#{motd.sample}"
32 changes: 0 additions & 32 deletions Briar/5-console.sh

This file was deleted.

32 changes: 0 additions & 32 deletions Briar/6-console.sh

This file was deleted.

33 changes: 0 additions & 33 deletions Briar/7-console.sh

This file was deleted.

12 changes: 9 additions & 3 deletions Briar/Briar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@
09608ca2daa71133ce45a388 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Developer: Joshua Moody (8QEQJFT59F)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Joshua Moody (8QEQJFT59F)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
Expand All @@ -1068,7 +1069,7 @@
396afcd2026cd49222fd301b /* AdHoc */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
Expand All @@ -1093,7 +1094,7 @@
5d879d55ad4f1a31440a147a /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Developer: Joshua Moody (8QEQJFT59F)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
Expand Down Expand Up @@ -1222,6 +1223,7 @@
buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: Joshua Moody (8QEQJFT59F)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Briar/Briar-Prefix.pch";
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
Expand All @@ -1239,6 +1241,7 @@
buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: Joshua Moody (8QEQJFT59F)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Briar/Briar-Prefix.pch";
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
Expand Down Expand Up @@ -1318,6 +1321,7 @@
buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Briar/Briar-Prefix.pch";
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
Expand Down Expand Up @@ -1390,6 +1394,7 @@
buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Briar/Briar-Prefix.pch";
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
Expand All @@ -1413,6 +1418,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
Expand Down
3 changes: 2 additions & 1 deletion Briar/Briar/Controllers/BrTextRelatedController.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ - (void)viewDidLoad {
@(UISwipeGestureRecognizerDirectionRight)]) {
[self addSwipeRecognizerToTextField:tf
direction:dir.unsignedIntegerValue];
tf.keyboardType = UIKeyboardTypeEmailAddress;
}
}

Expand Down Expand Up @@ -245,7 +246,7 @@ - (CGRect) frameForView:(UIView *) aView
if ([kIdTopTv isEqualToString:aid] && (t == o || b == o)) { frame = CGRectMake(20, 160, 280, 30); }
if ([kIdBottomTv isEqualToString:aid] && (t == o || b == o)) { frame = CGRectMake(20, 196, 280, 30); }

if ([kIdButton isEqualToString:aid] && (t == o || b == o)) { frame = CGRectMake(95, 269, 230, 44); }
if ([kIdButton isEqualToString:aid] && (t == o || b == o)) { frame = CGRectMake(20, 269, 230, 44); }
if ([kIdButton isEqualToString:aid] && (l == o || r == o)) { frame = CGRectMake(330, 158 + ipadYAdj, 230, 44); }


Expand Down
Loading

0 comments on commit 0a84917

Please sign in to comment.