@axe-core/playwright 4.9.1-f38a6c8.0 → 4.9.2-a2f07c5.0

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 CHANGED
@@ -261,10 +261,22 @@ var AxeBuilder = class {
261
261
  * @param Page - playwright page object
262
262
  * @returns Promise<void>
263
263
  */
264
- async inject(frames) {
264
+ async inject(frames, shouldThrow) {
265
265
  for (const iframe of frames) {
266
- await iframe.evaluate(await this.script());
267
- await iframe.evaluate(await this.axeConfigure());
266
+ const race = new Promise((_, reject) => {
267
+ setTimeout(() => {
268
+ reject(new Error("Script Timeout"));
269
+ }, 1e3);
270
+ });
271
+ const evaluate = iframe.evaluate(this.script());
272
+ try {
273
+ await Promise.race([evaluate, race]);
274
+ await iframe.evaluate(await this.axeConfigure());
275
+ } catch (err) {
276
+ if (shouldThrow) {
277
+ throw err;
278
+ }
279
+ }
268
280
  }
269
281
  }
270
282
  /**
@@ -318,7 +330,7 @@ var AxeBuilder = class {
318
330
  const iframeElement = iframeHandle.asElement();
319
331
  const childFrame = await iframeElement.contentFrame();
320
332
  if (childFrame) {
321
- await this.inject([childFrame]);
333
+ await this.inject([childFrame], true);
322
334
  childResults = await this.runPartialRecursive(
323
335
  childFrame,
324
336
  frameContext
package/dist/index.mjs CHANGED
@@ -226,10 +226,22 @@ var AxeBuilder = class {
226
226
  * @param Page - playwright page object
227
227
  * @returns Promise<void>
228
228
  */
229
- async inject(frames) {
229
+ async inject(frames, shouldThrow) {
230
230
  for (const iframe of frames) {
231
- await iframe.evaluate(await this.script());
232
- await iframe.evaluate(await this.axeConfigure());
231
+ const race = new Promise((_, reject) => {
232
+ setTimeout(() => {
233
+ reject(new Error("Script Timeout"));
234
+ }, 1e3);
235
+ });
236
+ const evaluate = iframe.evaluate(this.script());
237
+ try {
238
+ await Promise.race([evaluate, race]);
239
+ await iframe.evaluate(await this.axeConfigure());
240
+ } catch (err) {
241
+ if (shouldThrow) {
242
+ throw err;
243
+ }
244
+ }
233
245
  }
234
246
  }
235
247
  /**
@@ -283,7 +295,7 @@ var AxeBuilder = class {
283
295
  const iframeElement = iframeHandle.asElement();
284
296
  const childFrame = await iframeElement.contentFrame();
285
297
  if (childFrame) {
286
- await this.inject([childFrame]);
298
+ await this.inject([childFrame], true);
287
299
  childResults = await this.runPartialRecursive(
288
300
  childFrame,
289
301
  frameContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axe-core/playwright",
3
- "version": "4.9.1-f38a6c8.0+f38a6c8",
3
+ "version": "4.9.2-a2f07c5.0+a2f07c5",
4
4
  "description": "Provides a method to inject and analyze web pages using axe",
5
5
  "contributors": [
6
6
  {
@@ -51,10 +51,10 @@
51
51
  "prepare": "npx playwright install && npm run build"
52
52
  },
53
53
  "dependencies": {
54
- "axe-core": "~4.9.0"
54
+ "axe-core": "~4.9.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@playwright/test": "^1.34.3",
57
+ "@playwright/test": "^1.44.0",
58
58
  "@types/chai": "^4.3.3",
59
59
  "@types/express": "^4.17.14",
60
60
  "@types/mocha": "^10.0.0",
@@ -92,5 +92,5 @@
92
92
  "functions": 100,
93
93
  "lines": 95
94
94
  },
95
- "gitHead": "f38a6c82e98db673ed672d0f2e1a41810fd488c8"
95
+ "gitHead": "a2f07c5fec450efc542237f2b9c296bfc0f2bd59"
96
96
  }