testaro 46.0.2 → 46.1.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/package.json +1 -1
- package/tests/qualWeb.js +14 -4
package/package.json
CHANGED
package/tests/qualWeb.js
CHANGED
|
@@ -120,33 +120,43 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
|
+
qualWebOptions['best-practices'] = {};
|
|
123
124
|
qualWebOptions.execute.bp = true;
|
|
124
125
|
}
|
|
125
126
|
// Get the report.
|
|
126
127
|
let actReports = await doBy(timeLimit, qualWeb, 'evaluate', [qualWebOptions], 'qualWeb testing');
|
|
127
128
|
// If the testing finished on time:
|
|
128
129
|
if (actReports !== 'timedOut') {
|
|
129
|
-
// Remove the copy of the DOM from it.
|
|
130
130
|
result = actReports[withNewContent ? qualWebOptions.url : 'customHtml'];
|
|
131
|
+
// If it contains a copy of the DOM:
|
|
131
132
|
if (result && result.system && result.system.page && result.system.page.dom) {
|
|
133
|
+
// Delete the copy.
|
|
132
134
|
delete result.system.page.dom;
|
|
133
|
-
// For each test section of the act report:
|
|
134
135
|
const {modules} = result;
|
|
136
|
+
// If the report contains a modules property:
|
|
135
137
|
if (modules) {
|
|
138
|
+
// For each test section in it:
|
|
136
139
|
for (const section of ['act-rules', 'wcag-techniques', 'best-practices']) {
|
|
140
|
+
// If testing in the section was specified:
|
|
137
141
|
if (qualWebOptions[section]) {
|
|
142
|
+
// If the section exists:
|
|
138
143
|
if (modules[section]) {
|
|
139
144
|
const {assertions} = modules[section];
|
|
145
|
+
// If it contains assertions (test results):
|
|
140
146
|
if (assertions) {
|
|
141
147
|
const ruleIDs = Object.keys(assertions);
|
|
148
|
+
// For each rule:
|
|
142
149
|
ruleIDs.forEach(ruleID => {
|
|
143
|
-
// Remove passing results.
|
|
144
150
|
const ruleAssertions = assertions[ruleID];
|
|
145
151
|
const {metadata} = ruleAssertions;
|
|
152
|
+
// If result data exist for the rule:
|
|
146
153
|
if (metadata) {
|
|
154
|
+
// If there were no warnings or failures:
|
|
147
155
|
if (metadata.warning === 0 && metadata.failed === 0) {
|
|
156
|
+
// Delete the rule data.
|
|
148
157
|
delete assertions[ruleID];
|
|
149
158
|
}
|
|
159
|
+
// Otherwise, i.e. if there was at least 1 warning or failure:
|
|
150
160
|
else {
|
|
151
161
|
if (ruleAssertions.results) {
|
|
152
162
|
ruleAssertions.results = ruleAssertions.results.filter(
|
|
@@ -192,7 +202,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
192
202
|
}
|
|
193
203
|
// Stop the QualWeb core engine.
|
|
194
204
|
await qualWeb.stop();
|
|
195
|
-
//
|
|
205
|
+
// Test whether the result is an object.
|
|
196
206
|
try {
|
|
197
207
|
JSON.stringify(result);
|
|
198
208
|
}
|