From f6369af213299cb0ac40a5946db137aa31c0f0b7 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Fri, 1 Mar 2024 11:25:57 -0500 Subject: [PATCH] test(kayle): add split wasm kayle runner --- kayle/package.json | 1 + kayle/tests/basic-kayle.ts | 37 +++++++++++++++++++++++++++++++++++++ kayle/tests/basic.ts | 4 ++-- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 kayle/tests/basic-kayle.ts diff --git a/kayle/package.json b/kayle/package.json index 85f3907..883ff68 100644 --- a/kayle/package.json +++ b/kayle/package.json @@ -52,6 +52,7 @@ "test:puppeteer:extension": "npm run compile:test && yarn build:extension && node _tests/tests/extension.js", "test:puppeteer:tables": "npm run compile:test && node _tests/tests/tables.js", "test:puppeteer:clips": "npm run compile:test && node _tests/tests/clips.js", + "test:puppeteer:kayle": "npm run compile:test && node _tests/tests/basic-kayle.js", "test:puppeteer:innate": "npm run compile:test && node _tests/tests/innate.js", "test:htmlcs:extend": "npm run compile:test && node _tests/tests/extend-runner.js", "test:full": "npm run compile:test && node _tests/tests/full.js", diff --git a/kayle/tests/basic-kayle.ts b/kayle/tests/basic-kayle.ts new file mode 100644 index 0000000..6a0a02c --- /dev/null +++ b/kayle/tests/basic-kayle.ts @@ -0,0 +1,37 @@ +import assert from "assert"; +import puppeteer from "puppeteer"; +import { Standard, kayle } from "kayle"; +import { drakeMock } from "./mocks/html-mock"; +import { performance } from "perf_hooks"; + +(async () => { + const browser = await puppeteer.launch({ headless: "new" }); + const page = await browser.newPage(); + if (process.env.LOG_ENABLED) { + page.on("console", (msg) => console.log("PAGE LOG:", msg.text())); + } + const startTime = performance.now(); + const { issues, pageUrl, documentTitle, meta, automateable } = await kayle({ + page, + browser, + runners: ["kayle"], + includeWarnings: true, + html: drakeMock, + standard: Standard.WCAG2AA, + origin: "https://www.drake.com", + }); + const nextTime = performance.now() - startTime; + + console.log(`Issue count ${issues.length}`); + console.log(meta); + console.log(automateable); + console.log("time took", nextTime); + + // valid list + assert(Array.isArray(issues)); + assert(typeof pageUrl === "string"); + assert(typeof documentTitle === "string"); + assert(meta.errorCount <= 4); + + await browser.close(); +})(); diff --git a/kayle/tests/basic.ts b/kayle/tests/basic.ts index fe538bb..d102a17 100644 --- a/kayle/tests/basic.ts +++ b/kayle/tests/basic.ts @@ -14,7 +14,7 @@ import { performance } from "perf_hooks"; const { issues, pageUrl, documentTitle, meta, automateable } = await kayle({ page, browser, - runners: ["htmlcs", "axe", "kayle"], + runners: ["htmlcs", "axe"], includeWarnings: true, html: drakeMock, standard: Standard.WCAG2AA, @@ -28,7 +28,7 @@ import { performance } from "perf_hooks"; // valid list assert(Array.isArray(issues)); - assert(meta.errorCount <= 42); + assert(meta.errorCount <= 45); assert(meta.warningCount === 43); assert(meta.accessScore <= 70);