You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've observed that if a test fails because a page is not accessible, the remainder of the test block does not run. This results in issues being reported for a single page, but not for any other pages loaded in a test block.
Expected behavior:
The test should run to the end (barring other non-accessibility failures), even if a few of the pages visited fail the accessibility audit. Audit errors should be reported across all pages visited.
Actual behavior:
The test halts on the first accessibility error that it finds
Example:
RSpec.describe"Playbook",type: :systemdoarounddo |example|
with_accessibility_audit_optionsdoexample.runendendit"renders all pages without error"dovisit"/playbook"playbook_links=all(".application-main-content a[href^='/playbook']").mapdo |link|
link[:href]endplaybook_links.eachdo |url|
# the first page visited that has an accessibility error will end the testvisiturlendendend
I do realize that this issue/suggestion goes against the default behavior of Capybara - Capybara normally does not run the entire test if an assertion fails, or if it fails to visit a page. But it would be a great enhancement.
The text was updated successfully, but these errors were encountered:
isen0011
added a commit
to isen0011/capybara_accessibility_audit
that referenced
this issue
May 8, 2024
Works on thoughtbot#21.
This doesn't completely fix the problem that is identified in thoughtbot#21, but
it is a step in that direction. The idea is that, if the configuration
setting `accessibility_audit_skip_on_error` is set to true, if an `axe`
violation is detected, instead of generating an error it will instead
mark the test as `skipped` with the `axe` output as the message in the
skip output.
There is a problem with this approach, which is the same problem
identified in issue thoughtbot#7 - as soon as a single test is marked skipped or
failed, then the rest of the test is skipped. This means that if a
test has both failing application logic and failing accessibility
validation, the first of those tests to fail will be the one that is
reported. For a system test, since any interaction with the page will
trigger the accessibility tests, it is likely that the test will be
marked as skipped and the application logic failure will be hidden.
This can be solved by running the tests a second time with
`accessibility_audit_enabled = false` and comparing the results, but
that does require two runs through the test suite.
I've observed that if a test fails because a page is not accessible, the remainder of the test block does not run. This results in issues being reported for a single page, but not for any other pages loaded in a test block.
Expected behavior:
The test should run to the end (barring other non-accessibility failures), even if a few of the pages visited fail the accessibility audit. Audit errors should be reported across all pages visited.
Actual behavior:
The test halts on the first accessibility error that it finds
Example:
I do realize that this issue/suggestion goes against the default behavior of Capybara - Capybara normally does not run the entire test if an assertion fails, or if it fails to visit a page. But it would be a great enhancement.
The text was updated successfully, but these errors were encountered: