testaro 14.2.3 → 14.2.5
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/dirWatch.js +1 -1
- package/package.json +1 -1
- package/standardize.js +10 -3
- package/testaro/filter.js +6 -2
- package/testaro/labClash.js +2 -1
- package/testaro/motion.js +2 -2
package/dirWatch.js
CHANGED
package/package.json
CHANGED
package/standardize.js
CHANGED
|
@@ -312,12 +312,14 @@ const convert = (testName, result, standardResult) => {
|
|
|
312
312
|
}
|
|
313
313
|
// testaro
|
|
314
314
|
else if (testName === 'testaro') {
|
|
315
|
-
const rules = Object.keys(result.rules);
|
|
315
|
+
const rules = result.rules ? Object.keys(result.rules) : [];
|
|
316
316
|
standardResult.totals = [0, 0, 0, 0];
|
|
317
317
|
rules.forEach(rule => {
|
|
318
318
|
const ruleResult = result.rules[rule];
|
|
319
319
|
standardResult.totals.forEach((total, index) => {
|
|
320
|
-
standardResult.totals[index] += ruleResult.totals
|
|
320
|
+
standardResult.totals[index] += ruleResult && ruleResult.totals
|
|
321
|
+
? ruleResult.totals[index] || 0
|
|
322
|
+
: 0;
|
|
321
323
|
});
|
|
322
324
|
standardResult.instances.push(... ruleResult.standardInstances);
|
|
323
325
|
});
|
|
@@ -349,5 +351,10 @@ const convert = (testName, result, standardResult) => {
|
|
|
349
351
|
exports.standardize = act => {
|
|
350
352
|
const {which} = act;
|
|
351
353
|
const {result, standardResult} = act;
|
|
352
|
-
|
|
354
|
+
if (which && result && standardResult) {
|
|
355
|
+
convert(which, result, standardResult);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
console.log('ERROR: Result of incomplete act cannot be standardized');
|
|
359
|
+
}
|
|
353
360
|
};
|
package/testaro/filter.js
CHANGED
|
@@ -10,7 +10,11 @@ exports.reporter = async (page, withItems) => {
|
|
|
10
10
|
// Identify the elements with filter style properties.
|
|
11
11
|
const data = await page.evaluate(withItems => {
|
|
12
12
|
// Returns a space-minimized copy of a string.
|
|
13
|
-
const compact = string => string
|
|
13
|
+
const compact = string => string
|
|
14
|
+
.replace(/[\t\n]/g, '')
|
|
15
|
+
.replace(/\s{2,}/g, ' ')
|
|
16
|
+
.trim()
|
|
17
|
+
.slice(0, 100);
|
|
14
18
|
// Get all elements in the body.
|
|
15
19
|
const elements = Array.from(document.body.querySelectorAll('*'));
|
|
16
20
|
// Get those that have filter styles.
|
|
@@ -36,7 +40,7 @@ exports.reporter = async (page, withItems) => {
|
|
|
36
40
|
filterData.forEach(filterDatum => {
|
|
37
41
|
data.items.push({
|
|
38
42
|
tagName: filterDatum.element.tagName,
|
|
39
|
-
text: compact(filterDatum.element.textContent),
|
|
43
|
+
text: compact(filterDatum.element.textContent) || compact(filterDatum.element.outerHTML),
|
|
40
44
|
impact: filterDatum.impact
|
|
41
45
|
});
|
|
42
46
|
});
|
package/testaro/labClash.js
CHANGED
package/testaro/motion.js
CHANGED
|
@@ -122,7 +122,7 @@ exports.reporter = async (page, withItems, delay = 2500, interval = 2500, count
|
|
|
122
122
|
|| 0,
|
|
123
123
|
0
|
|
124
124
|
],
|
|
125
|
-
standardInstances: [{
|
|
125
|
+
standardInstances: globalRatio > 1 ? [{
|
|
126
126
|
issueID: 'motion',
|
|
127
127
|
what: 'Content moves or changes without user request',
|
|
128
128
|
ordinalSeverity: 2,
|
|
@@ -132,7 +132,7 @@ exports.reporter = async (page, withItems, delay = 2500, interval = 2500, count
|
|
|
132
132
|
spec: ''
|
|
133
133
|
},
|
|
134
134
|
excerpt: ''
|
|
135
|
-
}]
|
|
135
|
+
}] : []
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
// Otherwise, i.e. if the shooting failed:
|