How to test a confirm dialog with Cucumber

automated-testscapybaraintegration-testing

I am using Ruby on Rails with Cucumber and Capybara.

How would I go about testing a simple confirm command ("Are you sure?")?

Also, where could I find further documentation on this issue?

Best Answer

The selenium driver now supports this

From Capybara you would access it like this:

page.driver.browser.switch_to.alert.accept

or

page.driver.browser.switch_to.alert.dismiss

or

 page.driver.browser.switch_to.alert.text
Related Topic