testaro 47.2.1 → 48.0.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/README.md +5 -7
- package/call.js +1 -1
- package/dirWatch.js +5 -7
- package/netWatch.js +1 -1
- package/package.json +1 -1
- package/procs/doTestAct.js +121 -0
- package/run.js +712 -724
- package/tests/alfa.js +3 -6
- package/tests/ibm.js +10 -5
- package/validation/executors/run.js +2 -2
- package/validation/validateTest.js +1 -1
package/tests/alfa.js
CHANGED
|
@@ -34,8 +34,7 @@ const {doBy} = require('../procs/job');
|
|
|
34
34
|
// FUNCTIONS
|
|
35
35
|
|
|
36
36
|
// Conducts and reports the alfa tests.
|
|
37
|
-
exports.reporter = async (page,
|
|
38
|
-
const act = report.acts[actIndex];
|
|
37
|
+
exports.reporter = async (page, act) => {
|
|
39
38
|
const {rules} = act;
|
|
40
39
|
const alfaRulesModule = await import('@siteimprove/alfa-rules');
|
|
41
40
|
const alfaRules = alfaRulesModule.default;
|
|
@@ -62,9 +61,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
62
61
|
};
|
|
63
62
|
try {
|
|
64
63
|
// Get the Alfa rules.
|
|
65
|
-
const response = await rulePage.goto(
|
|
66
|
-
'https://alfa.siteimprove.com/rules', {timeout: Math.round(1000 * timeLimit / 2)}
|
|
67
|
-
);
|
|
64
|
+
const response = await rulePage.goto('https://alfa.siteimprove.com/rules', {timeout: 10000});
|
|
68
65
|
let ruleData = {};
|
|
69
66
|
// If they were obtained:
|
|
70
67
|
if (response.status() === 200) {
|
|
@@ -96,7 +93,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
96
93
|
const alfaActModule = await import('@siteimprove/alfa-act');
|
|
97
94
|
const {Audit} = alfaActModule;
|
|
98
95
|
const audit = Audit.of(alfaPage, alfaRules);
|
|
99
|
-
const outcomes = Array.from(await doBy(
|
|
96
|
+
const outcomes = Array.from(await doBy(10, audit, 'evaluate', [], 'alfa testing'));
|
|
100
97
|
// If the testing finished on time:
|
|
101
98
|
if (outcomes !== 'timedOut') {
|
|
102
99
|
// For each failure or warning:
|
package/tests/ibm.js
CHANGED
|
@@ -52,15 +52,21 @@ const run = async (content, timeLimit) => {
|
|
|
52
52
|
const ibmReport = await doBy(
|
|
53
53
|
timeLimit, accessibilityChecker, 'getCompliance', [content, nowLabel], 'ibm getCompliance'
|
|
54
54
|
);
|
|
55
|
-
if (ibmReport
|
|
55
|
+
if (typeof ibmReport === 'object' && ibmReport.report) {
|
|
56
56
|
return ibmReport;
|
|
57
57
|
}
|
|
58
|
-
else {
|
|
58
|
+
else if (ibmReport === 'timedOut') {
|
|
59
59
|
return {
|
|
60
60
|
prevented: true,
|
|
61
61
|
error: `ibm getCompliance timed out at ${timeLimit} seconds`
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
else {
|
|
65
|
+
return {
|
|
66
|
+
prevented: true,
|
|
67
|
+
error: 'ibm getCompliance produced no report'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
catch(error) {
|
|
66
72
|
console.log('ibm getCompliance failed');
|
|
@@ -207,9 +213,8 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
207
213
|
// If the act was prevented:
|
|
208
214
|
if (data && data.prevented) {
|
|
209
215
|
// Report this.
|
|
210
|
-
const message =
|
|
211
|
-
|
|
212
|
-
data.error = data.error ? `${data.error}; ${message}` : message;
|
|
216
|
+
const message = 'ERROR: Act was prevented';
|
|
217
|
+
data.error ??= message;
|
|
213
218
|
// Return the failure.
|
|
214
219
|
return {
|
|
215
220
|
data,
|
|
@@ -41,9 +41,9 @@ const jobID = '240101T1200-simple-example';
|
|
|
41
41
|
// Get the simple job.
|
|
42
42
|
fs.readFile(`${__dirname}/../jobs/todo/${jobID}.json`, 'utf8')
|
|
43
43
|
.then(async jobJSON => {
|
|
44
|
-
const
|
|
44
|
+
const job = JSON.parse(jobJSON);
|
|
45
45
|
// Run it.
|
|
46
|
-
await doJob(
|
|
46
|
+
const report = await doJob(job);
|
|
47
47
|
try {
|
|
48
48
|
// Check the report against expectations.
|
|
49
49
|
const {acts, jobData} = report;
|
|
@@ -44,7 +44,7 @@ exports.validateTest = async testID => {
|
|
|
44
44
|
const jobJSON = await fs.readFile(`${__dirname}/tests/jobs/${jobFileName}`, 'utf8');
|
|
45
45
|
const report = JSON.parse(jobJSON);
|
|
46
46
|
// Perform it.
|
|
47
|
-
await doJob(report);
|
|
47
|
+
report = await doJob(report);
|
|
48
48
|
// Report whether the end time was reported.
|
|
49
49
|
const {acts, jobData} = report;
|
|
50
50
|
if (jobData.endTime && /^(?:\d{2}-){2}\d{2}T\d{2}:\d{2}$/.test(jobData.endTime)) {
|