0

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:

  1. Are have_content() and page.has_content?() not implemented in capybara-webkit?
  2. What could be the source of the problem?
Dorian
  • 1,079
  • 11
  • 19

1 Answers1

3

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.

lobati
  • 9,284
  • 5
  • 40
  • 61
  • 1
    I solved it by changing my gemfile to gem 'capybara-webkit', git: 'git://github.com/thoughtbot/capybara-webkit.git' Just adding the git source worked cause it probably pulled a fixed dev version. – Dorian Apr 16 '13 at 16:03