-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic axe core asseccibility check
- Loading branch information
Showing
5 changed files
with
226 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Accessibiliy Check | ||
|
||
run-name: Playwright accessibility tests 🚀 | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "30 23 * * *" | ||
jobs: | ||
run-stackblitz-templates-tests: | ||
runs-on: macos-14 | ||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- run: corepack enable | ||
- run: pnpm --version | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "pnpm" | ||
cache-dependency-path: "**/pnpm-lock.yaml" | ||
- name: install | ||
run: pnpm install --no-frozen-lockfile --prefer-offline | ||
|
||
- name: Install dependencies with Playwright | ||
run: | | ||
pnpm playwright install --with-deps | ||
- name: Run tests | ||
run: | | ||
cd apps/e2e-tests | ||
npx playwright test --grep @accessibility --project=chromium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import AxeBuilder from "@axe-core/playwright"; | ||
import { HomePage } from "../page-objects/HomePage"; | ||
import { CategoryPage } from "../page-objects/CategoryPage"; | ||
import { ProductPage } from "../page-objects/ProductPage"; | ||
|
||
test.describe.only( | ||
"Should not have any automatically detectable accessibility issues", | ||
{ tag: "@accessibility" }, | ||
() => { | ||
let homePage: HomePage; | ||
let productPage: ProductPage; | ||
|
||
// Before Hook | ||
test.beforeEach(async ({ page }) => { | ||
homePage = new HomePage(page); | ||
productPage = new ProductPage(page); | ||
|
||
await homePage.visitMainPage(); | ||
}); | ||
|
||
test("Check Homepage accessibility issues", async ({ page }) => { | ||
await homePage.visitMainPage(); | ||
const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
|
||
test("Check Category accessibility issues", async ({ page }) => { | ||
await homePage.visitMainPage(); | ||
await homePage.openCategoryPage(); | ||
const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
|
||
test("Check Product Page accessibility issues", async ({ page }) => { | ||
await homePage.visitMainPage(); | ||
await homePage.openCartPage(); | ||
const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}, | ||
); |
Oops, something went wrong.