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" diff --git a/lib/icuke/cucumber.rb b/lib/icuke/cucumber.rb index f781ce5..cae0459 100644 --- a/lib/icuke/cucumber.rb +++ b/lib/icuke/cucumber.rb @@ -65,6 +65,9 @@ def configuration simulator_driver.tap(label) end +When /^I tap (\d+),(\d+)$/ do |x,y| + simulator_driver.tap_at_point(x.to_i, y.to_i) +end When /^I type "([^\"]*)" in "([^\"]*)"$/ do |text, textfield| simulator_driver.type(textfield, text) end diff --git a/lib/icuke/simulator_driver.rb b/lib/icuke/simulator_driver.rb index ca86ee5..43c080b 100644 --- a/lib/icuke/simulator_driver.rb +++ b/lib/icuke/simulator_driver.rb @@ -45,6 +45,15 @@ def response def record @simulator.record end + + def tap_at_point(x, y, options={}) + options = { + :pause => true + }.merge(options) + @simulator.fire_event(Tap.new(x,y,options)) + sleep(options[:pause] ? 2 : 0.2) + refresh + end def tap(label, options = {}, &block) options = {