Hi there, and thank you for Capybara, which I've been using daily for many years now!
My next step in making accessibility testing as easy and standard as possible is to run accessibility checks on every single page that is rendered in the test suite, and I'd love some pointers from Capybara experts to figure out how to integrate new (optional) logic with Capybara.
Ideally, the setup would be:
- Add a gem to the Rails app, add "require capybara-accessibility" or something in the rails_helper.rb file
- Every time Capybara sees a page (whether it's after a `visit`, a `click`, any `browser.navigate`, or even when a page element changes without a full reload), it runs the accessibility checks with `axe-core-capybara`
- Accessibility failures are logged as warnings, maybe this can be configured to be spec failures
- Adding "check_accessibility: false" to the example skips the a11y checks for the example
That's the ideal setup, but to get there I'm looking for callbacks or hooks or something that could trigger these checks without requiring the developer to manually add "expect(page).to be_axe_clean". Unfortunately I looked into the capybara code and from what I gathered (which is possibly not accurate!), I might need to monkey-patch some of it to make it work.
Any pointers to running code after each "visit" and each page change would be truly appreciated!
Thank you,
Kevin