From 8aa3ca478cc93cb754750e73911b8830c9000644 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Sun, 24 Mar 2024 09:23:40 -0400 Subject: [PATCH] chore(events): add pdf and drag-and-drop --- kayle/bench/fast_axecore-playwright.ts | 2 +- kayle/bench/fast_htmlcs-playwright.ts | 2 +- kayle/builder/build-extension.ts | 2 +- kayle/builder/build-htmlcs-params.ts | 2 +- kayle/builder/build-rules.ts | 30 +++--- kayle/lib/action.ts | 56 ++++++++-- kayle/lib/auto.ts | 8 +- kayle/lib/config.ts | 111 ++++++++++++++++++-- kayle/lib/kayle.ts | 18 ++-- kayle/lib/lint.ts | 4 +- kayle/lib/rules/index.ts | 2 +- kayle/lib/runner-js.ts | 2 +- kayle/lib/runner.ts | 8 +- kayle/lib/runners/axe.ts | 4 +- kayle/lib/runners/htmlcs.ts | 2 +- kayle/lib/utils/adblock.ts | 4 +- kayle/lib/utils/cdp-blocking.ts | 6 +- kayle/lib/utils/go-to-page.ts | 4 +- kayle/lib/utils/resource-ignore.ts | 2 +- kayle/lib/wasm/extract.ts | 2 +- kayle/lib/watcher.ts | 2 +- kayle/package.json | 2 +- kayle/tests/basic-axe-playwright.spec.ts | 6 +- kayle/tests/basic-htmlcs-playwright.spec.ts | 6 +- kayle/tests/basic-playwright.spec.ts | 6 +- kayle/tests/clips-playwright.spec.ts | 6 +- kayle/tests/extend-runner.ts | 2 +- kayle/tests/extension.ts | 2 +- kayle/tests/i18n.ts | 2 +- kayle/tests/innate-playwright.spec.ts | 2 +- kayle/tests/innate.ts | 4 +- kayle/tests/wasm.ts | 2 +- 32 files changed, 223 insertions(+), 90 deletions(-) diff --git a/kayle/bench/fast_axecore-playwright.ts b/kayle/bench/fast_axecore-playwright.ts index 9f2707e4..bace8587 100644 --- a/kayle/bench/fast_axecore-playwright.ts +++ b/kayle/bench/fast_axecore-playwright.ts @@ -53,7 +53,7 @@ async function launchBench() { unit: "OPS/S", value: 1000 / avg, }, - ]) + ]), ); } diff --git a/kayle/bench/fast_htmlcs-playwright.ts b/kayle/bench/fast_htmlcs-playwright.ts index fc495d85..08925d20 100644 --- a/kayle/bench/fast_htmlcs-playwright.ts +++ b/kayle/bench/fast_htmlcs-playwright.ts @@ -53,7 +53,7 @@ async function launchBench() { unit: "OPS/S", value: 1000 / avg, }, - ]) + ]), ); } diff --git a/kayle/builder/build-extension.ts b/kayle/builder/build-extension.ts index 91cdbeda..c28ab6b3 100644 --- a/kayle/builder/build-extension.ts +++ b/kayle/builder/build-extension.ts @@ -52,7 +52,7 @@ window.addEventListener("kayle_send", async (event) => { writeFileSync( `${ext}/content-script.js`, - `${extensionRunner}\n${extensionAxe}\n${extensionHtmlcs}\n${extensionRawEnd}` + `${extensionRunner}\n${extensionAxe}\n${extensionHtmlcs}\n${extensionRawEnd}`, ); const extensionManifest = `{ diff --git a/kayle/builder/build-htmlcs-params.ts b/kayle/builder/build-htmlcs-params.ts index eba1bce5..ac4c5b4f 100644 --- a/kayle/builder/build-htmlcs-params.ts +++ b/kayle/builder/build-htmlcs-params.ts @@ -83,7 +83,7 @@ const processFile = (filePath, paramList: ParamList[]) => { if (!guide) { guide = code.match( - /(_global\.HTMLCS_WCAG2AAA_Sniffs_)([A-Za-z0-9_]+)/ + /(_global\.HTMLCS_WCAG2AAA_Sniffs_)([A-Za-z0-9_]+)/, ); if (guide && guide[2]) { const end = guide[2].length - 23; diff --git a/kayle/builder/build-rules.ts b/kayle/builder/build-rules.ts index c7bc701d..dc8db2b8 100644 --- a/kayle/builder/build-rules.ts +++ b/kayle/builder/build-rules.ts @@ -37,7 +37,7 @@ import type { Rule } from "./build-types"; origin: "https://www.example.com", language, }, - true + true, ); await Promise.all([ @@ -54,7 +54,7 @@ import type { Rule } from "./build-types"; content: `window.htmlcsRuleMap = ${htmlcsRuleMap.toString()};`, }), page.exposeFunction("pushHtmlcsRule", (t: Rule[]) => - fast_htmlcs_rules.push(...t) + fast_htmlcs_rules.push(...t), ), page.exposeFunction("pushAxeRule", (t: Rule) => fast_axe_rules.push(t)), ]); @@ -93,12 +93,12 @@ import type { Rule } from "./build-types"; return r.description; }) - .sort((a, b) => a.ruleId.localeCompare(b.ruleId)) + .sort((a, b) => a.ruleId.localeCompare(b.ruleId)), )};`, - pConfig - ) + pConfig, + ), ), - "utf8" + "utf8", ); await writeFile( @@ -106,12 +106,12 @@ import type { Rule } from "./build-types"; Buffer.from( await format( `/* ${DNE} */\nexport const axeRules = ${JSON.stringify( - fast_axe_rules.sort((a, b) => a.ruleId.localeCompare(b.ruleId)) + fast_axe_rules.sort((a, b) => a.ruleId.localeCompare(b.ruleId)), )};`, - pConfig - ) + pConfig, + ), ), - "utf8" + "utf8", ); await page.close({ @@ -120,7 +120,7 @@ import type { Rule } from "./build-types"; }; const localesList: string[] = Array.from( - new Set(htmlcsLocales.concat(axeLocales)) + new Set(htmlcsLocales.concat(axeLocales)), ); localesList.push("en"); @@ -143,7 +143,7 @@ import type { Rule } from "./build-types"; export const importRules = async (locale: ${localesList .map((l) => `"${l}"`) .join( - " | " + " | ", )}, runner: "htmlcs" | "axe", baseDir?: "string"): Promise => { const rules = await import(` + "`${baseDir || './'}${locale.replace('-', '_')}/${runner === 'htmlcs' ? 'htmlcs' : 'axe'}-rules`" + @@ -167,10 +167,10 @@ import type { Rule } from "./build-types"; ${runnerImports} `, - pConfig - ) + pConfig, + ), ), - "utf8" + "utf8", ); await browser.close(); diff --git a/kayle/lib/action.ts b/kayle/lib/action.ts index e336375a..7cd5936a 100644 --- a/kayle/lib/action.ts +++ b/kayle/lib/action.ts @@ -56,13 +56,13 @@ export const actions = [ target.dispatchEvent( new Event("input", { bubbles: true, - }) + }), ); return Promise.resolve(); }, selector, - value + value, ); } catch (error) { throw new Error(`${failedActionElement} "${selector}"`); @@ -91,7 +91,7 @@ export const actions = [ target.dispatchEvent( new Event("input", { bubbles: true, - }) + }), ); return Promise.resolve(); }, selector); @@ -117,18 +117,27 @@ export const actions = [ target.dispatchEvent( new Event("change", { bubbles: true, - }) + }), ); return Promise.resolve(); }, selector, - checked + checked, ); } catch (error) { throw new Error(`${failedActionElement} "${selector}"`); } }, }, + { + name: "style", + match: /^style ( content)? (.+?)$/i, + run: async (_, page, __, matches) => { + await page.addStyleTag({ + content: matches[2], + }); + }, + }, { name: "screen-capture", match: /^(screen[ -]?capture|capture[ -]?screen)( to)? (.+)$/i, @@ -139,6 +148,31 @@ export const actions = [ }); }, }, + { + name: "pdf", + match: /^pdf( to)? (.+)$/i, + run: async (_, page, __, matches) => { + await page.pdf({ + path: matches[3], + }); + }, + }, + { + name: "drag-and-drop", + match: /^drag-and-drop ( element)? (.+)( to ) (target)$/i, + run: async (_, page, __, matches) => { + if (typeof page.dragAndDrop === "function") { + await page.dragAndDrop(matches[1], matches[3]); + } else if (typeof page?.mouse?.dragAndDrop) { + const positions = await page.$$eval( + [matches[1], matches[3]], + (elements: HTMLInputElement[]) => + elements.map((e) => e.getBoundingClientRect), + ); + await page.dragAndDrop(positions[0], positions[1]); + } + }, + }, { name: "wait-for-url", match: /^wait for (fragment|hash|host|path|url)( to (not )?be)? ([^\s]+)$/i, @@ -176,7 +210,7 @@ export const actions = [ {}, property, expectedValue, - negated + negated, ); }, }, @@ -216,7 +250,7 @@ export const actions = [ polling: 200, }, selector, - state + state, ); }, }, @@ -244,11 +278,11 @@ export const actions = [ }, { once: true, - } + }, ); }, selector, - eventType + eventType, ); await page.waitForFunction( @@ -263,7 +297,7 @@ export const actions = [ }, { polling: 200, - } + }, ); } catch (error) { throw new Error(`${failedActionElement} "${selector}"`); @@ -283,7 +317,7 @@ export const actions = [ */ export async function runAction(browser, page, options, act, customActions?) { const action = (customActions ?? actions).find((item) => - item.match.test(act) + item.match.test(act), ); if (!action) { diff --git a/kayle/lib/auto.ts b/kayle/lib/auto.ts index e92df798..dcde82d9 100644 --- a/kayle/lib/auto.ts +++ b/kayle/lib/auto.ts @@ -17,7 +17,7 @@ export async function autoKayle( cb?: ((result: Audit) => Promise) | ((result: Audit) => void); } = {}, ignoreSet?: Set, - _results?: Audit[] + _results?: Audit[], ): Promise { if (!write) { const { writeFile } = await import("fs/promises"); @@ -51,7 +51,7 @@ export async function autoKayle( if (o.store) { await write( `${o.store}/${encodeURIComponent(o.page.url())}`, - await o.page.content() + await o.page.content(), ); } @@ -84,7 +84,7 @@ export async function autoKayle( origin: link, }, ignoreSet, - _results + _results, ); }) .catch((e) => { @@ -94,7 +94,7 @@ export async function autoKayle( console.error(e); } }); - }) + }), ); return _results; diff --git a/kayle/lib/config.ts b/kayle/lib/config.ts index 51313dd2..0c66612b 100644 --- a/kayle/lib/config.ts +++ b/kayle/lib/config.ts @@ -42,7 +42,7 @@ type BrowserContext = { newCDPSession?(page: Partial | Frame): Partial; overridePermissions?( origin: string, - permissions: Permission[] + permissions: Permission[], ): Promise; }; @@ -53,6 +53,11 @@ type Browser = { createIncognitoBrowserContext?(): Promise; }; +declare abstract class JSHandle {} +declare abstract class ElementHandle< + ElementType extends Node = Element, +> extends JSHandle {} + // a type that impls cdp target type Target = {}; @@ -74,6 +79,66 @@ export type WaitForOptions = { waitUntil?: LifeCycleEvent | LifeCycleEvent[] | string; }; +// playwright mouse actions +type DefaultMouseActions = { + delay?: number; + clickCount?: number; + button?: "left"|"right"|"middle" +} | number; + +type Point = { + x?: number + y?: number +} + +// puppeteer mouse events +type MouseActions = { + dragAndDrop?( + source: Point, + target: Point, + options?: { + delay?: number; + }, + ): Promise; + + up?( + source: number | Readonly | unknown, + target?: number, + ): Promise; + + down?( + source: number | Readonly | unknown, + target?: number, + ): Promise; + move?( + source: number, + target: number, + ): Promise; + wheel?( + deltaX: number | Readonly<{x: number, y: number}> | unknown, + deltaY?: number, + ): Promise; + reset?(): Promise; + click?( + source: number, + target: number, + options?: { + delay?: number; + clickCount?: number; + button?: "left"|"right"|"middle" + }, + ): Promise; + dblclick?( + source: number, + target: number, + options?: { + delay?: number; + clickCount?: number; + button?: "left"|"right"|"middle" + }, + ): Promise; +}; + // a type that impls the puppeteer/playwright page type Page = { goto(url: string, options?: WaitForOptions): Promise; @@ -89,7 +154,7 @@ type Page = { _routes?: { url: string }[]; route( path: string, - intercept: (config: any, next: any) => Promise | Promise + intercept: (config: any, next: any) => Promise | Promise, ): Promise; setRequestInterception?(enable?: boolean): Promise; listenerCount?(name: string): number; @@ -99,24 +164,23 @@ type Page = { | Function | { default: Function; - } + }, ): Promise; addInitScript?(script: { content?: string }): Promise; evaluateOnNewDocument?< Params extends unknown[], - Func extends (...args: Params) => unknown = (...args: Params) => unknown + Func extends (...args: Params) => unknown = (...args: Params) => unknown, >( pageFunction: Func | string, ...args: Params ): Promise<{ identifier: string }>; evaluate< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc = EvaluateFunc, >( pageFunction: Func | string, ...args: Params ): Promise>>; - on(eventName: any, handler: (event: any, next?: any) => any): void; once(eventName: any, handler: (event: any, _?: any) => void): void; off(eventName: any, handler: (event: any, _?: any) => void): void; @@ -124,11 +188,46 @@ type Page = { url(): string; title(): Promise; content(): Promise; + addStyleTag(options: { + content?: string; + path?: string; + url?: string; + }): Promise; + dragAndDrop?( + source: string, + target: string, + options?: { + force?: boolean; + noWaitAfter?: boolean; + strict?: boolean; + trial?: boolean; + timeout?: number; + sourcePosition?: { x: number; y: number }; + targetPosition?: { x: number; y: number }; + }, + ): Promise; + mouse?: Partial; emulateCPUThrottling(factor: number | null): Promise; screenshot(s: { path?: string; clip?: Pick; }): Promise; + pdf(s: { + path?: string; + displayHeaderFooter?: boolean; + footerTemplate?: string; + headerTemplate?: string; + height?: string | number; + width?: string | number; + omitBackground?: boolean; + outline?: boolean; + preferCSSPageSize?: boolean; + // a number between 0.1 - 2. + scale?: number; + tagged?: boolean; + timeout?: number; + landscape?: boolean; + }): Promise; }; export interface CDPSession { diff --git a/kayle/lib/kayle.ts b/kayle/lib/kayle.ts index 4a23eb73..3bdb95b7 100644 --- a/kayle/lib/kayle.ts +++ b/kayle/lib/kayle.ts @@ -16,7 +16,7 @@ const audit = async (config: RunnerConfig): Promise => { return await config.page.evaluate( async (runOptions) => { - if (runOptions.origin && window.origin === "null") { + if (window.origin === "null" && runOptions.origin) { window.origin = runOptions.origin; } // @ts-ignore @@ -32,7 +32,7 @@ const audit = async (config: RunnerConfig): Promise => { origin: config.origin, language: config.language, clip: config.clip, - } + }, ); }; @@ -61,7 +61,7 @@ const injectRunners = async (config: RunnerConfig) => { return await Promise.allSettled([ config.page.evaluate(runnersJavascript["kayle"]), ...config.runners.map((r) => - config.page.evaluate(getRunner(config.language, r)) + config.page.evaluate(getRunner(config.language, r)), ), ]); } @@ -77,7 +77,7 @@ export const auditExtension = async (config: RunnerConfig): Promise => { } window.addEventListener("kayle_receive", (event: CustomEvent) => - resolve(event.detail.data) + resolve(event.detail.data), ); window.dispatchEvent( @@ -86,7 +86,7 @@ export const auditExtension = async (config: RunnerConfig): Promise => { name: "kayle", options: runOptions, }, - }) + }), ); }); }, @@ -100,7 +100,7 @@ export const auditExtension = async (config: RunnerConfig): Promise => { origin: config.origin, language: config.language, clip: config.clip, - } + }, ); }; @@ -121,7 +121,7 @@ const auditPageInnate = async (config: RunnerConf, results: Audit) => { const innateAudit: InnateIssue[] = await kayle_innate.audit( html, css, - config.clip + config.clip, ); for (const innateIssue of innateAudit) { @@ -163,7 +163,7 @@ const auditPageInnate = async (config: RunnerConf, results: Audit) => { */ export const kayle = async ( o: RunnerConf = {}, - preventClose?: boolean + preventClose?: boolean, ): Promise => { const watcher = new Watcher(); const navigate = o.page.url() === "about:blank" && (o.origin || o.html); @@ -214,7 +214,7 @@ export const kayle = async ( } return item; - }) + }), ); } diff --git a/kayle/lib/lint.ts b/kayle/lib/lint.ts index d8c36e36..2b420f1a 100644 --- a/kayle/lib/lint.ts +++ b/kayle/lib/lint.ts @@ -12,7 +12,7 @@ export const kayleLint = async ( source?: string, // url or html source o: Partial = {}, runner?: keyof typeof runnersJavascript, - forward?: boolean // forward messages to console + forward?: boolean, // forward messages to console ) => { const config = extractArgs(o); let html = source; @@ -55,7 +55,7 @@ export const kayleLint = async ( dom.window.eval(runnersJavascript.kayle); dom.window.eval( - runner ? runnersJavascript[runner] : runnersJavascript["htmlcs"] + runner ? runnersJavascript[runner] : runnersJavascript["htmlcs"], ); const results = await dom.window.__a11y.run({ diff --git a/kayle/lib/rules/index.ts b/kayle/lib/rules/index.ts index bad73557..3e40ea08 100644 --- a/kayle/lib/rules/index.ts +++ b/kayle/lib/rules/index.ts @@ -64,7 +64,7 @@ export const importRules = async ( | "pt_BR" | "en", runner: "htmlcs" | "axe", - baseDir?: "string" + baseDir?: "string", ): Promise => { const rules = await import( `${baseDir || "./"}${locale.replace("-", "_")}/${ diff --git a/kayle/lib/runner-js.ts b/kayle/lib/runner-js.ts index 7ac7a09e..b2efdb1d 100644 --- a/kayle/lib/runner-js.ts +++ b/kayle/lib/runner-js.ts @@ -78,7 +78,7 @@ const injectRunner = (runner: string, path: string, lang: string) => { */ const getRunner = ( language: string, - runner: keyof typeof runnersJavascript + runner: keyof typeof runnersJavascript, ) => { // if langauge exist get the runner type if (language) { diff --git a/kayle/lib/runner.ts b/kayle/lib/runner.ts index f83955de..caffc9e7 100644 --- a/kayle/lib/runner.ts +++ b/kayle/lib/runner.ts @@ -124,7 +124,7 @@ if (element.innerHTML.length > 31) { outerHTML = outerHTML.replace( element.innerHTML, - `${element.innerHTML.substring(0, 32)}...` + `${element.innerHTML.substring(0, 32)}...`, ); } @@ -166,7 +166,7 @@ const elementSelector = getElementSelector( element.parentNode as HTMLElement, - true + true, ); return `${ @@ -268,7 +268,7 @@ acc, tracker, meta, - missingAltIndexs: number[] + missingAltIndexs: number[], ) => { for (const is of issues) { if (validateIssue(is)) { @@ -344,7 +344,7 @@ } return []; }); - }) + }), ); // meta information keep records shaped to numbers diff --git a/kayle/lib/runners/axe.ts b/kayle/lib/runners/axe.ts index 20ffa0b6..458a37e0 100644 --- a/kayle/lib/runners/axe.ts +++ b/kayle/lib/runners/axe.ts @@ -10,7 +10,7 @@ const runAxeAudit = async (options) => { axeOptions.rules = a11yRulesToAxe( Array.isArray(options.rules) ? options.rules : [], - Array.isArray(options.ignore) ? options.ignore : [] + Array.isArray(options.ignore) ? options.ignore : [], ); // @ts-ignore todo: fix origin crashing test in axe-core when set direct html @@ -25,7 +25,7 @@ const runAxeAudit = async (options) => { (options.rootElement && window.document.querySelector(options.rootElement)) || window.document, - axeOptions + axeOptions, ); const issues = []; diff --git a/kayle/lib/runners/htmlcs.ts b/kayle/lib/runners/htmlcs.ts index cde2d3e8..21f1192b 100644 --- a/kayle/lib/runners/htmlcs.ts +++ b/kayle/lib/runners/htmlcs.ts @@ -49,7 +49,7 @@ const run = async (options) => { resolve(window.HTMLCS.messages); }, (error) => reject(error), - options.language + options.language, ); }); }; diff --git a/kayle/lib/utils/adblock.ts b/kayle/lib/utils/adblock.ts index edfb194b..965cd4bc 100644 --- a/kayle/lib/utils/adblock.ts +++ b/kayle/lib/utils/adblock.ts @@ -63,14 +63,14 @@ const engine: unknown | AdCheck = serializedArrayBuffer.byteLength / 1024 / 1024 - ).toFixed(2)} MB` + ).toFixed(2)} MB`, ); return engine; } catch (_) { // error for now without exiting since feature is opt in console.error( - "Error: adblock-rs installation missing! Run `npm i adblock-rs` or `yarn add adblock-rs` to start with the adblock engine." + "Error: adblock-rs installation missing! Run `npm i adblock-rs` or `yarn add adblock-rs` to start with the adblock engine.", ); } })() diff --git a/kayle/lib/utils/cdp-blocking.ts b/kayle/lib/utils/cdp-blocking.ts index ef1e906b..067caa65 100644 --- a/kayle/lib/utils/cdp-blocking.ts +++ b/kayle/lib/utils/cdp-blocking.ts @@ -9,7 +9,7 @@ const blockedResourceUrls = Object.keys(skippedResources); export const blockFilter = async ( e: any, client: CDPSession, - o: Partial + o: Partial, ) => { const resourceType = e.resourceType; @@ -51,7 +51,7 @@ export const blockFilter = async ( // perform native cdp blocking export const sendCDPPageConfigurationEnable = async ( client: CDPSession, - o: Partial + o: Partial, ) => { if (!client || (client && !client.on)) { return; @@ -102,7 +102,7 @@ export const sendCDPPageConfigurationReset = async ( client: CDPSession, o: Partial, allowImages?: boolean, - all?: boolean // reset all CDP + all?: boolean, // reset all CDP ) => { if (!client || (client && !client.on)) { return; diff --git a/kayle/lib/utils/go-to-page.ts b/kayle/lib/utils/go-to-page.ts index ddec5383..b61a7ead 100644 --- a/kayle/lib/utils/go-to-page.ts +++ b/kayle/lib/utils/go-to-page.ts @@ -26,7 +26,7 @@ export const setCDPIntercept = async (o: Partial) => { // block expensive resources export const setNetworkInterception = async ( - o: Partial + o: Partial, ): Promise => await setCDPIntercept(o); /** @@ -36,7 +36,7 @@ export const setNetworkInterception = async ( * @returns {Promise} Returns if the page was navigated to successfully. */ export const goToPage = async ( - o: Partial + o: Partial, ): Promise => { await setCDPIntercept(o); diff --git a/kayle/lib/utils/resource-ignore.ts b/kayle/lib/utils/resource-ignore.ts index 9dad3c89..5d3e4a53 100644 --- a/kayle/lib/utils/resource-ignore.ts +++ b/kayle/lib/utils/resource-ignore.ts @@ -44,7 +44,7 @@ const blockedResourcePatterns = Array.from(blockedResourceTypesCDP).map( (resource) => ({ resourceType: resource, requestStage: "Request", - }) + }), ); export { blockedResourceTypesCDP, blockedResourcePatterns }; diff --git a/kayle/lib/wasm/extract.ts b/kayle/lib/wasm/extract.ts index 3967ba84..08c97a46 100644 --- a/kayle/lib/wasm/extract.ts +++ b/kayle/lib/wasm/extract.ts @@ -12,6 +12,6 @@ export async function extractLinks(config: RunnerConfig, target?: string) { const domain = typeof target === "string" ? target : config.page.url(); return get_document_links( htmlContent, - domain !== "about:blank" ? domain : "" + domain !== "about:blank" ? domain : "", ); } diff --git a/kayle/lib/watcher.ts b/kayle/lib/watcher.ts index 73ac235c..cc0124ce 100644 --- a/kayle/lib/watcher.ts +++ b/kayle/lib/watcher.ts @@ -29,7 +29,7 @@ Watcher.prototype.watch = function (timeout: number): Promise { }, issues: [], }), - timeout + timeout, ); }); }; diff --git a/kayle/package.json b/kayle/package.json index 152325ba..10345a57 100644 --- a/kayle/package.json +++ b/kayle/package.json @@ -1,6 +1,6 @@ { "name": "kayle", - "version": "0.8.48", + "version": "0.8.50", "description": "Extremely fast and accurate accessibility engine built for any headless tool like playwright or puppeteer.", "main": "./build/index.js", "keywords": [ diff --git a/kayle/tests/basic-axe-playwright.spec.ts b/kayle/tests/basic-axe-playwright.spec.ts index 45953fe9..7cf107c2 100644 --- a/kayle/tests/basic-axe-playwright.spec.ts +++ b/kayle/tests/basic-axe-playwright.spec.ts @@ -36,7 +36,7 @@ test("fast_axecore audit drakeMock", async ({ page, browser }, testInfo) => { writeFileSync( testInfo.outputPath("axe-core.json"), JSON.stringify(results, null, 2), - "utf8" + "utf8", ); writeFileSync( @@ -51,8 +51,8 @@ test("fast_axecore audit drakeMock", async ({ page, browser }, testInfo) => { runner: ["fast_axecore"], }, null, - 2 + 2, ), - "utf8" + "utf8", ); }); diff --git a/kayle/tests/basic-htmlcs-playwright.spec.ts b/kayle/tests/basic-htmlcs-playwright.spec.ts index 75c9e6b7..0c315011 100644 --- a/kayle/tests/basic-htmlcs-playwright.spec.ts +++ b/kayle/tests/basic-htmlcs-playwright.spec.ts @@ -35,7 +35,7 @@ test("fast_htmlcs audit drakeMock", async ({ page, browser }, testInfo) => { writeFileSync( testInfo.outputPath("htmlcs.json"), JSON.stringify(results, null, 2), - "utf8" + "utf8", ); writeFileSync( @@ -50,8 +50,8 @@ test("fast_htmlcs audit drakeMock", async ({ page, browser }, testInfo) => { runner: ["fast_htmlcs"], }, null, - 2 + 2, ), - "utf8" + "utf8", ); }); diff --git a/kayle/tests/basic-playwright.spec.ts b/kayle/tests/basic-playwright.spec.ts index 48c1d65f..b2b94f2a 100644 --- a/kayle/tests/basic-playwright.spec.ts +++ b/kayle/tests/basic-playwright.spec.ts @@ -42,7 +42,7 @@ test("fast_htmlcs and fast_axecore audit drakeMock", async ({ writeFileSync( testInfo.outputPath("htmlcs.json"), JSON.stringify(results, null, 2), - "utf8" + "utf8", ); writeFileSync( @@ -57,8 +57,8 @@ test("fast_htmlcs and fast_axecore audit drakeMock", async ({ runner: ["fast_htmlcs", "fast_axecore"], }, null, - 2 + 2, ), - "utf8" + "utf8", ); }); diff --git a/kayle/tests/clips-playwright.spec.ts b/kayle/tests/clips-playwright.spec.ts index 03b391e9..834a76d9 100644 --- a/kayle/tests/clips-playwright.spec.ts +++ b/kayle/tests/clips-playwright.spec.ts @@ -44,7 +44,7 @@ test("fast_axecore audit drakeMock", async ({ page, browser }, testInfo) => { writeFileSync( testInfo.outputPath("axe-core.json"), JSON.stringify(results, null, 2), - "utf8" + "utf8", ); writeFileSync( @@ -59,8 +59,8 @@ test("fast_axecore audit drakeMock", async ({ page, browser }, testInfo) => { runner: ["fast_axecore"], }, null, - 2 + 2, ), - "utf8" + "utf8", ); }); diff --git a/kayle/tests/extend-runner.ts b/kayle/tests/extend-runner.ts index c82acf5f..1cfa3e3a 100644 --- a/kayle/tests/extend-runner.ts +++ b/kayle/tests/extend-runner.ts @@ -55,7 +55,7 @@ import { performance } from "perf_hooks"; HTMLCS_WCAG2AAA.sniffs.push("Principle4.Guideline4_1.4_1_4"); // register the new sniff rule to run HTMLCS.registerSniff("WCAG2AAA", "Principle4.Guideline4_1.4_1_4"); - `.trimStart() + `.trimStart(), ); const { issues, pageUrl, documentTitle, meta, automateable } = await kayle({ diff --git a/kayle/tests/extension.ts b/kayle/tests/extension.ts index c78c2a93..a64da411 100644 --- a/kayle/tests/extension.ts +++ b/kayle/tests/extension.ts @@ -35,7 +35,7 @@ import { performance } from "perf_hooks"; origin: "https://jeffmendez.com", // origin is the fake url in place of the raw content browserExtension: true, // enable the extension }, - true + true, ); const nextTime = performance.now() - startTime; diff --git a/kayle/tests/i18n.ts b/kayle/tests/i18n.ts index 7710ec40..7d5b8a10 100644 --- a/kayle/tests/i18n.ts +++ b/kayle/tests/i18n.ts @@ -29,7 +29,7 @@ import { performance } from "perf_hooks"; assert(typeof documentTitle === "string"); assert( issues[issues.length - 1].message === - "この要素のテキストまたは背景は透明部分を含みます。テキストと背景のコントラスト比が少なくとも4.5:1であることを確認してください。" + "この要素のテキストまたは背景は透明部分を含みます。テキストと背景のコントラスト比が少なくとも4.5:1であることを確認してください。", ); await browser.close(); })(); diff --git a/kayle/tests/innate-playwright.spec.ts b/kayle/tests/innate-playwright.spec.ts index c49ead41..1585b4d0 100644 --- a/kayle/tests/innate-playwright.spec.ts +++ b/kayle/tests/innate-playwright.spec.ts @@ -21,7 +21,7 @@ test("kayle_innate, fast_htmlcs and fast_axecore audit drakeMock profiling compa }); const mock = html.replace( "Drake Industries | Custom, Durable, High-Quality Labels, Asset Tags and Custom Server Bezels", - "" + "", ); const startTime = performance.now(); await audit(mock, css, false); diff --git a/kayle/tests/innate.ts b/kayle/tests/innate.ts index 0d631336..01658f42 100644 --- a/kayle/tests/innate.ts +++ b/kayle/tests/innate.ts @@ -13,14 +13,14 @@ import { performance } from "perf_hooks"; const mock = drakeMock .replace( "Drake Industries | Custom, Durable, High-Quality Labels, Asset Tags and Custom Server Bezels", - "" + "", ) .replace( ``, `
-
` + `, ); const startTime = performance.now(); diff --git a/kayle/tests/wasm.ts b/kayle/tests/wasm.ts index 95fcfd87..cefc444f 100644 --- a/kayle/tests/wasm.ts +++ b/kayle/tests/wasm.ts @@ -73,7 +73,7 @@ import { drakeMock } from "./mocks/html-mock"; "https://www.drake.com/vinyl-pvc", "https://www.drake.com/wide-format-digital-printing", "https://www.drake.com/wide-narrow-format-digital-cutting", - ].sort() + ].sort(), ); await browser.close(); })();