I have recently attempted to use:
Then(/^I should see "(.*?)"$/) do |arg1|
page.should have_content(arg1)
end
To query the page and see if a text exists on the page.
This worked fine with the default Capybara driver, but after setting the javascript driver to capybara-webkit and running the tests again I get:
undefined method `find_xpath' for #<Capybara::Webkit::Driver:0x007fa3f00152e8> (NoMethodError)
./features/step_definitions/customer_steps.rb:12:in `/^I should see "(.*?)"$/'
features/manage_customers.feature:10:in `Then I should see "ABC XYZ"'
I am using the javascript driver since I am also using AngularJS to populate my data.
My questions:
Looks like there may be an issue with capybara-webkit
: https://github.com/thoughtbot/capybara-webkit/issues/499
I added gem 'capybara', '2.0.3'
to my gemfile for now and that seems to fix the issue.