testaro 69.4.1 → 69.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "69.4.1",
3
+ "version": "69.5.0",
4
4
  "description": "Run 1000 web accessibility tests from 11 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,27 @@
1
+ /*
2
+ © 2025 Jonathan Robert Pool.
3
+
4
+ Licensed under the MIT License. See LICENSE file at the project root or
5
+ https://opensource.org/license/mit/ for details.
6
+
7
+ SPDX-License-Identifier: MIT
8
+ */
9
+
10
+ /*
11
+ config
12
+ Shared configuration values for Testaro.
13
+ */
14
+
15
+ // Timeout multiplier from environment variable.
16
+ // Set TIMEOUT_MULTIPLIER > 1 for slow networks/sites, < 1 for fast environments.
17
+ const timeoutMultiplier = Number.parseFloat(process.env.TIMEOUT_MULTIPLIER) || 1;
18
+
19
+ // Helper to apply multiplier to a timeout value.
20
+ // Use for navigation, interaction, and long-running operation timeouts.
21
+ // Do NOT use for very short "fail-fast" timeouts (< 100ms).
22
+ const applyMultiplier = (baseTimeout) => Math.round(baseTimeout * timeoutMultiplier);
23
+
24
+ module.exports = {
25
+ timeoutMultiplier,
26
+ applyMultiplier
27
+ };
package/procs/shoot.js CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  // IMPORTS
12
12
 
13
+ // Shared configuration for timeout multiplier.
14
+ const {applyMultiplier} = require('./config');
13
15
  const fs = require('fs/promises');
14
16
  const os = require('os');
15
17
  const path = require('path');
@@ -26,7 +28,7 @@ const screenShot = async (page, exclusion = null) => {
26
28
  const options = {
27
29
  fullPage: true,
28
30
  omitBackground: true,
29
- timeout: 4000
31
+ timeout: applyMultiplier(4000)
30
32
  };
31
33
  if (exclusion) {
32
34
  options.mask = [exclusion];
package/testaro/hover.js CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  const {getBasicResult} = require('../procs/testaro');
18
18
  const playwright = require('playwright');
19
+ // Shared configuration for timeout multiplier.
20
+ const {applyMultiplier} = require('../procs/config');
19
21
 
20
22
  // FUNCTIONS
21
23
 
@@ -107,7 +109,7 @@ exports.reporter = async (page, catalog, withItems) => {
107
109
  const elementCount0 = await loc0.count();
108
110
  try {
109
111
  // Hover over the element.
110
- await loc.hover({timeout: 400});
112
+ await loc.hover({timeout: applyMultiplier(400)});
111
113
  // Get the change in the count of the visible elements in the observation tree.
112
114
  const changeData = await getVisibleCountChange(rootLoc, elementCount0, 400, 75);
113
115
  const {change, elapsedTime} = changeData;
package/testaro/tabNav.js CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  // IMPORTS
17
17
 
18
+ // Shared configuration for timeout multiplier.
19
+ const {applyMultiplier} = require('../procs/config');
18
20
  const {getXPathCatalogIndex} = require('../procs/xPath');
19
21
 
20
22
  // CONSTANTS
@@ -39,7 +41,7 @@ const testKey = async (
39
41
  let pressed = true;
40
42
  // Click the tab element, to make the focus on it effective.
41
43
  await tabElement.click({
42
- timeout: 500
44
+ timeout: applyMultiplier(500)
43
45
  })
44
46
  .catch(async error => {
45
47
  console.log(
@@ -63,7 +65,7 @@ const testKey = async (
63
65
  if (pressed) {
64
66
  // Refocus the tab element and press the specified key (page.keyboard.press may fail).
65
67
  await tabElement.press(keyName, {
66
- timeout: 1000
68
+ timeout: applyMultiplier(1000)
67
69
  })
68
70
  .catch(error => {
69
71
  console.log(`ERROR: could not press ${keyName} (${error.message})`);
package/tests/alfa.js CHANGED
@@ -19,6 +19,7 @@ let alfaRules = require('@siteimprove/alfa-rules').default;
19
19
  const {Audit} = require('@siteimprove/alfa-act');
20
20
  const {getNormalizedXPath, getXPathCatalogIndex} = require('../procs/xPath');
21
21
  const {Playwright} = require('@siteimprove/alfa-playwright');
22
+ const {applyMultiplier} = require('../procs/config');
22
23
 
23
24
  // FUNCTIONS
24
25
 
@@ -54,6 +55,8 @@ exports.reporter = async (page, report, actIndex) => {
54
55
  };
55
56
  }
56
57
  try {
58
+ // Wait for a stable page to make the page and its alfa version consistent.
59
+ await page.waitForLoadState('networkidle', {timeout: applyMultiplier(6000)});
57
60
  const doc = await page.evaluateHandle('document');
58
61
  const alfaPage = await Playwright.toPage(doc);
59
62
  // Test the page content with the specified rules.
package/tests/aslint.js CHANGED
@@ -16,6 +16,8 @@
16
16
  // IMPORTS
17
17
 
18
18
  const fs = require('fs/promises');
19
+ // Shared configuration for timeout multiplier.
20
+ const {applyMultiplier} = require('../procs/config');
19
21
  const {getNormalizedXPath, getXPathCatalogIndex} = require('../procs/xPath');
20
22
 
21
23
  // CONSTANTS
@@ -184,7 +186,7 @@ exports.reporter = async (page, report, actIndex) => {
184
186
  // Wait for the test results to be attached to the page.
185
187
  const waitOptions = {
186
188
  state: 'attached',
187
- timeout: 20000
189
+ timeout: applyMultiplier(20000)
188
190
  };
189
191
  await reportLoc.waitFor(waitOptions);
190
192
  }
package/tests/testaro.js CHANGED
@@ -15,7 +15,8 @@
15
15
 
16
16
  // IMPORTS
17
17
 
18
- // Function to launch a browser.
18
+ // Shared configuration for timeout multiplier.
19
+ const {timeoutMultiplier} = require('../procs/config');
19
20
  const {launch} = require('../procs/launch');
20
21
 
21
22
  // CONSTANTS
@@ -447,7 +448,6 @@ const allRules = [
447
448
  defaultOn: false
448
449
  }
449
450
  ];
450
- const timeoutMultiplier = Number.parseFloat(process.env.TIMEOUT_MULTIPLIER) || 1;
451
451
 
452
452
  // ERROR HANDLER
453
453
  process.on('unhandledRejection', reason => {