-
Hi all! At Brightline we are trying to become more and more accessible. We're building a lot of our front-end components using ViewComponent. We have a good way of testing accessibility via capybara with e.g.
This is all good and well, but it's an expensive test. We render the entire page, wait for it to load, then expect accessibility. Does anyone have any good approaches to a more unit-based approach to testing view components with accessibility? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @hjhart, do you write previews for your components? If it's the case, you can use the previews URLs to run your accessibility tests. Your tests will run faster as only the single component you want to test is rendered. I suspect you may also want to test the interaction between components rendered on the same page. For this case, what about creating a "static" view (ie. that doesn't load data from the DB) with the relevant components, and running your tests against it? |
Beta Was this translation helpful? Give feedback.
Hi @hjhart, do you write previews for your components? If it's the case, you can use the previews URLs to run your accessibility tests. Your tests will run faster as only the single component you want to test is rendered.
I suspect you may also want to test the interaction between components rendered on the same page. For this case, what about creating a "static" view (ie. that doesn't load data from the DB) with the relevant components, and running your tests against it?