testaro 59.2.10 → 59.3.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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/run.js +3 -1
  3. package/tests/testaro.js +16 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "59.2.10",
3
+ "version": "59.3.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": {
package/run.js CHANGED
@@ -92,6 +92,8 @@ const timeLimits = {
92
92
  ibm: 30,
93
93
  testaro: 150 + Math.round(6 * process.env.WAITS / 1000)
94
94
  };
95
+ // Timeout multiplier.
96
+ const timeoutMultiplier = Number.parseFloat(process.env.TIMEOUT_MULTIPLIER) || 1;
95
97
 
96
98
  // Temporary directory
97
99
  const tmpDir = os.tmpdir();
@@ -721,7 +723,7 @@ const doActs = async (report, opts = {}) => {
721
723
  const actResult = await new Promise(resolve => {
722
724
  let closed = false;
723
725
  const child = fork(
724
- `${__dirname}/procs/doTestAct`, [actIndex], {timeout: 1000 * timeLimits[act.which] || 15000}
726
+ `${__dirname}/procs/doTestAct`, [actIndex], {timeout: timeoutMultiplier * 1000 * (timeLimits[act.which] || 15)}
725
727
  );
726
728
  child.on('message', message => {
727
729
  if (! closed) {
package/tests/testaro.js CHANGED
@@ -40,25 +40,6 @@ const fs = require('fs/promises');
40
40
  // CONSTANTS
41
41
 
42
42
  // The validation job data for the tests listed below are in the pending directory.
43
- /*
44
- const futureEvalRulesTraining = {
45
- altScheme: 'img elements with alt attributes having URLs as their entire values',
46
- captionLoc: 'caption elements that are not first children of table elements',
47
- datalistRef: 'elements with ambiguous or missing referenced datalist elements',
48
- secHeading: 'headings that violate the logical level order in their sectioning containers',
49
- textSem: 'semantically vague elements i, b, and/or small'
50
- };
51
- const futureEvalRulesCleanRoom = {
52
- adbID: 'elements with ambiguous or missing referenced descriptions',
53
- imageLink: 'links with image files as their destinations',
54
- legendLoc: 'legend elements that are not first children of fieldset elements',
55
- optRoleSel: 'Non-option elements with option roles that have no aria-selected attributes',
56
- phOnly: 'input elements with placeholders but no accessible names'
57
- };
58
- */
59
- // The following were previously marked as future (clean-room) rules.
60
- // For local validation runs they are included in evalRules below. Remove from futureRules
61
- // when preparing clean-room submissions.
62
43
  const futureRules = new Set([]);
63
44
  const evalRules = {
64
45
  adbID: 'elements with ambiguous or missing referenced descriptions',
@@ -152,6 +133,7 @@ const slowTestLimits = {
152
133
  tabNav: 10,
153
134
  textSem: 10
154
135
  };
136
+ const timeoutMultiplier = Number.parseFloat(process.env.TIMEOUT_MULTIPLIER) || 1;
155
137
 
156
138
  // ERROR HANDLER
157
139
  process.on('unhandledRejection', reason => {
@@ -296,7 +278,7 @@ exports.reporter = async (page, report, actIndex) => {
296
278
  while (testRetries > 0 && ! testSuccess) {
297
279
  try {
298
280
  // Apply a time limit to the test.
299
- const timeLimit = 1000 * (slowTestLimits[rule] ?? 5);
281
+ const timeLimit = 1000 * timeoutMultiplier * (slowTestLimits[rule] ?? 5);
300
282
  // If the time limit expires during the test:
301
283
  const timer = new Promise(resolve => {
302
284
  timeout = setTimeout(() => {
@@ -304,6 +286,7 @@ exports.reporter = async (page, report, actIndex) => {
304
286
  const endTime = Date.now();
305
287
  testTimes.push([rule, Math.round((endTime - startTime) / 1000)]);
306
288
  data.rulePreventions.push(rule);
289
+ data.rulePreventionMessages[rule] = 'Timeout';
307
290
  result[rule].totals = [0, 0, 0, 0];
308
291
  result[rule].standardInstances = [];
309
292
  console.log(`ERROR: Test of testaro rule ${rule} timed out`);
@@ -333,6 +316,11 @@ exports.reporter = async (page, report, actIndex) => {
333
316
  break;
334
317
  }
335
318
  }
319
+ // Otherwise, i.e. if the test timed out:
320
+ else {
321
+ // Stop retrying the test.
322
+ break;
323
+ }
336
324
  }
337
325
  // If an error is thrown by the test:
338
326
  catch(error) {
@@ -378,16 +366,17 @@ exports.reporter = async (page, report, actIndex) => {
378
366
  }
379
367
  }
380
368
  finally {
381
- // Clear the timeout and the error listeners.
369
+ // Clear the timeout.
382
370
  clearTimeout(timeout);
383
- if (page && ! page.isClosed() && crashHandler) {
384
- page.off('crash', crashHandler);
385
- }
386
- if (browser && disconnectHandler) {
387
- browser.off('disconnected', disconnectHandler);
388
- }
389
371
  }
390
372
  }
373
+ // Clear the error listeners.
374
+ if (page && ! page.isClosed() && crashHandler) {
375
+ page.off('crash', crashHandler);
376
+ }
377
+ if (browser && disconnectHandler) {
378
+ browser.off('disconnected', disconnectHandler);
379
+ }
391
380
  }
392
381
  // Otherwise, i.e. if the rule is undefined or doubly defined:
393
382
  else {