thoughtbot/capybara_accessibility_audit

Confirmation of alert box is not working

matsales28 opened this issue · 2 comments

Problem:
When using the accept_confirm or accept_alert methods along with the capybara_accessibility_audit gem, a Selenium::WebDriver::Error::UnexpectedAlertOpenError error is raised during the test execution.

Expected Behavior:
The test should run without any errors when using the accept_confirm or accept_alert methods, even with the capybara_accessibility_audit gem enabled.

Actual Behavior:
The test is raising a Selenium::WebDriver::Error::UnexpectedAlertOpenError when using the accept_confirm or accept_alert methods with the capybara_accessibility_audit gem.

Steps to Reproduce:
I've created a GitHub repository that demonstrates the issue. The repository contains a simple system spec (system/root_spec.rb) utilising the accept_confirm method:

require "rails_helper"

describe "Root" do
  around do |example|
    with_accessibility_audit_options skipping: %w[
    html-has-lang
    landmark-one-main
    page-has-heading-one
    region
    ] do
      example.run
    end
  end

  it "raises an error", js: true do
    visit root_path

    accept_confirm do
      click_on "Alert"
    end

    expect(page).to have_content("Root Show")
  end
end

@matsales28 thank you for opening this issue. Does #9 fix the broken behavior?

@matsales28 thank you for opening this issue. Does #9 fix the broken behavior?

Yes, I just tested on the repo I used as a demonstration. It's working fine, thanks for fixing it!