testaro 59.2.7 → 59.2.8
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/procs/visChange.js +1 -2
- package/tests/alfa.js +8 -8
package/package.json
CHANGED
package/procs/visChange.js
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
// IMPORTS
|
|
36
36
|
|
|
37
|
+
const pixelmatch = require('pixelmatch').default;
|
|
37
38
|
const {PNG} = require('pngjs');
|
|
38
39
|
|
|
39
40
|
// FUNCTIONS
|
|
@@ -103,8 +104,6 @@ exports.visChange = async (page, options = {}) => {
|
|
|
103
104
|
// Get their dimensions.
|
|
104
105
|
const {width, height} = pngs[0];
|
|
105
106
|
// Get the count of differing pixels between the shots.
|
|
106
|
-
const pixelmatchModule = await import('pixelmatch');
|
|
107
|
-
const pixelmatch = pixelmatchModule.default;
|
|
108
107
|
const pixelChanges = pixelmatch(pngs[0].data, pngs[1].data, null, width, height);
|
|
109
108
|
// Get the ratio of differing to all pixels as a percentage.
|
|
110
109
|
const changePercent = 100 * pixelChanges / (width * height);
|
package/tests/alfa.js
CHANGED
|
@@ -27,14 +27,18 @@
|
|
|
27
27
|
This test implements the alfa ruleset for accessibility.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
// IMPORTS
|
|
31
|
+
|
|
32
|
+
const {Audit} = require('@siteimprove/alfa-act');
|
|
33
|
+
const {Playwright} = require('@siteimprove/alfa-playwright');
|
|
34
|
+
let alfaRules = require('@siteimprove/alfa-rules').default;
|
|
35
|
+
|
|
30
36
|
// FUNCTIONS
|
|
31
37
|
|
|
32
38
|
// Conducts and reports the alfa tests.
|
|
33
|
-
exports.reporter = async (page, report, actIndex
|
|
39
|
+
exports.reporter = async (page, report, actIndex) => {
|
|
34
40
|
const act = report.acts[actIndex];
|
|
35
41
|
const {rules} = act;
|
|
36
|
-
const alfaRulesModule = await import('@siteimprove/alfa-rules');
|
|
37
|
-
const alfaRules = alfaRulesModule.default;
|
|
38
42
|
// If only some rules are to be employed:
|
|
39
43
|
if (rules && rules.length) {
|
|
40
44
|
// Remove the other rules.
|
|
@@ -84,11 +88,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
84
88
|
}
|
|
85
89
|
// Test the page content with the specified rules.
|
|
86
90
|
const doc = await page.evaluateHandle('document');
|
|
87
|
-
const alfaPlaywrightModule = await import('@siteimprove/alfa-playwright');
|
|
88
|
-
const {Playwright} = alfaPlaywrightModule;
|
|
89
91
|
const alfaPage = await Playwright.toPage(doc);
|
|
90
|
-
const alfaActModule = await import('@siteimprove/alfa-act');
|
|
91
|
-
const {Audit} = alfaActModule;
|
|
92
92
|
const audit = Audit.of(alfaPage, alfaRules);
|
|
93
93
|
const outcomes = Array.from(await audit.evaluate());
|
|
94
94
|
// For each failure or warning:
|
|
@@ -161,7 +161,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
catch(error) {
|
|
164
|
-
console.log(`ERROR:
|
|
164
|
+
console.log(`ERROR: Navigation to URL timed out (${error})`);
|
|
165
165
|
data.prevented = true;
|
|
166
166
|
data.error = 'ERROR: Act failed';
|
|
167
167
|
}
|