Skip to content

Commit

Permalink
Merge pull request #5 from KainosSoftwareLtd/feature/axe-runner
Browse files Browse the repository at this point in the history
Add aXe as additional runner
  • Loading branch information
peadarkelly committed Feb 23, 2021
2 parents d76217c + c09dfb6 commit 3046948
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ A HTML-focussed Automated Accessibility Testing framework that leverages [Pa11y]

The framework is used to scan locally saved HTML files, referred to as **snapshots**.

Pa11y leverages the following test runners to verify the HTML:
* [aXe-core](https://www.axe-core.org/)
* [HTML CodeSniffer](http://squizlabs.github.com/HTML_CodeSniffer/)

This framework can be ran locally or embedded into CI Pipelines.

**Note that this framework focusses on HTML structure only. Visual and navigation issues will not be detected.**
Expand Down
Binary file modified report/report.zip
Binary file not shown.
4 changes: 3 additions & 1 deletion snapshots/pass.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<html lang="en">
<head><title>Hello Pass World</title></head>
<body>
<h1>This is my Passing Heading</h1>
<main role="main">
<h1>This is my Passing Heading</h1>
</main>
</body>
</html>
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ export interface Pa11yOptions {
level: string
standard: string
rules: string[]
runners: string[]
}
10 changes: 7 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readdir } from 'fs-extra'
import { basename, join } from 'path'
import puppeteer, { Browser, Page } from 'puppeteer'
import { ADDITIONAL_RULES, SNAPSHOTS_DIRECTORY, STANDARD } from './config'
import { ADDITIONAL_RULES, PUPPETEER_EXECUTABLE_PATH, SNAPSHOTS_DIRECTORY, STANDARD } from './config'
import { Pa11yOptions } from './types'

export async function readSnapshots(): Promise<string[]> {
Expand All @@ -11,7 +11,7 @@ export async function readSnapshots(): Promise<string[]> {
export function prepareBrowser(): Promise<Browser> {
return puppeteer.launch({
headless: true,
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
executablePath: PUPPETEER_EXECUTABLE_PATH,
args: ['--no-sandbox', '--disable-setuid-sandbox', '--headless', '--disable-gpu', '--window-size=1280,800']
})
}
Expand All @@ -24,7 +24,11 @@ export function generatePa11yOptions(browser: Browser, page: Page): Pa11yOptions
includeWarnings: false,
level: 'error',
standard: STANDARD,
rules: ADDITIONAL_RULES
rules: ADDITIONAL_RULES,
runners: [
'axe',
'htmlcs'
]
}
}

Expand Down

0 comments on commit 3046948

Please sign in to comment.