testaro 5.5.0 → 5.5.3

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/create.js CHANGED
@@ -89,7 +89,8 @@ exports.runJob = async (scriptID, batchID) => {
89
89
  // If there is no need to keep checking:
90
90
  const reportNames = await fs.readdir(reportDir);
91
91
  const timedOut = Date.now() - startTime > 1000 * timeLimit;
92
- if (timedOut || reportNames.includes(`${id}.json`) || ! childAlive) {
92
+ const reportWritten = reportNames.includes(`${id}.json`);
93
+ if (timedOut || reportWritten || ! childAlive) {
93
94
  // Stop checking.
94
95
  clearInterval(reCheck);
95
96
  // If the cause is a timeout:
@@ -98,7 +99,7 @@ exports.runJob = async (scriptID, batchID) => {
98
99
  timeoutHosts.push(id);
99
100
  }
100
101
  // Otherwise, if the cause is a child crash:
101
- else if (! childAlive) {
102
+ else if (! (childAlive || reportWritten)) {
102
103
  // Add the host to the array of crashed hosts.
103
104
  crashHosts.push(id);
104
105
  }
@@ -121,7 +122,9 @@ exports.runJob = async (scriptID, batchID) => {
121
122
  console.log(`Reports not created:\n${JSON.stringify(timeoutHosts), null, 2}`);
122
123
  }
123
124
  if (crashHosts.length) {
124
- console.log(`Hosts crashed:\n${JSON.stringify(crashHosts), null, 2}`);
125
+ console.log(
126
+ `Hosts crashed with or without report:\n${JSON.stringify(crashHosts, null, 2)}`
127
+ );
125
128
  }
126
129
  }
127
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.5.0",
3
+ "version": "5.5.3",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -497,6 +497,9 @@ const matchElement = async (page, selector, matchText, index = 0) => {
497
497
  const deSlash = string => string.endsWith('/') ? string.slice(0, -1) : string;
498
498
  // Tries to visit a URL.
499
499
  const goto = async (page, url, timeout, waitUntil, isStrict) => {
500
+ if (url.startsWith('file://.')) {
501
+ url = url.replace('file://', `file://${__dirname}/`);
502
+ }
500
503
  const response = await page.goto(url, {
501
504
  timeout,
502
505
  waitUntil
package/tests/focInd.js CHANGED
@@ -83,8 +83,21 @@ exports.reporter = async (page, revealAll, allowedDelay, withItems) => {
83
83
  data.totals.total++;
84
84
  // Get a live style declaration of its properties.
85
85
  const styleDec = window.getComputedStyle(element);
86
- // Freeze a copy to preserve the style properties when not focused.
87
- const styleBlurred = Object.assign({}, styleDec);
86
+ // Get the relevant style properties.
87
+ const styleBlurred = {};
88
+ [
89
+ 'outlineWidth',
90
+ 'outlineColor',
91
+ 'borderWidth',
92
+ 'boxShadow',
93
+ 'fontSize',
94
+ 'fontStyle',
95
+ 'textDecorationLine',
96
+ 'textDecorationStyle',
97
+ 'textDecorationThickness'
98
+ ].forEach(styleName => {
99
+ styleBlurred[styleName] = styleDec[styleName];
100
+ });
88
101
  // Focus it, potentially changing the properties in its style declaration.
89
102
  element.focus({preventScroll: true});
90
103
  let hasOutline = false;
package/tests/hover.js CHANGED
@@ -190,12 +190,17 @@ const find = async (data, withItems, page, region, sample, popRatio) => {
190
190
  console.log(`ERROR hovering (${error.message.replace(/\n.+/s, '')})`);
191
191
  data.totals.unhoverables++;
192
192
  if (withItems) {
193
- const id = await firstTrigger.getAttribute('id');
194
- data.items[region].unhoverables.push({
195
- tagName,
196
- id: id || '',
197
- text: await textOf(firstTrigger, 50)
198
- });
193
+ try {
194
+ const id = await firstTrigger.getAttribute('id');
195
+ data.items[region].unhoverables.push({
196
+ tagName,
197
+ id: id || '',
198
+ text: await textOf(firstTrigger, 50)
199
+ });
200
+ }
201
+ catch(error) {
202
+ console.log('ERROR itemizing unhoverable element');
203
+ }
199
204
  }
200
205
  }
201
206
  }