testaro 72.2.2 → 72.3.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/UPGRADES.md +5101 -0
- package/package.json +1 -1
- package/procs/doActs.js +5 -4
- package/testaro/{targetSmall.js → targetsNear.js} +36 -11
- package/tests/alfa.js +9 -2
- package/tests/testaro.js +1 -1
- package/validation/tests/jobProperties/targetSmall.json +6 -6
- package/validation/tests/jobProperties/targetTiny.json +1 -1
package/package.json
CHANGED
package/procs/doActs.js
CHANGED
|
@@ -48,15 +48,16 @@ const moves = {
|
|
|
48
48
|
const waits = Number.parseInt(process.env.WAITS) || 0;
|
|
49
49
|
// Time limits in seconds on tools, accounting for page reloads by 6 Testaro tests.
|
|
50
50
|
const timeLimits = {
|
|
51
|
-
alfa:
|
|
51
|
+
alfa: 35,
|
|
52
52
|
aslint: 45,
|
|
53
|
+
axe: 30,
|
|
53
54
|
ed11y: 30,
|
|
54
55
|
htmlcs: 30,
|
|
55
56
|
ibm: 30,
|
|
56
|
-
nuVal:
|
|
57
|
-
nuVnu:
|
|
57
|
+
nuVal: 40,
|
|
58
|
+
nuVnu: 25,
|
|
58
59
|
qualWeb: 45,
|
|
59
|
-
testaro:
|
|
60
|
+
testaro: 200 + Math.round(6 * waits / 1000),
|
|
60
61
|
wave: 25
|
|
61
62
|
};
|
|
62
63
|
// Timeout multiplier.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
|
-
|
|
11
|
+
targetsNear
|
|
12
12
|
Related to Tenon rule 152.
|
|
13
|
-
This test reports visible pointer targets, i.e. labels, buttons, inputs, and links, that are
|
|
13
|
+
This test reports visible pointer targets, i.e. labels, buttons, inputs, and links, that are near enough to other targets to make pointer interaction difficult. This test relates to WCAG 2.2 Success Criteria 2.5.5 and 2.5.8, but does not attempt to implement either of them precisely. For example, the test reports a small pointer target that is far from all other targets, although it conforms to the Success Criteria.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// IMPORTS
|
|
@@ -24,17 +24,41 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
24
24
|
// Return totals and standard instances for the rule.
|
|
25
25
|
const protoResult = await page.evaluate(withItems => {
|
|
26
26
|
// Get all pointer targets.
|
|
27
|
-
const
|
|
27
|
+
const allTargets = Array.from(document.body.querySelectorAll('label, button, input, a'));
|
|
28
28
|
// Get the visible ones.
|
|
29
|
-
const
|
|
29
|
+
const visibleTargets = allTargets.filter(target => target.checkVisibility({
|
|
30
30
|
contentVisibilityAuto: true,
|
|
31
31
|
opacityProperty: true,
|
|
32
32
|
visibilityProperty: true
|
|
33
33
|
}));
|
|
34
|
+
// For each visible one:
|
|
35
|
+
const visibleBlockTargets = visibleTargets.filter(target => {
|
|
36
|
+
const style = window.getComputedStyle(target);
|
|
37
|
+
// If it is block-displayed:
|
|
38
|
+
if (['block', 'list-item', 'table-cell'].includes(style.display)) {
|
|
39
|
+
// Include it.
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
const parent = target.parentElement;
|
|
43
|
+
// Otherwise, if it has a parent:
|
|
44
|
+
if (parent) {
|
|
45
|
+
// If the parent has no additional text:
|
|
46
|
+
if (parent.innerText === target.innerText) {
|
|
47
|
+
const parentStyle = window.getComputedStyle(parent);
|
|
48
|
+
// If the parent is block-displayed:
|
|
49
|
+
if (['block', 'list-item', 'table-cell'].includes(parentStyle.display)) {
|
|
50
|
+
// Include the target.
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Otherwise, exclude it.
|
|
56
|
+
return false;
|
|
57
|
+
});
|
|
34
58
|
// Initialize the data.
|
|
35
59
|
const ptsData = [];
|
|
36
|
-
// For each visible pointer target:
|
|
37
|
-
|
|
60
|
+
// For each visible block-displayed pointer target:
|
|
61
|
+
visibleBlockTargets.forEach(element => {
|
|
38
62
|
// Get the coordinates of its centerpoint.
|
|
39
63
|
const rect = element.getBoundingClientRect();
|
|
40
64
|
const centerX = rect.left + rect.width / 2;
|
|
@@ -45,8 +69,8 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
45
69
|
// Initialize the counts of minor and major violations.
|
|
46
70
|
let violationCounts = [0, 0];
|
|
47
71
|
const protoInstances = [];
|
|
48
|
-
// For each visible pointer target:
|
|
49
|
-
|
|
72
|
+
// For each visible block-displayed pointer target:
|
|
73
|
+
visibleBlockTargets.forEach((element, index) => {
|
|
50
74
|
const [centerX, centerY] = ptsData[index];
|
|
51
75
|
const otherPTsData = ptsData.toSpliced(index, 1);
|
|
52
76
|
// Get the minimum of the vertical distances of its centerpoint from those of the others.
|
|
@@ -66,6 +90,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
66
90
|
}));
|
|
67
91
|
// If the minimum planar distance is less than 44px:
|
|
68
92
|
if (minPlanarDistance < 44) {
|
|
93
|
+
// Get whether it is less than 24px.
|
|
69
94
|
const isVeryNear = minPlanarDistance < 24;
|
|
70
95
|
// Get the ordinal severity of the violation.
|
|
71
96
|
const ordinalSeverity = isVeryNear ? 3 : 2;
|
|
@@ -76,7 +101,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
76
101
|
const what = `Pointer-target centerpoint is only ${Math.round(minPlanarDistance)}px from another one`;
|
|
77
102
|
// Add a proto-instance to the proto-instances.
|
|
78
103
|
protoInstances.push({
|
|
79
|
-
ruleID: '
|
|
104
|
+
ruleID: 'targetsNear',
|
|
80
105
|
what,
|
|
81
106
|
ordinalSeverity,
|
|
82
107
|
count: 1,
|
|
@@ -92,7 +117,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
92
117
|
if (violationCounts[1]) {
|
|
93
118
|
// Add a summary instance to the proto-instances.
|
|
94
119
|
protoInstances.push({
|
|
95
|
-
ruleID: '
|
|
120
|
+
ruleID: 'targetsNear',
|
|
96
121
|
what: 'Pointer-target centerpoints are less than 24px from others',
|
|
97
122
|
ordinalSeverity: 1,
|
|
98
123
|
count: violationCounts[1]
|
|
@@ -102,7 +127,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
102
127
|
if (violationCounts[0]) {
|
|
103
128
|
// Add a summary instance to the proto-instances.
|
|
104
129
|
protoInstances.push({
|
|
105
|
-
ruleID: '
|
|
130
|
+
ruleID: 'targetsNear',
|
|
106
131
|
what: 'Pointer-target centerpoints are less than 44px from others',
|
|
107
132
|
ordinalSeverity: 0,
|
|
108
133
|
count: violationCounts[0]
|
package/tests/alfa.js
CHANGED
|
@@ -55,8 +55,15 @@ exports.reporter = async (page, report, actIndex) => {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
try {
|
|
59
|
+
// Wait for a stable page to make the page and its alfa version consistent.
|
|
60
|
+
await page.waitForLoadState('networkidle', {timeout: applyMultiplier(9000)});
|
|
61
|
+
}
|
|
62
|
+
// If that fails:
|
|
63
|
+
catch (error) {
|
|
64
|
+
// Wait for the page to be loaded.
|
|
65
|
+
await page.waitForLoadState('domcontentloaded', {timeout: applyMultiplier(6000)});
|
|
66
|
+
}
|
|
60
67
|
const doc = await page.evaluateHandle('document');
|
|
61
68
|
const alfaPage = await Playwright.toPage(doc);
|
|
62
69
|
// Test the page content with the specified rules.
|
package/tests/testaro.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"rule": "
|
|
2
|
+
"rule": "targetsNear",
|
|
3
3
|
"timeLimit": 20,
|
|
4
4
|
"acts": [
|
|
5
5
|
{
|
|
6
6
|
"type": "launch",
|
|
7
7
|
"target": {
|
|
8
|
-
"url": "file://validation/tests/
|
|
8
|
+
"url": "file://validation/tests/targetsNear/index.html",
|
|
9
9
|
"what": "page with variously sized interaction targets"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
[
|
|
29
29
|
"standardResult.instances.0.ruleID",
|
|
30
30
|
"=",
|
|
31
|
-
"
|
|
31
|
+
"targetsNear"
|
|
32
32
|
],
|
|
33
33
|
[
|
|
34
34
|
"standardResult.instances.0.what",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
],
|
|
104
104
|
"rules": [
|
|
105
105
|
"y",
|
|
106
|
-
"
|
|
106
|
+
"targetsNear"
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
109
|
{
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
[
|
|
126
126
|
"standardResult.instances.0.ruleID",
|
|
127
127
|
"=",
|
|
128
|
-
"
|
|
128
|
+
"targetsNear"
|
|
129
129
|
],
|
|
130
130
|
[
|
|
131
131
|
"standardResult.instances.0.what",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
],
|
|
146
146
|
"rules": [
|
|
147
147
|
"y",
|
|
148
|
-
"
|
|
148
|
+
"targetsNear"
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
]
|