views:

22

answers:

0

When I run my feature file without javascript, it passes all tests in flying colors(okay, just one color, green) anyway, when I add @javascript to my last scenario, it suddenly fails the test. I tried tracing the problem by outputing it with puts:

this is the culprit line:

Then /^the "([^"]*)" option should be selected from the "([^"]*)" list$/ do |option, select_list|
  puts select_list
  puts page.find("##{select_list}//option[@selected]")
  assert page.find("##{select_list}//option[@selected]").text.eql?(option)
end

without @javascript, scenarios print out:

departure_location #
tour_type #
excursion_type #

with the # depicting the ruby object that page.find returns. But with @javascript, it says

excursion_type

then just throws the error:

undefined method `text' for nil:NilClass

with those clues, it seems that page.find doesnt work with @javascript on? Is that a limitation or am I doing something wrong?