Skip to content

Commit

Permalink
chore: use the axe core playwright package
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc authored and tiensonqin committed Sep 9, 2022
1 parent 18d58d4 commit 44d0cd1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
20 changes: 10 additions & 10 deletions e2e-tests/accessibility.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { injectAxe, checkA11y } from 'axe-playwright'
import { test } from './fixtures'
import { createRandomPage } from './utils'
import { expect } from '@playwright/test'
import AxeBuilder from '@axe-core/playwright'


test('check a11y for the whole page', async ({ page }) => {
await page.waitForTimeout(2000) // wait for everything be ready
await injectAxe(page)
await page.waitForTimeout(2000) // wait for everything be ready
test('should not have any automatically detectable accessibility issues', async ({ page }) => {
await createRandomPage(page)
await page.waitForTimeout(2000) // wait for everything be ready
await checkA11y(page, null, {
detailedReport: true,
})
await page.waitForTimeout(2000)
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
.setLegacyMode()
.analyze()

expect(accessibilityScanResults.violations).toEqual([]);
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"private": true,
"main": "static/electron.js",
"devDependencies": {
"@axe-core/playwright": "^4.4.4",
"@capacitor/cli": "3.2.2",
"@playwright/test": "^1.24.2",
"@tailwindcss/ui": "0.7.2",
"@types/gulp": "^4.0.7",
"axe-playwright": "^1.1.11",
"cross-env": "^7.0.3",
"cssnano": "^4.1.10",
"del": "^6.0.0",
Expand Down
29 changes: 21 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
dependencies:
"@jridgewell/trace-mapping" "^0.3.0"

"@axe-core/playwright@^4.4.4":
version "4.4.4"
resolved "https://registry.yarnpkg.com/@axe-core/playwright/-/playwright-4.4.4.tgz#3786c5f6bba38d1991b608584b00ae2744544573"
integrity sha512-VA7MR1WCqW5tFcUGCXDaaqV9pJUCdOGIR4DiZJrOxGjeRYxz3VwyMc1MDg/yiJ5fQA/QYMx+w0mvqYEr3CPx7w==
dependencies:
axe-core "^4.4.2"
playwright ">= 1.0.0"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"
Expand Down Expand Up @@ -1226,18 +1234,11 @@ autoprefixer@^9.8.6:
postcss "^7.0.32"
postcss-value-parser "^4.1.0"

axe-core@^4.0.1:
axe-core@^4.4.2:
version "4.4.3"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.3.tgz#11c74d23d5013c0fa5d183796729bc3482bd2f6f"
integrity sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==

axe-playwright@^1.1.11:
version "1.1.11"
resolved "https://registry.yarnpkg.com/axe-playwright/-/axe-playwright-1.1.11.tgz#e57638f08d29b58d157a2aeb34cf81730eab2cff"
integrity sha512-YHmUouvF/dFNxoFFwbCjPFmEPwoJSzPgZsD0KZs3xjsR03Rf2mAh771ugre950MaBYuiyxYDlurH5BOEJBK34Q==
dependencies:
axe-core "^4.0.1"

bach@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/bach/-/bach-1.2.0.tgz#4b3ce96bf27134f79a1b414a51c14e34c3bd9880"
Expand Down Expand Up @@ -5560,6 +5561,18 @@ [email protected]:
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.24.2.tgz#47bc5adf3dcfcc297a5a7a332449c9009987db26"
integrity sha512-zfAoDoPY/0sDLsgSgLZwWmSCevIg1ym7CppBwllguVBNiHeixZkc1AdMuYUPZC6AdEYc4CxWEyLMBTw2YcmRrA==

[email protected]:
version "1.25.2"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.25.2.tgz#ea4baa398a4d45fcdfe48799482b599e3d0f033f"
integrity sha512-0yTbUE9lIddkEpLHL3u8PoCL+pWiZtj5A/j3U7YoNjcmKKDGBnCrgHJMzwd2J5vy6l28q4ki3JIuz7McLHhl1A==

"playwright@>= 1.0.0":
version "1.25.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.25.2.tgz#0fc67e4385a52a51371ff9114bf68e3ad50a7f41"
integrity sha512-RwMB5SFRV/8wSfK+tK8ycpqdzORvoqUNz9DUeRfSgZFrZej5uuBl9wFjWcc+OkXFEtaPmx1acAVGG7hA4IJ1kg==
dependencies:
playwright-core "1.25.2"

playwright@^1.24.2:
version "1.24.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.24.2.tgz#51e60f128b386023e5ee83deca23453aaf73ba6d"
Expand Down

0 comments on commit 44d0cd1

Please sign in to comment.