Skip to content

Commit

Permalink
chore(docs): add playwright only note for clips
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Sep 18, 2023
1 parent 45f63f7 commit c87eaf7
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 80 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const results = await autoKayle({
## Clips

You can include base64 images with the audits to get a visual of the exact location of the issue.
Currently this is only supported with playwright with default chrome launch args.

```ts
const results = await kayle({
Expand Down
3 changes: 2 additions & 1 deletion kayle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"test:puppeteer:automa": "npm run compile:test && node _tests/tests/automa.js",
"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:lint": "node build/lint.js",
"test:unit:unique-selector": "npm run compile:test && node _tests/tests/unit/unique-selector.js",
"publish": "yarn prepare && yarn npm publish"
Expand All @@ -68,7 +69,7 @@
"@types/jsdom": "^20.0.1",
"@types/node": "^18.11.9",
"prettier": "^2.8.0",
"puppeteer": "^20.9.0",
"puppeteer": "^21.2.1",
"typescript": "^4.9.3"
},
"jest": {
Expand Down
42 changes: 42 additions & 0 deletions kayle/tests/clips.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import assert from "assert";
import puppeteer from "puppeteer";
import { 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: ["axe"],
includeWarnings: true,
origin: "https://www.drake.com",
html: drakeMock,
waitUntil: "domcontentloaded",
allowImages: true,
clip: true,
clipDir: "./_data/drake.com",
clip2Base64: true,
});
const nextTime = performance.now() - startTime;

console.log(issues)

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");

await browser.close();
})();
153 changes: 74 additions & 79 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1736,25 +1736,20 @@ __metadata:
languageName: node
linkType: hard

"@puppeteer/browsers@npm:1.4.6":
version: 1.4.6
resolution: "@puppeteer/browsers@npm:1.4.6"
"@puppeteer/browsers@npm:1.7.1":
version: 1.7.1
resolution: "@puppeteer/browsers@npm:1.7.1"
dependencies:
debug: 4.3.4
extract-zip: 2.0.1
progress: 2.0.3
proxy-agent: 6.3.0
proxy-agent: 6.3.1
tar-fs: 3.0.4
unbzip2-stream: 1.4.3
yargs: 17.7.1
peerDependencies:
typescript: ">= 4.7.4"
peerDependenciesMeta:
typescript:
optional: true
bin:
browsers: lib/cjs/main-cli.js
checksum: 29569dd8a8a41737bb0dd40cce6279cfc8764afc6242d2f9d8ae610bed7e466fc77eeb27b9b3ac53dd04927a1a0e26389f282f6ba057210979b36ab455009d64
checksum: fb7cf7773a1aed4e34ce0952dbf9609a164e624d4f8e1f342b816fe3e983888d7a7b2fbafc963559e96cb5bca0d75fb9c81f2097f9b1f5478a0f1cc7cbc12dff
languageName: node
linkType: hard

Expand Down Expand Up @@ -2148,7 +2143,7 @@ __metadata:
languageName: node
linkType: hard

"agent-base@npm:^7.0.1, agent-base@npm:^7.0.2, agent-base@npm:^7.1.0":
"agent-base@npm:^7.0.2, agent-base@npm:^7.1.0":
version: 7.1.0
resolution: "agent-base@npm:7.1.0"
dependencies:
Expand Down Expand Up @@ -2810,14 +2805,14 @@ __metadata:
languageName: node
linkType: hard

"chromium-bidi@npm:0.4.16":
version: 0.4.16
resolution: "chromium-bidi@npm:0.4.16"
"chromium-bidi@npm:0.4.26":
version: 0.4.26
resolution: "chromium-bidi@npm:0.4.26"
dependencies:
mitt: 3.0.0
mitt: 3.0.1
peerDependencies:
devtools-protocol: "*"
checksum: 9cbb362fdf589dbdfd1618499c5bbdac45a3aa1291c1d2faa2f1ea3768738677985175d1bb1511dfe3e188bc78e6ea2acb453564ece7e09f535bbcd2253ce06a
checksum: fac806b005c0860c62bbccd05333ac74cfff9786a3e94e1214106d2928780fe053b03118f1d5ef2adba31a0cb4b86f4d768ded5b75ff6a28805abcf7e3869f73
languageName: node
linkType: hard

Expand Down Expand Up @@ -3222,15 +3217,20 @@ __metadata:
languageName: node
linkType: hard

"cosmiconfig@npm:8.2.0":
version: 8.2.0
resolution: "cosmiconfig@npm:8.2.0"
"cosmiconfig@npm:8.3.5":
version: 8.3.5
resolution: "cosmiconfig@npm:8.3.5"
dependencies:
import-fresh: ^3.2.1
import-fresh: ^3.3.0
js-yaml: ^4.1.0
parse-json: ^5.0.0
parse-json: ^5.2.0
path-type: ^4.0.0
checksum: 836d5d8efa750f3fb17b03d6ca74cd3154ed025dffd045304b3ef59637f662bde1e5dc88f8830080d180ec60841719cf4ea2ce73fb21ec694b16865c478ff297
peerDependencies:
typescript: ">=4.9.5"
peerDependenciesMeta:
typescript:
optional: true
checksum: c6e44bb3cabf268b70049e7bd4ee8ecf00068854e53cbc32f9104794927ef406817f9e64e1c4949bd10776b604c01f7b50674336fcd2d5b9efc4cf8277fdf025
languageName: node
linkType: hard

Expand Down Expand Up @@ -3482,10 +3482,10 @@ __metadata:
languageName: node
linkType: hard

"devtools-protocol@npm:0.0.1147663":
version: 0.0.1147663
resolution: "devtools-protocol@npm:0.0.1147663"
checksum: 0631f2b6c6cd7f56e7d62a85bfc291f7e167f0f2de90969ef61fb24e2bd546b2e9530043d2bc3fe6c4d7a9e00473004272d2c2832a10a05e4b75c03a22f549fc
"devtools-protocol@npm:0.0.1159816":
version: 0.0.1159816
resolution: "devtools-protocol@npm:0.0.1159816"
checksum: 24aa985a34a093a7418c955d0398e8a0829bc1f482eb1db55eca0cf09789de8344d0f36177d3e394fc63ec9bf08cf4114fadf3a7f2ab64f95a17ccc53bcf1aea
languageName: node
linkType: hard

Expand Down Expand Up @@ -5405,13 +5405,13 @@ __metadata:
languageName: node
linkType: hard

"https-proxy-agent@npm:^7.0.0":
version: 7.0.1
resolution: "https-proxy-agent@npm:7.0.1"
"https-proxy-agent@npm:^7.0.2":
version: 7.0.2
resolution: "https-proxy-agent@npm:7.0.2"
dependencies:
agent-base: ^7.0.2
debug: 4
checksum: 2d765c31865071373771f53abdd72912567b76015a4eff61094f586194192950cd89257d50f0e621807a16c083bc8cad5852e3885c6ba154d2ce721a18fac248
checksum: 088969a0dd476ea7a0ed0a2cf1283013682b08f874c3bc6696c83fa061d2c157d29ef0ad3eb70a2046010bb7665573b2388d10fdcb3e410a66995e5248444292
languageName: node
linkType: hard

Expand Down Expand Up @@ -5477,7 +5477,7 @@ __metadata:
languageName: node
linkType: hard

"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1":
"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0":
version: 3.3.0
resolution: "import-fresh@npm:3.3.0"
dependencies:
Expand Down Expand Up @@ -6108,7 +6108,7 @@ __metadata:
fast_htmlcs: "workspace:*"
kayle_innate: "workspace:*"
prettier: ^2.8.0
puppeteer: ^20.9.0
puppeteer: ^21.2.1
typescript: ^4.9.3
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -6683,10 +6683,10 @@ __metadata:
languageName: node
linkType: hard

"mitt@npm:3.0.0":
version: 3.0.0
resolution: "mitt@npm:3.0.0"
checksum: f7be5049d27d18b1dbe9408452d66376fa60ae4a79fe9319869d1b90ae8cbaedadc7e9dab30b32d781411256d468be5538996bb7368941c09009ef6bbfa6bfc7
"mitt@npm:3.0.1":
version: 3.0.1
resolution: "mitt@npm:3.0.1"
checksum: b55a489ac9c2949ab166b7f060601d3b6d893a852515ae9eca4e11df01c013876df777ea109317622b5c1c60e8aae252558e33c8c94e14124db38f64a39614b1
languageName: node
linkType: hard

Expand Down Expand Up @@ -7273,19 +7273,19 @@ __metadata:
languageName: node
linkType: hard

"pac-proxy-agent@npm:^7.0.0":
version: 7.0.0
resolution: "pac-proxy-agent@npm:7.0.0"
"pac-proxy-agent@npm:^7.0.1":
version: 7.0.1
resolution: "pac-proxy-agent@npm:7.0.1"
dependencies:
"@tootallnate/quickjs-emscripten": ^0.23.0
agent-base: ^7.0.2
debug: ^4.3.4
get-uri: ^6.0.1
http-proxy-agent: ^7.0.0
https-proxy-agent: ^7.0.0
https-proxy-agent: ^7.0.2
pac-resolver: ^7.0.0
socks-proxy-agent: ^8.0.1
checksum: 45fe10ae58b1700d5419a9e5b525fb261b866ed6a65c1382fe45c3d5af9f81d9a58250d407941a363b1955e0315f3d97e02a2f20e4c7e2ba793bd46585db7ec8
socks-proxy-agent: ^8.0.2
checksum: 3d4aa48ec1c19db10158ecc1c4c9a9f77792294412d225ceb3dfa45d5a06950dca9755e2db0d9b69f12769119bea0adf2b24390d9c73c8d81df75e28245ae451
languageName: node
linkType: hard

Expand Down Expand Up @@ -7330,7 +7330,7 @@ __metadata:
languageName: node
linkType: hard

"parse-json@npm:^5.0.0":
"parse-json@npm:^5.0.0, parse-json@npm:^5.2.0":
version: 5.2.0
resolution: "parse-json@npm:5.2.0"
dependencies:
Expand Down Expand Up @@ -7583,19 +7583,19 @@ __metadata:
languageName: node
linkType: hard

"proxy-agent@npm:6.3.0":
version: 6.3.0
resolution: "proxy-agent@npm:6.3.0"
"proxy-agent@npm:6.3.1":
version: 6.3.1
resolution: "proxy-agent@npm:6.3.1"
dependencies:
agent-base: ^7.0.2
debug: ^4.3.4
http-proxy-agent: ^7.0.0
https-proxy-agent: ^7.0.0
https-proxy-agent: ^7.0.2
lru-cache: ^7.14.1
pac-proxy-agent: ^7.0.0
pac-proxy-agent: ^7.0.1
proxy-from-env: ^1.1.0
socks-proxy-agent: ^8.0.1
checksum: e3fb0633d665e352ed4efe23ae5616b8301423dfa4ff1c5975d093da8a636181a97391f7a91c6a7ffae17c1a305df855e95507f73bcdafda8876198c64b88f5b
socks-proxy-agent: ^8.0.2
checksum: 31030da419da31809340ac2521090c9a5bf4fe47a944843f829b3502883208c8586a468955e64b694140a41d70af6f45cf4793f5efd4a6f3ed94e5ac8023e36d
languageName: node
linkType: hard

Expand Down Expand Up @@ -7630,33 +7630,28 @@ __metadata:
languageName: node
linkType: hard

"puppeteer-core@npm:20.9.0":
version: 20.9.0
resolution: "puppeteer-core@npm:20.9.0"
"puppeteer-core@npm:21.2.1":
version: 21.2.1
resolution: "puppeteer-core@npm:21.2.1"
dependencies:
"@puppeteer/browsers": 1.4.6
chromium-bidi: 0.4.16
"@puppeteer/browsers": 1.7.1
chromium-bidi: 0.4.26
cross-fetch: 4.0.0
debug: 4.3.4
devtools-protocol: 0.0.1147663
ws: 8.13.0
peerDependencies:
typescript: ">= 4.7.4"
peerDependenciesMeta:
typescript:
optional: true
checksum: d298598445b0f2032c02d0ed7d1d18a8d2d2fcaf6fc31fc96e93e2669a7fc6fbee0338bd9b8c8f8822887f18a8fb680b77bb56e96fe1928baadb52292bbd93b4
devtools-protocol: 0.0.1159816
ws: 8.14.1
checksum: 7b37e35b3df308128c6526756b13372d5c4e19d4b6fce8e4c31e5616eeca2f49a420132d7eae249de82180821c1147b327b9d11e1b730911a604db3e9be256fe
languageName: node
linkType: hard

"puppeteer@npm:^20.9.0":
version: 20.9.0
resolution: "puppeteer@npm:20.9.0"
"puppeteer@npm:^21.2.1":
version: 21.2.1
resolution: "puppeteer@npm:21.2.1"
dependencies:
"@puppeteer/browsers": 1.4.6
cosmiconfig: 8.2.0
puppeteer-core: 20.9.0
checksum: c328eca0a649d5e5d68ee2874c25254b8498ab8bbfa1731b444c2dd69380c2f6df1741b3ad427d448fb8e5bcdd259cc9c1ed749dddfc634a64a6a607403fe53c
"@puppeteer/browsers": 1.7.1
cosmiconfig: 8.3.5
puppeteer-core: 21.2.1
checksum: 43a8ca132be52c2b07f35cda50c25c38009bc888433ad1106009c5ee76a252b2d8e9bab939ccacc408d17da6ad6671fdb773423289e87dd830c9e5f84781859c
languageName: node
linkType: hard

Expand Down Expand Up @@ -8293,14 +8288,14 @@ __metadata:
languageName: node
linkType: hard

"socks-proxy-agent@npm:^8.0.1":
version: 8.0.1
resolution: "socks-proxy-agent@npm:8.0.1"
"socks-proxy-agent@npm:^8.0.2":
version: 8.0.2
resolution: "socks-proxy-agent@npm:8.0.2"
dependencies:
agent-base: ^7.0.1
agent-base: ^7.0.2
debug: ^4.3.4
socks: ^2.7.1
checksum: f6538fd16cb545094d20b9a1ae97bb2c4ddd150622ad7cc6b64c89c889d8847b7bac179757838ce5487cbac49a499537e3991c975fe13b152b76b10027470dfb
checksum: 4fb165df08f1f380881dcd887b3cdfdc1aba3797c76c1e9f51d29048be6e494c5b06d68e7aea2e23df4572428f27a3ec22b3d7c75c570c5346507433899a4b6d
languageName: node
linkType: hard

Expand Down Expand Up @@ -9295,9 +9290,9 @@ __metadata:
languageName: node
linkType: hard

"ws@npm:8.13.0":
version: 8.13.0
resolution: "ws@npm:8.13.0"
"ws@npm:8.14.1":
version: 8.14.1
resolution: "ws@npm:8.14.1"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ">=5.0.2"
Expand All @@ -9306,7 +9301,7 @@ __metadata:
optional: true
utf-8-validate:
optional: true
checksum: 53e991bbf928faf5dc6efac9b8eb9ab6497c69feeb94f963d648b7a3530a720b19ec2e0ec037344257e05a4f35bd9ad04d9de6f289615ffb133282031b18c61c
checksum: 9e310be2b0ff69e1f87d8c6d093ecd17a1ed4c37f281d17c35e8c30e2bd116401775b3d503249651374e6e0e1e9905db62fff096b694371c77561aee06bc3466
languageName: node
linkType: hard

Expand Down

0 comments on commit c87eaf7

Please sign in to comment.