How do I write a Capybara assertion that checks for the presence of a button and its enabled or disabled state?

It appears that Capybara’s handling of disabled elements has changed, so I figured I’d give an update. To test whether a page has a button and is enabled, use: expect(page).to have_button(‘Save’) To test whether a page has a button and is disabled, use: expect(page).to have_button(‘Save’, disabled: true) This format works with has_field?, find_field, etc. You … Read more

Capybara tests with :js=>true… Routing Error: No route matches [GET] “/assets”

Your missing route looks like some auto-generated assets path with nil input. Are you sure your assets are correctly specified in your css/sass or wherever this route comes from? I have been struggling with a similiar issue where an asset path induced a routing error 1) user signup: [ JS ] : creates User on … Read more

Capybara does not pass header after form submit

This feature was added to Capybara on April 25th, 2011 with this commit – https://github.com/jnicklas/capybara/commit/a00435d63085ac2e74a0f64e7b7dedc0f7252ea9 You can can now specify a custom header when using a custom Capybara driver. See http://automagical.posterous.com/creating-a-custom-capybara-driver for code examples.

Cucumber and Capybara, clicking a non-link or button element

You can click on an element via Capybara::Element.click. I add the following for this in my web_steps.rb to click on divs. When /^(?:|I )click within “([^”]*)”$/ do |selector| find(selector).click end There is also Element.trigger(‘mouseover’) which appears to enable hover albeit not working with Selenium. It is also very likely you will need to decorate your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)