Skip to content

Instantly share code, notes, and snippets.

@weienwong
Created May 24, 2019 21:39
Show Gist options
  • Save weienwong/5cbe821fedb7f4d6790517c9af6d5b7c to your computer and use it in GitHub Desktop.
Save weienwong/5cbe821fedb7f4d6790517c9af6d5b7c to your computer and use it in GitHub Desktop.
;(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.setBypassCSP(true)
await page.goto("http://localhost:8000")
const results = await new AxePuppeteer(page)
.analyze()
if (results.violations.length > 0) {
log(chalk.red.bold("Axe violations:"))
for (let i = 0; i < results.violations.length; i++) {
console.log(results.violations[i]);
}
} else {
console.log("All accessibility tests have passed!");
}
await page.close()
await browser.close()
server.close((err) => {
if (err) {
console.error(err);
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment