Code used in Cecilie's Course Automatic Accessibility Testing for All Slides: https://docs.google.com/presentation/d/1io8gfCs3O031-MCb6Y0UsjvWU70Ib7-FpjPcPxpWQ50/edit?usp=sharing
-
Git Windows: Git for Windows Mac or Unix: do nothing, git’s already installed
-
Code editor. I will use Visual Studio Code, feel free to use what you want https://code.visualstudio.com/
- Download and install Node.js. Instructions here: https://nodejs.org/
- Clone project from Github:
git clone https://github.com/anneceh/automatic-A11y/ - cd into the project catalog:
cd automatic-A11y - Install dependencies with
npm install - Start the app with
npm run dev
- Start the app with
npm run dev. The command line will give you the address where you can see the app running. - Open Chrome or Edge and open the app
- Open developer tools Windows: Ctrl + Shift + I Mac: Command + Option + I
- Select Accessibility and generate report
- Answer the following:
- What is the accessibility score?
- What kind of errors did the audit find?
- What kind of errors did the audit not find?
Vitest-Axe is a fork of jest-axe. It shares that library's implementation and API. It is intended to make it easier to include its matchers without clashes between Vitest and Jest's environment or types.
- Run the unit tests with
npm test - How many errors are found?
- Configure the unit tests to ignore the errors.
- Tip: read the section on Axe configuration in the jest-axe documentation https://github.com/nickcolley/jest-axe
- Change the configuration back and fix the errors instead of ignoring them
- Run eslint with
npm run lint - How many accessibility errors are found by eslint?
- Run the Playwright tests with
npx playwright test - Read more about the errors found at https://dequeuniversity.com/rules/axe/4.10/
- Configure the tests to ignore the errors.
- Tip: read the documentation: https://playwright.dev/docs/accessibility-testing
- Write your own test where you check accessibility, add a couple of todos and then check accessibility again. Look at demo-todo-app.spec.ts if you need help/inspiration for tests.
- You get code ENOENT when you run
npm install - Problem: you are in the wrong directory
- Solution: cd into the project catalog:
cd automatic-A11yand runnpm install