testaro 5.1.2 → 5.2.1

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/htmlcs/HTMLCS.js CHANGED
@@ -6321,10 +6321,8 @@
6321
6321
  self.output(messages[i]);
6322
6322
  msgCount[messages[i].type]++;
6323
6323
  }
6324
- console.log("done");
6325
6324
  }, function () {
6326
6325
  console.log("Something in HTML_CodeSniffer failed to parse. Cannot run.");
6327
- console.log("done");
6328
6326
  }, "en");
6329
6327
  return Array.from(messageStrings);
6330
6328
  };
@@ -7968,4 +7966,4 @@
7968
7966
  };
7969
7967
  }(); // Expose globals.
7970
7968
  return _global;
7971
- }));
7969
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.1.2",
3
+ "version": "5.2.1",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -36,7 +36,7 @@ const tests = {
36
36
  focAll: 'focusable and Tab-focused elements',
37
37
  focInd: 'focus indicators',
38
38
  focOp: 'focusability and operability',
39
- hover: 'hover-caused content additions',
39
+ hover: 'hover-caused content changes',
40
40
  htmlcs: 'HTML CodeSniffer WCAG 2.1 AA ruleset',
41
41
  ibm: 'IBM Accessibility Checker',
42
42
  labClash: 'labeling inconsistencies',
@@ -257,6 +257,7 @@ const closeBrowsers = async () => {
257
257
  await browser.close();
258
258
  }
259
259
  }
260
+ browsers = [];
260
261
  };
261
262
  // Launches a browser.
262
263
  const launch = async typeName => {
@@ -1305,11 +1306,12 @@ const doScript = async (report) => {
1305
1306
  value: ((new Date()).toISOString().slice(0, 19))
1306
1307
  });
1307
1308
  };
1308
- // Injects url acts into a report where necessary to undo DOM changes.
1309
- const injectURLActs = acts => {
1309
+ // Injects launch and url acts into a report where necessary to undo DOM changes.
1310
+ const injectLaunches = acts => {
1310
1311
  let injectMore = true;
1311
1312
  while (injectMore) {
1312
- const injectIndex = acts.findIndex((act, index) =>
1313
+ const injectIndex = acts.findIndex(
1314
+ (act, index) =>
1313
1315
  index < acts.length - 1
1314
1316
  && act.type === 'test'
1315
1317
  && acts[index + 1].type === 'test'
@@ -1319,6 +1321,14 @@ const injectURLActs = acts => {
1319
1321
  injectMore = false;
1320
1322
  }
1321
1323
  else {
1324
+ const lastBrowserType = acts.reduce((browserType, act, index) => {
1325
+ if (act.type === 'launch' && index < injectIndex) {
1326
+ return act.which;
1327
+ }
1328
+ else {
1329
+ return browserType;
1330
+ }
1331
+ }, '');
1322
1332
  const lastURL = acts.reduce((url, act, index) => {
1323
1333
  if (act.type === 'url' && index < injectIndex) {
1324
1334
  return act.which;
@@ -1327,11 +1337,20 @@ const injectURLActs = acts => {
1327
1337
  return url;
1328
1338
  }
1329
1339
  }, '');
1330
- acts.splice(injectIndex + 1, 0, {
1331
- type: 'url',
1332
- which: lastURL,
1333
- what: 'URL'
1334
- });
1340
+ acts.splice(
1341
+ injectIndex + 1,
1342
+ 0,
1343
+ {
1344
+ type: 'launch',
1345
+ which: lastBrowserType,
1346
+ what: `${lastBrowserType} browser`
1347
+ },
1348
+ {
1349
+ type: 'url',
1350
+ which: lastURL,
1351
+ what: 'URL'
1352
+ }
1353
+ );
1335
1354
  }
1336
1355
  }
1337
1356
  };
@@ -1354,9 +1373,12 @@ exports.handleRequest = async report => {
1354
1373
  report.timeStamp = report.id.replace(/-.+/, '');
1355
1374
  // Add the script commands to the report as its initial acts.
1356
1375
  report.acts = JSON.parse(JSON.stringify(report.script.commands));
1357
- // Inject url acts where necessary to undo DOM changes, if specified.
1376
+ /*
1377
+ Inject launch and url acts where necessary to undo DOM changes, if specified.
1378
+ Injection of url acts alone does not guarantee test independence.
1379
+ */
1358
1380
  if (urlInject === 'yes') {
1359
- injectURLActs(report.acts);
1381
+ injectLaunches(report.acts);
1360
1382
  }
1361
1383
  // Perform the acts, asynchronously adding to the log and report.
1362
1384
  await doScript(report);
package/tests/hover.js CHANGED
@@ -30,20 +30,7 @@
30
30
 
31
31
  // CONSTANTS
32
32
 
33
- // Initialize the result.
34
- const data = {
35
- totals: {
36
- triggers: 0,
37
- headTriggers: 0,
38
- tailTriggers: 0,
39
- impactTriggers: 0,
40
- additions: 0,
41
- removals: 0,
42
- opacityChanges: 0,
43
- opacityImpact: 0,
44
- unhoverables: 0
45
- }
46
- };
33
+ const data = {};
47
34
 
48
35
  // FUNCTIONS
49
36
 
@@ -198,7 +185,7 @@ const find = async (withItems, page, region, sample, popRatio) => {
198
185
  }
199
186
  }
200
187
  catch (error) {
201
- console.log(`ERROR hovering (${error.message})`);
188
+ console.log(`ERROR hovering (${error.message.replace(/\n.+/s, '')})`);
202
189
  data.totals.unhoverables++;
203
190
  if (withItems) {
204
191
  const id = await firstTrigger.getAttribute('id');
@@ -218,6 +205,18 @@ const find = async (withItems, page, region, sample, popRatio) => {
218
205
  exports.reporter = async (
219
206
  page, headSize = 0, headSampleSize = -1, tailSampleSize = -1, withItems
220
207
  ) => {
208
+ // Initialize the result.
209
+ data.totals = {
210
+ triggers: 0,
211
+ headTriggers: 0,
212
+ tailTriggers: 0,
213
+ impactTriggers: 0,
214
+ additions: 0,
215
+ removals: 0,
216
+ opacityChanges: 0,
217
+ opacityImpact: 0,
218
+ unhoverables: 0
219
+ };
221
220
  // If details are to be reported:
222
221
  if (withItems) {
223
222
  // Add properties for details to the initialized result.