lib/icuke/cucumber.rb in iCuke-0.4.9 vs lib/icuke/cucumber.rb in iCuke-0.4.10
- old
+ new
@@ -30,12 +30,12 @@
def record
@simulator.record
end
- def can_see?(text)
- page.xpath(%Q{//*[contains(., "#{text}") or contains(@label, "#{text}") or contains(@value, "#{text}")]}).any?
+ def can_see?(text, scope = '')
+ page.xpath(%Q{#{scope}//*[contains(., "#{text}") or contains(@label, "#{text}") or contains(@value, "#{text}")]}).any?
end
def onscreen?(x, y)
return x >= 0 && y >= 0 && x < 320 && y < 480
end
@@ -176,15 +176,15 @@
launch File.expand_path(project),
:target => target,
:env => { 'DYLD_INSERT_LIBRARIES' => LIBICUKE }
end
-Then /^I should see "([^\"]*)"$/ do |text|
- raise %Q{Content "#{text}" not found in: #{response}} unless can_see?(text)
+Then /^I should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, scope|
+ raise %Q{Content "#{text}" not found in: #{response}} unless can_see?(text, scope)
end
-Then /^I should not see "([^\"]*)"$/ do |text|
- raise %Q{Content "#{text}" was found but was not expected in: #{response}} if can_see?(text)
+Then /^I should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, scope|
+ raise %Q{Content "#{text}" was found but was not expected in: #{response}} if can_see?(text, scope)
end
When /^I tap "([^\"]*)"$/ do |label|
tap(label)
end