Skip to content

Conversation

@seanpdoyle
Copy link
Contributor

@seanpdoyle seanpdoyle commented Dec 19, 2025

Rather than immediately fail tests (like the :raise reporter), log the output through a new :log reporter.


How many I conduct a preliminary audit that comprehensively exercises
my system test suite without failing tests that result in violations

You can configure the audit's reporting mechanism. By default, the config.capybara_accessibility_audit.reporter value is set to :raise, which will raise violation errors that will fail the test suite.

To log violations, rather than raise them, you can configure config.capybara_accessibility_audit.reporter to :log:

class MySystemTest < ApplicationSystemTestCase
  self.accessibility_audit_reporter = :log

  test "with overridden accessibility :log reporter" do
    visit examples_path
    # ...
  end
end

report.capybara_accessibility_audit notification ---

Subscribe to report.capybara_accessibility_audit notifications emitted when an accessibility audit detects violations. The payload includes:

Payload Type Description
report Axe::API::Results The underlying axe.js Results object
options ActiveSupport::OrderedOptions The audit's configuration
test ActionDispatch::SystemTestCase The test case that triggered the audit

Note

The report.capybara_accessibility_audit notifications are only published when
config.capybara_accessibility_audit.reporter is configured with
:notification or :log.

Related to #21
Related to #22
Related to #30
Related to #30

Rather than immediately fail tests (like the `:raise` reporter), log the
output through a new `:log` reporter.

---

> How many I conduct a preliminary audit that comprehensively exercises
> my system test suite without failing tests that result in violations

You can configure the audit's reporting mechanism. By default, the
`config.capybara_accessibility_audit.reporter` value is set to `:raise`,
which will raise violation errors that will fail the test suite.

To log violations, rather than raise them, you can configure
`config.capybara_accessibility_audit.reporter` to `:log`:

```ruby
class MySystemTest < ApplicationSystemTestCase
  self.accessibility_audit_reporter = :log

  test "with overridden accessibility :log reporter" do
    visit examples_path
    # ...
  end
end
```

---

`report.capybara_accessibility_audit` notification
---

Subscribe to `report.capybara_accessibility_audit` notifications emitted
when an accessibility audit detects violations. The `payload` includes:

| Payload       | Type                               | Description |
| ------------- | ---------------------------------- | ----------- |
| report        | [Axe::API::Results][]              | The underlying axe.js [Results][] object
| options       | [ActiveSupport::OrderedOptions][]  | The audit's configuration
| test          | [ActionDispatch::SystemTestCase][] | The test case that triggered the audit

[ActiveSupport::OrderedOptions]: https://api.rubyonrails.org/classes/ActiveSupport/OrderedOptions.html
[ActionDispatch::SystemTestCase]: https://api.rubyonrails.org/classes/ActionDispatch/SystemTestCase.html
[Axe::API::Results]: https://github.com/dequelabs/axe-core-gems/blob/v4.11.0/packages/axe-core-api/lib/axe/api/results.rb
[Results]: https://www.deque.com/axe/core-documentation/api-documentation/#results-object

> [!NOTE]
> The `report.capybara_accessibility_audit` notifications are only published when
> `config.capybara_accessibility_audit.reporter` is configured with
> `:notification` or `:log`.
@seanpdoyle seanpdoyle force-pushed the notification-reporter branch from 4b9c0ba to 268a30f Compare December 19, 2025 21:13
@seanpdoyle seanpdoyle merged commit 255625b into main Dec 19, 2025
142 of 144 checks passed
@seanpdoyle seanpdoyle deleted the notification-reporter branch December 19, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants