testaro 5.1.3 → 5.2.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 +32 -11
  3. package/tests/hover.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.1.3",
3
+ "version": "5.2.0",
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',
@@ -1306,11 +1306,12 @@ const doScript = async (report) => {
1306
1306
  value: ((new Date()).toISOString().slice(0, 19))
1307
1307
  });
1308
1308
  };
1309
- // Injects url acts into a report where necessary to undo DOM changes.
1310
- const injectURLActs = acts => {
1309
+ // Injects launch and url acts into a report where necessary to undo DOM changes.
1310
+ const injectLaunches = acts => {
1311
1311
  let injectMore = true;
1312
1312
  while (injectMore) {
1313
- const injectIndex = acts.findIndex((act, index) =>
1313
+ const injectIndex = acts.findIndex(
1314
+ (act, index) =>
1314
1315
  index < acts.length - 1
1315
1316
  && act.type === 'test'
1316
1317
  && acts[index + 1].type === 'test'
@@ -1320,6 +1321,14 @@ const injectURLActs = acts => {
1320
1321
  injectMore = false;
1321
1322
  }
1322
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
+ }, '');
1323
1332
  const lastURL = acts.reduce((url, act, index) => {
1324
1333
  if (act.type === 'url' && index < injectIndex) {
1325
1334
  return act.which;
@@ -1328,11 +1337,20 @@ const injectURLActs = acts => {
1328
1337
  return url;
1329
1338
  }
1330
1339
  }, '');
1331
- acts.splice(injectIndex + 1, 0, {
1332
- type: 'url',
1333
- which: lastURL,
1334
- what: 'URL'
1335
- });
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
+ );
1336
1354
  }
1337
1355
  }
1338
1356
  };
@@ -1355,9 +1373,12 @@ exports.handleRequest = async report => {
1355
1373
  report.timeStamp = report.id.replace(/-.+/, '');
1356
1374
  // Add the script commands to the report as its initial acts.
1357
1375
  report.acts = JSON.parse(JSON.stringify(report.script.commands));
1358
- // 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
+ */
1359
1380
  if (urlInject === 'yes') {
1360
- injectURLActs(report.acts);
1381
+ injectLaunches(report.acts);
1361
1382
  }
1362
1383
  // Perform the acts, asynchronously adding to the log and report.
1363
1384
  await doScript(report);
package/tests/hover.js CHANGED
@@ -198,7 +198,7 @@ const find = async (withItems, page, region, sample, popRatio) => {
198
198
  }
199
199
  }
200
200
  catch (error) {
201
- console.log(`ERROR hovering (${error.message})`);
201
+ console.log(`ERROR hovering (${error.message.replace(/\n.+/s, '')})`);
202
202
  data.totals.unhoverables++;
203
203
  if (withItems) {
204
204
  const id = await firstTrigger.getAttribute('id');