Skip to content

Commit

Permalink
test(kayle): add split wasm kayle runner
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Mar 1, 2024
1 parent 42c3f8e commit f6369af
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
1 change: 1 addition & 0 deletions kayle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
37 changes: 37 additions & 0 deletions kayle/tests/basic-kayle.ts
Original file line number Diff line number Diff line change
@@ -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();
})();
4 changes: 2 additions & 2 deletions kayle/tests/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Expand Down

0 comments on commit f6369af

Please sign in to comment.