testaro 62.0.4 → 62.1.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/aceconfig.js CHANGED
@@ -22,5 +22,6 @@ module.exports = {
22
22
  'recommendation'
23
23
  ],
24
24
  cacheFolder: tmpDir,
25
- outputFolder: tmpDir
25
+ outputFolder: tmpDir,
26
+ puppeteerArgs: ['--no-sandbox', '--disable-setuid-sandbox']
26
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "62.0.4",
3
+ "version": "62.1.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/testaro/hovInd.js CHANGED
@@ -123,7 +123,7 @@ exports.reporter = async (page, withItems, sampleSize = 20) => {
123
123
  // Get a sample of the triggers.
124
124
  const sampleIndexes = getSample(locsAll, sampleSize);
125
125
  const sample = locsAll.filter((loc, index) => sampleIndexes.includes(index));
126
- // For each trigger in the sample:
126
+ // For each trigger:
127
127
  for (const loc of sample) {
128
128
  try {
129
129
  // Get its style properties.
@@ -135,7 +135,7 @@ exports.reporter = async (page, withItems, sampleSize = 20) => {
135
135
  // Blur it.
136
136
  await loc.blur({timeout: 500});
137
137
  // If blurring succeeds, try to hover over it.
138
- await loc.hover({timeout: 500});
138
+ await loc.hover({timeout: 600});
139
139
  // If hovering succeeds, get its style properties.
140
140
  const hovStyles = await getHoverStyles(loc);
141
141
  // If all 3 style declarations belong to the same element:
package/testaro/hover.js CHANGED
@@ -17,6 +17,8 @@
17
17
 
18
18
  // Module to perform common operations.
19
19
  const {getBasicResult, getVisibleCountChange} = require('../procs/testaro');
20
+ // Module to perform Playwright operations.
21
+ const playwright = require('playwright');
20
22
 
21
23
  // FUNCTIONS
22
24
 
@@ -47,7 +49,9 @@ exports.reporter = async (page, withItems) => {
47
49
  ].join(', '));
48
50
  const allLocs = await candidateLocs.all();
49
51
  const violations = [];
50
- const data = {};
52
+ const data = {
53
+ hoverableCount: allLocs.length
54
+ };
51
55
  // For each locator:
52
56
  for (const loc of allLocs) {
53
57
  // Get the XPath of the element referenced by the locator.
@@ -63,7 +67,7 @@ exports.reporter = async (page, withItems) => {
63
67
  // Get a locator for the observation root.
64
68
  const rootLoc = page.locator(`xpath=${xPath}`);
65
69
  const loc0 = await rootLoc.locator('*:visible');
66
- // Get a count of the visible elements in the observation tree.
70
+ // Get a pre-hover count of the visible elements in the observation tree.
67
71
  const elementCount0 = await loc0.count();
68
72
  try {
69
73
  // Hover over the element.
@@ -86,9 +90,14 @@ exports.reporter = async (page, withItems) => {
86
90
  }
87
91
  // If hovering throws an error:
88
92
  catch(error) {
89
- // Report that the test was prevented.
93
+ // If the error is a timeout:
94
+ if (error instanceof playwright.errors.TimeoutError) {
95
+ // Skip the locator.
96
+ continue;
97
+ }
98
+ // Otherwise, i.e. if the error is not a timeout, report this and quit.
90
99
  data.prevented = true;
91
- data.error = `ERROR hovering over an element (${error.message})`;
100
+ data.error = `ERROR hovering over an element (${error.message.slice(0, 200)})`;
92
101
  break;
93
102
  }
94
103
  }
package/tests/qualWeb.js CHANGED
@@ -42,9 +42,24 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
42
42
  timeout: timeLimit * 1000,
43
43
  monitor: false
44
44
  };
45
+ try {
45
46
  // Start the QualWeb core engine.
46
- await qualWeb.start(clusterOptions, {headless: true});
47
- // Specify the invariant test options.
47
+ await qualWeb.start(clusterOptions, {
48
+ headless: true,
49
+ args: ['--no-sandbox', '--disable-setuid-sandbox']
50
+ });
51
+ }
52
+ // If the start fails:
53
+ catch(error) {
54
+ return {
55
+ data: {
56
+ prevented: true,
57
+ error: `Core engine start failed (${error.message})`
58
+ },
59
+ result
60
+ };
61
+ }
62
+ // Otherwise, i.e. if the start succeeds, specify the invariant test options.
48
63
  const qualWebOptions = {
49
64
  log: {
50
65
  console: false,
@@ -128,9 +143,22 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
128
143
  qualWebOptions.modules.push(bpModule);
129
144
  qualWebOptions.execute.bp = true;
130
145
  }
131
- // Get the report.
132
- let actReports = await qualWeb.evaluate(qualWebOptions);
133
- result = actReports[withNewContent ? qualWebOptions.url : 'customHtml'];
146
+ let qwReport;
147
+ try {
148
+ // Get the report.
149
+ qwReport = await qualWeb.evaluate(qualWebOptions);
150
+ }
151
+ catch(error) {
152
+ return {
153
+ data: {
154
+ prevented: true,
155
+ error: `qualWeb evaluation failed (${error.message})`
156
+ },
157
+ result
158
+ };
159
+ }
160
+ // Otherwise, i.e. if the evaluation succeeded, get the report.
161
+ result = qwReport[withNewContent ? qualWebOptions.url : 'customHtml'];
134
162
  // If it contains a copy of the DOM:
135
163
  if (result && result.system && result.system.page && result.system.page.dom) {
136
164
  // Delete the copy.
@@ -184,24 +212,24 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
184
212
  }
185
213
  else {
186
214
  data.prevented = true;
187
- data.error = 'ERROR: No assertions';
215
+ data.error = 'No assertions';
188
216
  }
189
217
  }
190
218
  else {
191
219
  data.prevented = true;
192
- data.error = `ERROR: No ${section} section`;
220
+ data.error = `No ${section} section`;
193
221
  }
194
222
  }
195
223
  }
196
224
  }
197
225
  else {
198
226
  data.prevented = true;
199
- data.error = 'ERROR: No modules';
227
+ data.error = 'No modules';
200
228
  }
201
229
  }
202
230
  else {
203
231
  data.prevented = true;
204
- data.error = 'ERROR: No DOM';
232
+ data.error = 'No DOM';
205
233
  }
206
234
  // Stop the QualWeb core engine.
207
235
  await qualWeb.stop();
@@ -210,20 +238,14 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
210
238
  JSON.stringify(result);
211
239
  }
212
240
  catch(error) {
213
- const message = `ERROR: qualWeb result cannot be made JSON (${error.message})`;
214
241
  data.prevented = true;
215
- data.error = message;
216
- };
242
+ data.error = `qualWeb result cannot be made JSON (${error.message})`;
243
+ }
217
244
  }
218
245
  catch(error) {
219
- const message = error.message.slice(0, 200);
220
246
  data.prevented = true;
221
- data.error = message;
222
- result = {
223
- prevented: true,
224
- error: message
225
- };
226
- };
247
+ data.error = `qualWeb evaluation failed (${error.message})`;
248
+ }
227
249
  return {
228
250
  data,
229
251
  result