Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a11y checker #141

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ hugo.linux
/.hugo_build.lock

# Node
node_modules
node_modules

# A11y checker
test-results
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,22 @@ Theme: [hugo-book](https://themes.gohugo.io/themes/hugo-book/)
See [/content](/content/) for content.

See [About This Site](content/about-this-site/_index.md) for more information

## package.json

`package.json` dependencies and scripts are described here for readability:

- scripts
- `format:fix`: Fixes formatting of the `package.json` file
- `start`: Builds and serves the site at http://localhost:1313 with Hugo.
- `test:a11y`: Builds and serves the site, then uses Playwright and axe to test accessibility
- `test:a11y:tests`: Not meant for independent use, only as part of `test:a11y`
- `test:spelling`: Reports all apparent spelling errors. WIP, ref [#83](https://github.com/minetest/dev.luanti.org/issues/83) for details.
- depdendencies
- `hugo-extended`: Static site generator that turns Markdown and shortcodes into HTML
- devDependencies
- [`@axe-core/playwright`](https://npmjs.com/package/@axe-core/playwright): A11y tester bindings for Playwright
- [`@playwright/test`](https://npmjs.com/package/@playwright/test): Browser automation and test library
- [`cspell`](https://npmjs.com/package/cspell): Spellchecker
- [`sort-package-json`](https://npmjs.com/package/sort-package-json): Sorts package.json files for consistency
- [`start-server-and-test`](https://npmjs.com/package/start-server-and-test): Allows easy setup and teardown of complex tests, like our a11y tests
12 changes: 12 additions & 0 deletions a11y/a11y.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test.describe('homepage', () => {
test('should not have any automatically detectable accessibility issues', async ({ page }) => {
await page.goto('http://localhost:1313/');

const results = await new AxeBuilder({ page }).analyze();

expect(results.violations).toEqual([]);
});
});
3 changes: 3 additions & 0 deletions a11y/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Accessibility (a11y)

This folder contains test files to help us review the accessibility of the site. We use `Playwright` and `axe` for this. Learn more at [Accessibility testing | Playwright](https://playwright.dev/docs/accessibility-testing).
4 changes: 2 additions & 2 deletions content/about-this-site/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bookCollapseSection: true
# About This Site

This site is created using [Hugo](https://gohugo.io/), with theme [Hugo Book](https://themes.gohugo.io/themes/hugo-book/).
The sites source content can be found [here](https://github.com/minetest/dev.luanti.org/tree/master/content).
The site's source content can be found [on GitHub](https://github.com/minetest/dev.luanti.org/tree/master/content).

## Contributing

Expand All @@ -23,4 +23,4 @@ Luanti Documentation will be the central resource for the Luanti project as a wh
* Engine reference and internal structures
* Server and platform (player-facing) usage and guides

Our Roadmap can be found at [this issue](https://github.com/minetest/dev.luanti.org/issues/113).
Our roadmap can be found at [GitHub issue #113: Roadmap](https://github.com/minetest/dev.luanti.org/issues/113).
Loading
Loading