6

I have this cucumber step definitions that work with Selenium but I get NotImplementedError when I try them with the poltergeist driver.

phantom.js is installed and I can even take screenshots from my step definitions that look right. I'm testing an Ember.js/Rails application. See that it visits the page correctly but then it fails when I try to find a link.

When(/^I visit the App$/) do
  visit("/")
end

Then(/^I should see link "(.*?)"$/) do |arg1|
  find_link(arg1)
end

When(/^I click "(.*?)"$/) do |arg1|
  find_link(arg1).click
end

When(/^I fill in "(.*?)" with "(.*?)"$/) do |arg1, arg2|
  fill_in arg1, :with => arg2
end

When(/^I click "(.*?)" button$/) do |arg1|
  find_button(arg1).click
end

The exact error is this:

When I visit the App                                  # features/step_definitions/sign_in_steps.rb:1
Then I should see link "Sign Up"                      # features/step_definitions/sign_in_steps.rb:5
  NotImplementedError (NotImplementedError)
  ./features/step_definitions/sign_in_steps.rb:6:in `/^I should see link "(.*?)"$/'
  features/sign_in.feature:9:in `Then I should see link "Sign Up"'
joscas
  • 7,474
  • 5
  • 39
  • 59

1 Answers1

13

I ran into this recently as well - the current release of poltergeist (1.1.0) does not support capybara 2.1.0 - downgrade capybara to 2.0.x and you should be good to go.

keith
  • 146
  • 1
  • 2
  • You can also use the master branch of poltergeist to work with Capybara 2.1. In your gemfile: gem 'poltergeist', github: 'jonleighton/poltergeist' – ryanjones Apr 12 '13 at 20:05
  • Many years on.. there is also an issue with Poltergeist 1.18 against Capybara 3.25 (only one I checked). Regressing Capybara to 2.x sorted it. – Damien Roche Aug 20 '19 at 16:35