Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
A MR that's aim is to provide the option for accessibility tests using cypress-axe. #110
Pipeline
Currently, these tests are optional and as far as we can see do not run in the pipeline. Is this something that should be considered for the project or is leaving them optional fine for now?
Order History Test Improvement
In our project we have 2 users setup that are imported in pipeline. 1 user has orders and 1 user does not have orders thus allowing us to test the order history page with and without orders easily without having to create an order via the tests itself and having a consistent test data state. This would be one suggesting for improvement we see here and also with the account tests in general to consider how items like orders are created for test cases. At the moment we have left this test exactly the same as the main account order history test.
Address cleanup improvements
Again in our project we have our database cleaned for each test run, so we know that state at the beginning of each test. Here with the address test we are not 100% sure what the user's address state is in the spec. In the end I think we should test the address book with no addresses, with only default addresses and with extra addresses but for these tests we have stuck to the tests like they are in the normal test specs. At the moment we have left this test exactly the same as the main account order history test.
Splitting account tests
As the cypress-axe assertion will by default be treated as an error when you add multiple tests into one spec the test spec will exit on first fail. It is possible to ignore this with a flag, for example see the checkout step tests, but the tests will then be marked as successful. We feel if the accessibility tests fail then they should really fail rather than fail silently. For this reason we have split all tests out into individual test specs so you get a better overview of the real errors.
Tests allow failure
There are two cases when we have set the "allow failure" flag as true. Firstly in the checkout tests when we validate step 1 of the checkout and then process to step 2. Since there are errors in step 1 cypress by default would stop at these and not continue to step 2. The second time is during any account test with an after section. If there is a failure in the test itself then the after section, for example address cleanup, would not happen. So in this case we need to mark the test as allow failure to run the test clean up step.
Hyvä tests
In our internal project we only have the single theme based on luma and as such to keep things simple have only provided the accessibility tests for luma, though it should be easily possible to create a second accessibility spec for hyvä if and when desired.