Running the latest builds of Rails, Cucumber and Capybara I am getting stuck when Capybara needs to press a button. I have tried to eliminate all issues and have made sure that the form is generated and displayed correctly.
I am getting 2 errors: A) If I try to press the button with the correct id or text value ('commit') B) If I try and press the button with a completely incorrect id or text value ('cxxxommit')
I can reproduce these errors on both Ubuntu and Windows 7.
The errors:
Option A
And I save the Quote
undefined method `name' for nil:NilClass (ActionView::Template::Error)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
Option B
And I save the Quote
no button with value or id or text 'cxxxommit' found (Capybara::ElementNotFound)
(eval):2:in `click_button'
./features/step_definitions/quote_steps.rb:63:in `/^I save the Quote$/'
features\interactions\policies\quotes.feature:22:in `And I save the Quote'
Versions:
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Rails 3.1.3
Scenario
Scenario: Create a complete manual entered quote for a client
When I select the XXX as YYY
And I save the Quote
Then I should see "Policy was successfully created"
Steps
When /^I select the (.*) as (.*)$/ do |field, value|
select(value, :from => field)
end
When /^I save the Quote$/ do
# debugger
click_button('commit')
# ================================================
# The next line causes the second error
# click_button('cxxxommit')
# ================================================
# find_button('commit').click
end
Please note that I have read and attempted the following SO post Cucumber press button
failure (Capybara::ElementNotFound)
Any help or direction would be greatly appreciated.
Thanks
<input class="create" id="commit" name="Save Quote" type="submit" value="Save Quote" />
– Daniel Jacobs