diff --git a/package.json b/package.json index 681885fc..1df8530d 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@types/node": "^24.7.2", "@types/punycode": "^2.1.4", "@vue/babel-plugin-jsx": "^2.0.1", + "axe-core": "^4.11.0", "babel-loader": "^10.0.0", "commitlint": "^20.1.0", "css-loader": "^7.1.2", @@ -77,4 +78,4 @@ "engines": { "node": ">=20" } -} +} \ No newline at end of file diff --git a/test-e2e/axe/base.test.ts b/test-e2e/axe/base.test.ts new file mode 100644 index 00000000..b235b3f3 --- /dev/null +++ b/test-e2e/axe/base.test.ts @@ -0,0 +1,30 @@ +import axe, { source } from "axe-core" +import { type Page } from 'puppeteer' +import { launchBrowser, type LaunchContext } from "../common/base" + +type AxeType = typeof axe +let context: LaunchContext + +describe('After installed', () => { + beforeEach(async () => context = await launchBrowser()) + + // afterEach(async () => context.close()) + + test('Open the official page', async () => { + + const page = await context.openAppPage("/data/dashboard") + await initAxe(page) + const result = await page.evaluate(async () => { + // axe.run() + const axeRes = await (window as unknown as { axe: AxeType }).axe.run() + console.log(axeRes) + return axeRes + }) + }, 5000) +}) + +export const initAxe = async (page: Page) => { + await page.evaluate(async (source: string) => { + await eval(source) + }, source) +} \ No newline at end of file diff --git a/test-e2e/axe/non-violent.test.ts b/test-e2e/axe/non-violent.test.ts new file mode 100644 index 00000000..e69de29b