testaro 32.2.3 → 32.3.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/README.md +3 -1
- package/actSpecs.js +1 -1
- package/package.json +2 -2
- package/run.js +10 -1
- package/tests/ibm.js +41 -34
package/README.md
CHANGED
|
@@ -565,6 +565,8 @@ These changes were proposed as pull requests 1333 and 1334 (https://github.com/I
|
|
|
565
565
|
|
|
566
566
|
The `ibm` tool is one of two tools (`testaro` is the other) with a `withItems` property. If you set `withItems` to `false`, the result includes the counts of “violations” and “recommendations”, but no information about the rules that gave rise to them.
|
|
567
567
|
|
|
568
|
+
Experimentation indicates that the `ibm` tools emits untrappable errors for some targets when the content argument given to it is the page content rather than the page URL. Therefore, it is safer to use `true` as the value of `withNewContent` for the `ibm` tool.
|
|
569
|
+
|
|
568
570
|
###### Nu Html Checker
|
|
569
571
|
|
|
570
572
|
The `nuVal` tool performs the tests of the Nu Html Checker.
|
|
@@ -876,7 +878,7 @@ The rationales motivating the Testaro-defined tests can be found in comments wit
|
|
|
876
878
|
|
|
877
879
|
### Abnormal termination
|
|
878
880
|
|
|
879
|
-
On rare occasions a test throws an error that
|
|
881
|
+
On rare occasions a test throws an error that cannot be handled with a `try`-`catch` structure. It has been observed, for example, that the `ibm` test does this when the page content, rather than the page URL, is given to `getCompliance()` and the target is `https://globalsolutions.org` or `https://monsido.com`.
|
|
880
882
|
|
|
881
883
|
### Activation
|
|
882
884
|
|
package/actSpecs.js
CHANGED
|
@@ -184,7 +184,7 @@ exports.actSpecs = {
|
|
|
184
184
|
{
|
|
185
185
|
withItems: [true, 'boolean', '', 'itemize'],
|
|
186
186
|
withNewContent: [
|
|
187
|
-
true, 'boolean', '', 'true: use a URL; false: use page content'
|
|
187
|
+
true, 'boolean', '', 'true: use a URL; false: use page content (risky)'
|
|
188
188
|
]
|
|
189
189
|
}
|
|
190
190
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testaro",
|
|
3
|
-
"version": "32.
|
|
4
|
-
"description": "Run
|
|
3
|
+
"version": "32.3.3",
|
|
4
|
+
"description": "Run 900 web accessibility tests from 9 tools and get a standardized report",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"tests": "node validation/executors/tests",
|
package/run.js
CHANGED
|
@@ -422,10 +422,19 @@ const launch = async (report, typeName, url, debug, waits, isLowMotion = false)
|
|
|
422
422
|
// Open a context (i.e. browser tab), with reduced motion if specified.
|
|
423
423
|
const options = {reduceMotion: isLowMotion ? 'reduce' : 'no-preference'};
|
|
424
424
|
const browserContext = await browser.newContext(options);
|
|
425
|
-
// Prevent default timeouts
|
|
425
|
+
// Prevent default timeouts.
|
|
426
426
|
browserContext.setDefaultTimeout(0);
|
|
427
427
|
// When a page (i.e. browser tab) is added to the browser context (i.e. browser window):
|
|
428
428
|
browserContext.on('page', async page => {
|
|
429
|
+
page.on('crash', () => {
|
|
430
|
+
console.log('Page crashed');
|
|
431
|
+
});
|
|
432
|
+
page.on('pageerror', () => {
|
|
433
|
+
console.log('Page erred');
|
|
434
|
+
});
|
|
435
|
+
page.on('requestfailed', () => {
|
|
436
|
+
console.log('Request failed');
|
|
437
|
+
});
|
|
429
438
|
// If it emits a message:
|
|
430
439
|
page.on('console', msg => {
|
|
431
440
|
const msgText = msg.text();
|
package/tests/ibm.js
CHANGED
|
@@ -41,27 +41,18 @@ const {getCompliance} = require('accessibility-checker');
|
|
|
41
41
|
// FUNCTIONS
|
|
42
42
|
|
|
43
43
|
// Runs the IBM test and returns the result.
|
|
44
|
-
const run = async
|
|
44
|
+
const run = async content => {
|
|
45
45
|
const nowLabel = (new Date()).toISOString().slice(0, 19);
|
|
46
|
-
// Start the timeout clock.
|
|
47
|
-
let timeoutID;
|
|
48
|
-
const timeout = new Promise(resolve => {
|
|
49
|
-
timeoutID = setTimeout(() => {
|
|
50
|
-
resolve(null);
|
|
51
|
-
}, 1000 * timeLimit);
|
|
52
|
-
});
|
|
53
|
-
// Return the result of the test, or null if it timed out.
|
|
54
46
|
try {
|
|
55
|
-
const ibmReport = getCompliance(content, nowLabel);
|
|
56
|
-
|
|
57
|
-
clearTimeout(timeoutID);
|
|
58
|
-
return result;
|
|
47
|
+
const ibmReport = await getCompliance(content, nowLabel);
|
|
48
|
+
return ibmReport;
|
|
59
49
|
}
|
|
60
50
|
catch(error) {
|
|
61
|
-
console.log(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
console.log('ibm getCompliance failed');
|
|
52
|
+
return {
|
|
53
|
+
prevented: true,
|
|
54
|
+
error: error.message.slice(0, 200)
|
|
55
|
+
};
|
|
65
56
|
}
|
|
66
57
|
};
|
|
67
58
|
// Revises act-report totals for any rule limitation.
|
|
@@ -114,8 +105,10 @@ const trimActReport = (data, actReport, withItems, rules) => {
|
|
|
114
105
|
// Otherwise, i.e. if it excludes totals:
|
|
115
106
|
else {
|
|
116
107
|
// Report this.
|
|
108
|
+
const error = 'ERROR: No totals reported';
|
|
109
|
+
console.log(error);
|
|
117
110
|
data.prevented = true;
|
|
118
|
-
data.error =
|
|
111
|
+
data.error = error;
|
|
119
112
|
// Return an empty act report.
|
|
120
113
|
return {
|
|
121
114
|
totals: {},
|
|
@@ -126,8 +119,10 @@ const trimActReport = (data, actReport, withItems, rules) => {
|
|
|
126
119
|
// Otherwise, i.e. if it excludes a summary:
|
|
127
120
|
else {
|
|
128
121
|
// Report this.
|
|
122
|
+
const error = 'ERROR: No summary reported';
|
|
123
|
+
console.log(error);
|
|
129
124
|
data.prevented = true;
|
|
130
|
-
data.error =
|
|
125
|
+
data.error = error;
|
|
131
126
|
// Return an empty act report.
|
|
132
127
|
return {
|
|
133
128
|
totals: {},
|
|
@@ -137,27 +132,38 @@ const trimActReport = (data, actReport, withItems, rules) => {
|
|
|
137
132
|
};
|
|
138
133
|
// Performs the IBM tests and returns an act report.
|
|
139
134
|
const doTest = async (content, withItems, timeLimit, rules) => {
|
|
140
|
-
// Conduct the
|
|
135
|
+
// Conduct the tests.
|
|
141
136
|
const data = {};
|
|
142
137
|
try {
|
|
143
138
|
const runReport = await run(content, timeLimit);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
// If there were results:
|
|
140
|
+
if (runReport.report) {
|
|
141
|
+
// Delete any report files.
|
|
142
|
+
try {
|
|
143
|
+
const reportNames = await fs.readdir('ibmOutput');
|
|
144
|
+
for (const reportName of reportNames) {
|
|
145
|
+
await fs.rm(`ibmOutput/${reportName}`);
|
|
146
|
+
}
|
|
150
147
|
}
|
|
148
|
+
catch(error) {
|
|
149
|
+
console.log('No result files created');
|
|
150
|
+
};
|
|
151
|
+
// Return a trimmed act report.
|
|
152
|
+
const {report} = runReport;
|
|
153
|
+
const trimmedReport = trimActReport(data, report, withItems, rules);
|
|
154
|
+
return {
|
|
155
|
+
data,
|
|
156
|
+
result: trimmedReport
|
|
157
|
+
};
|
|
151
158
|
}
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
// Otherwise, i.e. if there were no results:
|
|
160
|
+
else {
|
|
161
|
+
// Return this.
|
|
162
|
+
return {
|
|
163
|
+
data: runReport,
|
|
164
|
+
result: {}
|
|
165
|
+
}
|
|
154
166
|
}
|
|
155
|
-
// Return a trimmed act report.
|
|
156
|
-
const trimmedReport = trimActReport(data, actReport, withItems, rules);
|
|
157
|
-
return {
|
|
158
|
-
data,
|
|
159
|
-
result: trimmedReport
|
|
160
|
-
};
|
|
161
167
|
}
|
|
162
168
|
catch(error) {
|
|
163
169
|
const message = `Act failed (${error.message.slice(0, 200)})`;
|
|
@@ -186,6 +192,7 @@ exports.reporter = async (page, options) => {
|
|
|
186
192
|
const message = `ERROR: Act failed or timed out at ${timeLimit} seconds`;
|
|
187
193
|
console.log(message);
|
|
188
194
|
data.error = data.error ? `${data.error}; ${message}` : message;
|
|
195
|
+
// Return the failure.
|
|
189
196
|
return {
|
|
190
197
|
data,
|
|
191
198
|
result: {}
|