testaro 77.0.0 → 77.0.2

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": "77.0.0",
3
+ "version": "77.0.2",
4
4
  "description": "Run 1300 web accessibility tests from 10 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/procs/launch.js CHANGED
@@ -18,14 +18,6 @@
18
18
 
19
19
  const {addError} = require('./error');
20
20
  const headedBrowser = process.env.HEADED_BROWSER === 'true';
21
- // Whether to launch Chromium without its sandbox. The sandbox requires
22
- // unprivileged user-namespace cloning, which the default container seccomp
23
- // policies and some hardened hosts prohibit. Setting
24
- // TESTARO_CHROMIUM_NO_SANDBOX=true permits Chromium to run in such
25
- // environments; the alternative is to run the container with a seccomp
26
- // profile that permits user-namespace cloning. Applies only to Chromium;
27
- // WebKit and Firefox have no equivalent option.
28
- const chromiumNoSandbox = process.env.TESTARO_CHROMIUM_NO_SANDBOX === 'true';
29
21
  // Two flavors of Playwright:
30
22
  // - `playwrightCore`: the upstream Playwright SDK with no plugins attached.
31
23
  // - `playwrightExtra`: the playwright-extra wrapper. `run.js` registers
@@ -66,6 +58,14 @@ const errorWords = [
66
58
  // Seconds to wait between actions.
67
59
  const waits = Number(process.env.WAITS) ?? 0;
68
60
  const abortAssertively = process.env.ABORT_ASSERTIVELY === 'true';
61
+ // Whether to launch Chromium without its sandbox. The sandbox requires
62
+ // unprivileged user-namespace cloning, which the default container seccomp
63
+ // policies and some hardened hosts prohibit. Setting
64
+ // TESTARO_CHROMIUM_NO_SANDBOX=true permits Chromium to run in such
65
+ // environments; the alternative is to run the container with a seccomp
66
+ // profile that permits user-namespace cloning. Applies only to Chromium;
67
+ // WebKit and Firefox have no equivalent option.
68
+ const chromiumNoSandbox = process.env.TESTARO_CHROMIUM_NO_SANDBOX === 'true';
69
69
 
70
70
  // FUNCTIONS
71
71
 
@@ -77,6 +77,8 @@ const wait = exports.wait = ms => {
77
77
  }, ms);
78
78
  });
79
79
  };
80
+ // Removes any trailing slashes from a URL, for redirection comparison.
81
+ const deSlash = url => (url || '').replace(/\/+$/, '');
80
82
  // Close a browser context and/or its browser, if they exist.
81
83
  const browserClose = exports.browserClose = async page => {
82
84
  if (page) {
@@ -514,11 +516,11 @@ const launchOnce = async opts => {
514
516
  }
515
517
  // Base the wait on the need of the tool and the retry history.
516
518
  let waitUntil = xPathNeed === 'none' ? 'domcontentloaded' : 'networkidle';
517
- if (relaxWait !== 'no' && waitUntil === 'networkidle') {
518
- waitUntil = 'domcontentloaded';
519
+ if (relaxWait === 'partly' && waitUntil === 'networkidle') {
520
+ waitUntil = 'load';
519
521
  }
520
522
  if (relaxWait === 'fully') {
521
- waitUntil = 'load';
523
+ waitUntil = 'domcontentloaded';
522
524
  }
523
525
  // Navigate to the specified URL and wait for the stability required by the next action.
524
526
  const navResult = await goTo(report, page, url, 10000, waitUntil);
@@ -79,12 +79,18 @@ exports.reporter = async (
79
79
  };
80
80
  const selector = 'body input[type=text], body input[type=email], body input:not([type])';
81
81
  const whats = 'Inputs are missing required autocomplete attributes';
82
- const placeHolders = Object.keys(labels).map(key => `__${key}Labels__`);
83
- const replacers = Object.values(labels).map(value => JSON.stringify(value));
82
+ // Each placeholder sits inside single quotes in getBadWhat (e.g. name: ['__nameLabels__']).
83
+ // Replace the quoted placeholder with the bracket-stripped JSON so the result is a proper
84
+ // element list (name: ["your name", ...]) rather than a one-element array holding the JSON
85
+ // text of the array (name: ['["your name", ...]']), which never matches an accessible name.
86
+ const placeHolders = Object.keys(labels).map(key => `'__${key}Labels__'`);
87
+ const replacers = Object.values(labels).map(value => JSON.stringify(value).slice(1, -1));
84
88
  // Create a stringified getBadWhat, with placeholders replaced with the specified label arrays.
85
89
  let getBadWhatString = getBadWhat.toString();
86
90
  [0, 1, 2, 3].forEach(index => {
87
91
  getBadWhatString = getBadWhatString.replace(placeHolders[index], replacers[index]);
88
92
  });
89
- return doTest(page, report.catalog, withItems, 'autocomplete', selector, whats, 2, getBadWhatString);
93
+ return doTest(
94
+ page, report.catalog, withItems, 'autocomplete', selector, whats, 2, getBadWhatString
95
+ );
90
96
  };
@@ -67,7 +67,7 @@
67
67
  [
68
68
  "standardResult.totals.2",
69
69
  "=",
70
- 4
70
+ 3
71
71
  ],
72
72
  [
73
73
  "standardResult.instances.1.what",
@@ -120,7 +120,7 @@
120
120
  [
121
121
  "standardResult.totals.2",
122
122
  "=",
123
- 4
123
+ 3
124
124
  ],
125
125
  [
126
126
  "standardResult.instances.0.what",
@@ -135,7 +135,7 @@
135
135
  [
136
136
  "standardResult.instances.0.count",
137
137
  "=",
138
- 4
138
+ 3
139
139
  ]
140
140
  ],
141
141
  "rules": [