testaro 57.1.0 → 57.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.
- package/actSpecs.js +1 -1
- package/package.json +1 -1
- package/procs/target.js +23 -16
- package/run.js +4 -1
- package/tests/wax.js +37 -11
package/actSpecs.js
CHANGED
|
@@ -147,7 +147,7 @@ exports.actSpecs = {
|
|
|
147
147
|
{
|
|
148
148
|
which: [true, 'string', 'isTest', 'tool name'],
|
|
149
149
|
launch: [false, 'object', '', 'new target, browserID, and/or what, if any'],
|
|
150
|
-
rules: [false, 'array', 'areStrings', 'rule IDs or (for nuVal) specifications, if not all']
|
|
150
|
+
rules: [false, 'array', 'areStrings', 'rule IDs or (for testaro or nuVal) specifications, if not all']
|
|
151
151
|
}
|
|
152
152
|
],
|
|
153
153
|
text: [
|
package/package.json
CHANGED
package/procs/target.js
CHANGED
|
@@ -44,7 +44,7 @@ exports.isTooSmall = async (loc, min) => {
|
|
|
44
44
|
// Get its styles.
|
|
45
45
|
const styleDec = window.getComputedStyle(el);
|
|
46
46
|
const displayStyle = styleDec.display;
|
|
47
|
-
// If it is hidden:
|
|
47
|
+
// If it is hidden (which should be impossible because of the selector):
|
|
48
48
|
if (displayStyle === 'none') {
|
|
49
49
|
// Exempt it.
|
|
50
50
|
return null;
|
|
@@ -67,22 +67,29 @@ exports.isTooSmall = async (loc, min) => {
|
|
|
67
67
|
const elDims = getDims(el);
|
|
68
68
|
// If either dimension is too small:
|
|
69
69
|
if (elDims.some(dim => dim < min)) {
|
|
70
|
-
// Get the parent of the target.
|
|
70
|
+
// Get the parent element of the target.
|
|
71
71
|
const elParent = el.parentElement;
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
// If the parent element exists:
|
|
73
|
+
if (elParent) {
|
|
74
|
+
// Get the child elements of the parent, including the target.
|
|
75
|
+
const elGeneration = Array.from(elParent.children);
|
|
76
|
+
// If the target has no siblings of its type:
|
|
77
|
+
if (elGeneration.filter(peer => peer.tagName === tagName).length === 1) {
|
|
78
|
+
// Get the width and height of the parent.
|
|
79
|
+
const parentDims = getDims(elParent);
|
|
80
|
+
// For each dimension of the target:
|
|
81
|
+
elDims.forEach((elDim, index) => {
|
|
82
|
+
// If it is too small and smaller than that of the parent:
|
|
83
|
+
if (elDim < min && parentDims[index] > elDim) {
|
|
84
|
+
// Replace it with the dimension of the parent (a substitute for distance).
|
|
85
|
+
elDims[index] = parentDims[index];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Otherwise, i.e. if it does not exist:
|
|
91
|
+
else {
|
|
92
|
+
console.log(`WARNING: Target ${tagName} (${el.innerHTML}) has no parent element`);
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
// Get whether it is too small.
|
package/run.js
CHANGED
|
@@ -1414,11 +1414,14 @@ exports.doJob = async job => {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
});
|
|
1416
1416
|
// Perform the acts and get a report.
|
|
1417
|
+
console.log('Performing the job acts');
|
|
1417
1418
|
report = await doActs(report, 0, null);
|
|
1418
1419
|
// Add the end time and duration to the report.
|
|
1419
1420
|
const endTime = new Date();
|
|
1420
1421
|
report.jobData.endTime = nowString();
|
|
1421
|
-
|
|
1422
|
+
const elapsedSeconds = Math.floor((endTime - startTime) / 1000);
|
|
1423
|
+
report.jobData.elapsedSeconds = elapsedSeconds;
|
|
1424
|
+
console.log(`Elapsed seconds: ${elapsedSeconds}`);
|
|
1422
1425
|
// Consolidate and sort the tool times.
|
|
1423
1426
|
const {toolTimes} = report.jobData;
|
|
1424
1427
|
const toolTimeData = Object
|
package/tests/wax.js
CHANGED
|
@@ -36,7 +36,7 @@ const waxDev = {runWax};
|
|
|
36
36
|
// FUNCTIONS
|
|
37
37
|
|
|
38
38
|
// Conducts and reports the WAX tests.
|
|
39
|
-
exports.reporter = async (page, report, actIndex
|
|
39
|
+
exports.reporter = async (page, report, actIndex) => {
|
|
40
40
|
// Initialize the act report.
|
|
41
41
|
let data = {};
|
|
42
42
|
let result = {};
|
|
@@ -56,17 +56,43 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
56
56
|
data.prevented = true;
|
|
57
57
|
data.error = actReport;
|
|
58
58
|
}
|
|
59
|
-
// Otherwise, if
|
|
60
|
-
else if (
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
// Otherwise, if the report is an array:
|
|
60
|
+
else if (Array.isArray(actReport)) {
|
|
61
|
+
// If it is an error report:
|
|
62
|
+
if (actReport.length === 1 && typeof actReport[0] === 'object' && actReport[0].error) {
|
|
63
|
+
// Report this.
|
|
64
|
+
data.prevented = true;
|
|
65
|
+
const {error} = actReport[0];
|
|
66
|
+
data.error = error;
|
|
67
|
+
console.log(`ERROR running wax: ${error}`);
|
|
68
|
+
}
|
|
69
|
+
// Otherwise, i.e. if it is a successful report:
|
|
70
|
+
else {
|
|
71
|
+
// Populate the act report.
|
|
72
|
+
result = {
|
|
73
|
+
violations: actReport
|
|
74
|
+
}
|
|
75
|
+
}
|
|
64
76
|
}
|
|
65
|
-
// Otherwise,
|
|
66
|
-
else {
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
// Otherwise, if the report is a non-array object:
|
|
78
|
+
else if (typeof actReport === 'object') {
|
|
79
|
+
// If the response status was a system error:
|
|
80
|
+
if(actReport.responseCode === 500) {
|
|
81
|
+
// Report this.
|
|
82
|
+
data.prevented = true;
|
|
83
|
+
data.error = actReport.message || 'response status code 500';
|
|
84
|
+
}
|
|
85
|
+
// Otherwise, if there was an error:
|
|
86
|
+
else if (actReport.error) {
|
|
87
|
+
// Report this.
|
|
88
|
+
data.prevented = true;
|
|
89
|
+
data.error = actReport.error;
|
|
90
|
+
}
|
|
91
|
+
// In any other case:
|
|
92
|
+
else {
|
|
93
|
+
// Report a prevention.
|
|
94
|
+
data.prevented = true;
|
|
95
|
+
data.error = 'wax failure';
|
|
70
96
|
}
|
|
71
97
|
}
|
|
72
98
|
// Return the results.
|