Problem with "dismiss_js_confirms!"

62 views
Skip to first unread message

Larry

unread,
Feb 5, 2013, 8:45:13 PM2/5/13
to capybar...@googlegroups.com
Hi,

I'm using Capybara 2.0.2 and Capybara-webkit 0.14.1 with Rails 3.2.11

I have a standard "Delete my account" button in a user form with a ":confirm => 'Are you sure?" option that has worked for a long time, and cucumber tests that interacted with the confirmation dialog box by clicking both 'Ok' and 'Cancel'. Those tests always passed using Selenium and contained something like "page.driver.browser.switch_to.alert.dismiss" to dismiss the javascript confirmation dialog.

Switching to capy-webkit meant replacing the old "Cancel" call with webkit's "page.driver.dismiss_js_confirms!" call. Similarly, I use "page.driver.accept_js_confirms!" for clicking "Ok".

"accept_js_confirms!" works fine for "Ok", i.e. whatever is supposed to happen when the user deletes his account does indeed happen.

The problem is that the call to "dismiss_js_confirms!" (i.e. clicking "Cancel") still results in the user's account being deleted! In the step-definition that contains the dismissal call I print out "page.driver.confirm_messages" and get the expected "[\"Are you sure?\"]"

Am I missing something? Shouldn't a call to "page.driver.dismiss_js_confirms!" cause the account-deletion operation to be cancelled?

Thanks,
Larry
Reply all
Reply to author
Forward
0 new messages