Reputation: 21
I'm getting a fail whenever I try to run this cucumber test on a rails app- The 'And I click' step definition is working elsewhere, it fails every time here though! And I can't find anywhere I've used the method `start_with?'
Here's the error output:
And I click "Add a Line Item" # features/step_definitions/first_test_steps.rb:17
undefined method `start_with?' for nil:NilClass (NoMethodError)
./features/step_definitions/first_test_steps.rb:18:in `/^I click "(.*?)"$/'
features/create_quote.feature:19:in `And I click "Add a Line Item"'
And here's the code for my step definition:
When /^I click "(.*?)"$/ do |this|
click_on(this)
end
Any ideas?
Upvotes: 2
Views: 905
Reputation: 1012
If "Add a Line Item" is link then use
first(:link, "Add a Line Item")
and if "Add a Line Item" is button then use
first(:button, "Add a Line Item")
Upvotes: 1