@axe-core/puppeteer 4.7.4-alpha.401 → 4.7.4-alpha.403
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -8
- package/dist/index.mjs +13 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
module.exports = __toCommonJS(src_exports);
|
|
38
38
|
|
|
39
39
|
// src/axePuppeteer.ts
|
|
40
|
-
var
|
|
40
|
+
var import_assert2 = __toESM(require("assert"));
|
|
41
41
|
|
|
42
42
|
// src/browser.ts
|
|
43
43
|
function pageIsLoaded() {
|
|
@@ -205,6 +205,7 @@ var caught = ((f) => {
|
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
// src/utils.ts
|
|
208
|
+
var import_assert = __toESM(require("assert"));
|
|
208
209
|
var fs2 = __toESM(require("fs"));
|
|
209
210
|
var import_url2 = require("url");
|
|
210
211
|
async function frameSourceInject(frame, source, config) {
|
|
@@ -251,12 +252,16 @@ async function getChildFrame(frame, childSelector) {
|
|
|
251
252
|
return await frameElm.asElement()?.contentFrame() || null;
|
|
252
253
|
}
|
|
253
254
|
async function assertFrameReady(frame) {
|
|
254
|
-
let pageReady = false;
|
|
255
255
|
try {
|
|
256
|
-
|
|
256
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
reject();
|
|
259
|
+
}, 1e3);
|
|
260
|
+
});
|
|
261
|
+
const evaluatePromise = frame.evaluate(pageIsLoaded);
|
|
262
|
+
const readyState = await Promise.race([timeoutPromise, evaluatePromise]);
|
|
263
|
+
(0, import_assert.default)(readyState);
|
|
257
264
|
} catch {
|
|
258
|
-
}
|
|
259
|
-
if (!pageReady) {
|
|
260
265
|
throw new Error("Page/Frame is not ready");
|
|
261
266
|
}
|
|
262
267
|
}
|
|
@@ -369,7 +374,7 @@ var AxePuppeteer = class {
|
|
|
369
374
|
* This value is passed directly to `axe.configure()`
|
|
370
375
|
*/
|
|
371
376
|
configure(config) {
|
|
372
|
-
(0,
|
|
377
|
+
(0, import_assert2.default)(
|
|
373
378
|
typeof config === "object",
|
|
374
379
|
"AxePuppeteer needs an object to configure. See axe-core configure API."
|
|
375
380
|
);
|
|
@@ -458,10 +463,10 @@ var AxePuppeteer = class {
|
|
|
458
463
|
}
|
|
459
464
|
async finishRun(partialResults) {
|
|
460
465
|
const { axeOptions, axeSource, config, page } = this;
|
|
461
|
-
(0,
|
|
466
|
+
(0, import_assert2.default)(page, "Running AxePuppeteer with a frame object is deprecated");
|
|
462
467
|
const browser = page.browser();
|
|
463
468
|
const blankPage = await browser.newPage();
|
|
464
|
-
(0,
|
|
469
|
+
(0, import_assert2.default)(
|
|
465
470
|
blankPage,
|
|
466
471
|
"Please make sure that you have popup blockers disabled."
|
|
467
472
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// src/axePuppeteer.ts
|
|
10
|
-
import
|
|
10
|
+
import assert2 from "assert";
|
|
11
11
|
|
|
12
12
|
// src/browser.ts
|
|
13
13
|
function pageIsLoaded() {
|
|
@@ -175,6 +175,7 @@ var caught = ((f) => {
|
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
// src/utils.ts
|
|
178
|
+
import assert from "assert";
|
|
178
179
|
import * as fs2 from "fs";
|
|
179
180
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
180
181
|
async function frameSourceInject(frame, source, config) {
|
|
@@ -221,12 +222,16 @@ async function getChildFrame(frame, childSelector) {
|
|
|
221
222
|
return await frameElm.asElement()?.contentFrame() || null;
|
|
222
223
|
}
|
|
223
224
|
async function assertFrameReady(frame) {
|
|
224
|
-
let pageReady = false;
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
227
|
+
setTimeout(() => {
|
|
228
|
+
reject();
|
|
229
|
+
}, 1e3);
|
|
230
|
+
});
|
|
231
|
+
const evaluatePromise = frame.evaluate(pageIsLoaded);
|
|
232
|
+
const readyState = await Promise.race([timeoutPromise, evaluatePromise]);
|
|
233
|
+
assert(readyState);
|
|
227
234
|
} catch {
|
|
228
|
-
}
|
|
229
|
-
if (!pageReady) {
|
|
230
235
|
throw new Error("Page/Frame is not ready");
|
|
231
236
|
}
|
|
232
237
|
}
|
|
@@ -339,7 +344,7 @@ var AxePuppeteer = class {
|
|
|
339
344
|
* This value is passed directly to `axe.configure()`
|
|
340
345
|
*/
|
|
341
346
|
configure(config) {
|
|
342
|
-
|
|
347
|
+
assert2(
|
|
343
348
|
typeof config === "object",
|
|
344
349
|
"AxePuppeteer needs an object to configure. See axe-core configure API."
|
|
345
350
|
);
|
|
@@ -428,10 +433,10 @@ var AxePuppeteer = class {
|
|
|
428
433
|
}
|
|
429
434
|
async finishRun(partialResults) {
|
|
430
435
|
const { axeOptions, axeSource, config, page } = this;
|
|
431
|
-
|
|
436
|
+
assert2(page, "Running AxePuppeteer with a frame object is deprecated");
|
|
432
437
|
const browser = page.browser();
|
|
433
438
|
const blankPage = await browser.newPage();
|
|
434
|
-
|
|
439
|
+
assert2(
|
|
435
440
|
blankPage,
|
|
436
441
|
"Please make sure that you have popup blockers disabled."
|
|
437
442
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axe-core/puppeteer",
|
|
3
|
-
"version": "4.7.4-alpha.
|
|
3
|
+
"version": "4.7.4-alpha.403+5bd31fa",
|
|
4
4
|
"description": "Provides a chainable axe API for Puppeteer and automatically injects into all frames",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"functions": 85,
|
|
89
89
|
"lines": 85
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "5bd31fafa93d02f5cdaf3bc312f5c31b2484397b"
|
|
92
92
|
}
|