Use Selenium API to accept/dismiss JS modals/browser alerts

JS modals/browser alerts are not automatically accepted now with
Selenium, events that trigger such events must be wrapped in one
of the following methods: `accept_alert`, `accept_confirm` or
`dismiss_confirm`
This commit is contained in:
Angel Perez
2018-03-08 16:07:41 -04:00
parent 38af45d450
commit 122b17033b
12 changed files with 41 additions and 51 deletions

View File

@@ -130,11 +130,9 @@ feature "Admin newsletter emails" do
scenario "Sends newsletter emails", :js do
newsletter = create(:newsletter)
visit admin_newsletter_path(newsletter)
click_link "Send"
total_users = newsletter.list_of_recipient_emails.count
page.accept_confirm("Are you sure you want to send this newsletter to #{total_users} users?")
accept_confirm { click_link "Send" }
expect(page).to have_content "Newsletter sent successfully"
end