Skip to content

Commit

Permalink
add more info to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kan-pawes committed Nov 27, 2024
1 parent 2a93c06 commit 76d09e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
# Example project for a11y testing with Playwright

Goal is to show how simple it can be to set up accessibility testing for any web page.
Goal is to show how simple it can be to set up a simple accessibility testing for any web page.
With just two targeted tests, we aim to address many of the common a11y pitfalls in web app development also
ensuring that developers prioritize accessibility in every stage of the development process.
The Aria snapshot ensures correct structure on the page while Axe analyze checks common problems

## Running tests

```shell
npm ci
npm run uitest
```
If you get en error `Error: browserType.launch: Executable doesn't exist`, run
```shell
npx playwright install
```
to install Playwright's browsers on your machine (this needs to be done only once).

## Aria snapshots

To create new aria snapshot use `npm run uitest-codegen`
To create new aria snapshot use `npm run uitest-codegen` and use Aria tab from the bottom toolbar
(read more about Playwright's Codegen [here](https://playwright.dev/docs/codegen-intro))

To update all snapshot use `npx playwright test --update-snapshots`

Read more about aria in [docs](https://playwright.dev/docs/aria-snapshots)
Read more about aria snapshots in [docs](https://playwright.dev/docs/aria-snapshots)

## A11y testing

Run simple Axe analyze to discover any violations
Check ['should not have any automatically detectable accessibility issues'](tests/example.spec.js) test to see how to run simple
Axe analyze and discover any violations. Read more in [docs](https://playwright.dev/docs/accessibility-testing)

## Other
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Expand Down
2 changes: 1 addition & 1 deletion tests/example.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const {test, expect} = require('@playwright/test');
const AxeBuilder = require('@axe-core/playwright').default;

test.describe('homepage', () => { // 2
test('has title', async ({page}) => {
test('should have correct structure', async ({page}) => {
await page.goto('http://localhost:3000/');
await expect(page.locator('#root')).toMatchAriaSnapshot(`
- heading "Eventyrbilder" [level=4]
Expand Down

0 comments on commit 76d09e8

Please sign in to comment.