I am trying to check the selection of an option from a select tag (these parameters are selected from a remote database server). During normal interaction with the website, filling out this drop-down list takes no more than one second. However, when I run the next test,
When /^(?:|I )select "([^"]*)" from "([^"]*)" in search form$/ do |value, field|
within "#select_container" do
save_and_open_page
page.should have_css("#criteria_div_code > option:nth-child(10)")
select(value, :from => field)
end
end
I get the following error:
expected css "#criteria_div_code > option:nth-child(10)" to return something (RSpec::Expectations::ExpectationNotMetError)
At least 20 parameters are indicated in the drop-down list, so I just check for the 10th option (at the moment).
save_and_open_page indicates that there is only one option (the default option) instead of at least 10 and, therefore, "ExpectionNotMetError" appears.
Capybara.default_wait_time = 30 - Easy time to populate lists.
Doesn't capybara wait for the ajax call to complete?
Did I miss something?