From 4840ea30423b55ebc2582cfa915152daab028086 Mon Sep 17 00:00:00 2001 From: Rob Holland Date: Wed, 30 Jun 2010 11:02:50 +0100 Subject: [PATCH 1/3] Rakefile shuffle to make rake features work in a git checkout. --- Rakefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index b0f3c2b..ef95c6b 100644 --- a/Rakefile +++ b/Rakefile @@ -32,10 +32,9 @@ file 'app/build/Debug-iphonesimulator/Universal.app/Universal' do sh "cd app && xcodebuild -target Universal -configuration Debug -sdk #{ICuke::SDK.fullname}" end task :app => 'app/build/Debug-iphonesimulator/Universal.app/Universal' -task :features => :app task :lib do - sh 'cd ext/iCuke && rake' + sh 'cd ext && rake' end begin @@ -43,7 +42,7 @@ begin Cucumber::Rake::Task.new(:features) task :features => :check_dependencies - task :features => [:app, :lib] + task :features => [:lib, :app] rescue LoadError task :features do abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber" From 71abb14fc3750bf17cd6c0d22c22778bfbafab56 Mon Sep 17 00:00:00 2001 From: Grant McInnes Date: Wed, 22 Sep 2010 20:38:58 -0400 Subject: [PATCH 2/3] Make the textfield part of "When I type..." to optional --- lib/icuke/cucumber.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/icuke/cucumber.rb b/lib/icuke/cucumber.rb index f781ce5..45b2c05 100644 --- a/lib/icuke/cucumber.rb +++ b/lib/icuke/cucumber.rb @@ -64,8 +64,7 @@ def configuration When /^I tap "([^\"]*)"$/ do |label| simulator_driver.tap(label) end - -When /^I type "([^\"]*)" in "([^\"]*)"$/ do |text, textfield| +When /^I type "([^\"]*)"(?: in "([^\"]*)")?$/ do |text, textfield| simulator_driver.type(textfield, text) end From 2600fadaae51df6ef973fc3bda993dce4c6b452e Mon Sep 17 00:00:00 2001 From: Grant McInnes Date: Tue, 28 Sep 2010 16:34:55 -0400 Subject: [PATCH 3/3] Fix conflicts from integration branch. --- lib/icuke/simulator_driver.rb | 93 ++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/lib/icuke/simulator_driver.rb b/lib/icuke/simulator_driver.rb index ca86ee5..f93baff 100644 --- a/lib/icuke/simulator_driver.rb +++ b/lib/icuke/simulator_driver.rb @@ -106,52 +106,55 @@ def drag_slider_to_percentage(label, percentage) end def type(textfield, text, options = {}) - tap(textfield, :hold_for => 0.75) do |field| - if field['value'] - tap('Select All') - tap('Delete') - end - end - - # Without this sleep fields which have auto-capitilisation/correction can - # miss the first keystroke for some reason. - sleep(0.5) - - text.split('').each do |c| - begin - tap(c == ' ' ? 'space' : c, :pause => false) - rescue Exception => e - try_keyboards = - case c - when /[a-zA-Z]/ - ['more, letters', 'shift'] - when /[0-9]/ - ['more, numbers'] - else - ['more, numbers', 'more, symbols'] - end - until try_keyboards.empty? - begin - tap(try_keyboards.shift, :pause => false) - retry - rescue - end - end - raise e - end - end + unless textfield == '' || textfield.nil? + tap(textfield, :hold_for => 0.75) do |field| + if field['value'] + tap('Select All') + tap('Delete') + end + end + end + + # Without this sleep fields which have auto-capitilisation/correction can + # miss the first keystroke for some reason. + sleep(0.3) + + text.split('').each do |c| + begin + tap(c == ' ' ? 'space' : c, :pause => false) + rescue Exception => e + try_keyboards = + case c + when /[a-zA-Z]/ + ['more, letters', 'shift'] + when /[0-9]/ + ['more, numbers'] + else + ['more, numbers', 'more, symbols'] + end + until try_keyboards.empty? + begin + tap(try_keyboards.shift, :pause => false) + retry + rescue + end + end + raise e + end + end + + # From UIReturnKeyType + # Should probably sort these in rough order of likelyhood? + return_keys = ['return', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency call'] + return_keys.each do |key| + begin + tap(key) + return + rescue + end + end + end - # From UIReturnKeyType - # Should probably sort these in rough order of likelyhood? - return_keys = ['return', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency call'] - return_keys.each do |key| - begin - tap(key) - return - rescue - end - end - end def scroll_to(text, options = {}) x, y, x2, y2 = screen.swipe_coordinates(swipe_direction(options[:direction]))