testaro 5.18.0 → 5.19.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/commands.js CHANGED
@@ -173,6 +173,12 @@ exports.commands = {
173
173
  withItems: [true, 'boolean']
174
174
  }
175
175
  ],
176
+ filter: [
177
+ 'Perform a filter test',
178
+ {
179
+ withItems: [true, 'boolean']
180
+ }
181
+ ],
176
182
  focInd: [
177
183
  'Perform a focInd test',
178
184
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.18.0",
3
+ "version": "5.19.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -38,6 +38,7 @@ const tests = {
38
38
  docType: 'document without a doctype property',
39
39
  elements: 'data on specified elements',
40
40
  embAc: 'active elements embedded in links or buttons',
41
+ filter: 'filter styles on elements',
41
42
  focAll: 'focusable and Tab-focused elements',
42
43
  focInd: 'focus indicators',
43
44
  focOp: 'focusability and operability',
@@ -0,0 +1,217 @@
1
+ {
2
+ "id": "tp16",
3
+ "what": "Alfa, Axe, Continuum, HTML CodeSniffer, IBM, Nu Html Checker, Tenon, WAVE, and 22 custom tests",
4
+ "strict": true,
5
+ "timeLimit": 500,
6
+ "commands": [
7
+ {
8
+ "type": "launch",
9
+ "which": "webkit",
10
+ "what": "Webkit browser"
11
+ },
12
+ {
13
+ "type": "url",
14
+ "which": "https://*",
15
+ "what": "any page"
16
+ },
17
+ {
18
+ "type": "tenonRequest",
19
+ "id": "a",
20
+ "withNewContent": true,
21
+ "what": "Tenon API version 2 test request"
22
+ },
23
+ {
24
+ "type": "test",
25
+ "which": "motion",
26
+ "what": "spontaneous change of content; requires webkit",
27
+ "delay": 2500,
28
+ "interval": 2500,
29
+ "count": 5
30
+ },
31
+ {
32
+ "type": "launch",
33
+ "which": "chromium",
34
+ "what": "Chromium browser"
35
+ },
36
+ {
37
+ "type": "url",
38
+ "which": "https://*",
39
+ "what": "any page"
40
+ },
41
+ {
42
+ "type": "test",
43
+ "which": "allHidden",
44
+ "what": "document entirely or mainly hidden"
45
+ },
46
+ {
47
+ "type": "test",
48
+ "which": "bulk",
49
+ "what": "count of visible elements"
50
+ },
51
+ {
52
+ "type": "test",
53
+ "which": "docType",
54
+ "what": "missing or invalid doctype declaration"
55
+ },
56
+ {
57
+ "type": "test",
58
+ "which": "embAc",
59
+ "withItems": true,
60
+ "what": "active elements incorrectly embedded in each other"
61
+ },
62
+ {
63
+ "type": "test",
64
+ "which": "filter",
65
+ "withItems": true,
66
+ "what": "filter styles"
67
+ },
68
+ {
69
+ "type": "test",
70
+ "which": "focAll",
71
+ "what": "Tab-focusability"
72
+ },
73
+ {
74
+ "type": "test",
75
+ "which": "focInd",
76
+ "revealAll": false,
77
+ "allowedDelay": 250,
78
+ "withItems": true,
79
+ "what": "focus indicators"
80
+ },
81
+ {
82
+ "type": "test",
83
+ "which": "focOp",
84
+ "withItems": true,
85
+ "what": "focusability and operability of elements"
86
+ },
87
+ {
88
+ "type": "test",
89
+ "which": "focVis",
90
+ "withItems": true,
91
+ "what": "links outside display when focused"
92
+ },
93
+ {
94
+ "type": "test",
95
+ "which": "hover",
96
+ "sampleSize": 20,
97
+ "withItems": true,
98
+ "what": "hover impacts"
99
+ },
100
+ {
101
+ "type": "test",
102
+ "which": "labClash",
103
+ "withItems": true,
104
+ "what": "unlabeled and mislabeled form controls"
105
+ },
106
+ {
107
+ "type": "test",
108
+ "which": "linkTo",
109
+ "withItems": true,
110
+ "what": "links without destinations"
111
+ },
112
+ {
113
+ "type": "test",
114
+ "which": "linkUl",
115
+ "withItems": true,
116
+ "what": "underlining of inline links"
117
+ },
118
+ {
119
+ "type": "test",
120
+ "which": "miniText",
121
+ "withItems": true,
122
+ "what": "small text"
123
+ },
124
+ {
125
+ "type": "test",
126
+ "which": "menuNav",
127
+ "withItems": true,
128
+ "what": "keyboard navigation within true-focus menus"
129
+ },
130
+ {
131
+ "type": "test",
132
+ "which": "nonTable",
133
+ "withItems": true,
134
+ "what": "tables used for layout"
135
+ },
136
+ {
137
+ "type": "test",
138
+ "which": "radioSet",
139
+ "withItems": true,
140
+ "what": "grouping of radio buttons in fieldsets"
141
+ },
142
+ {
143
+ "type": "test",
144
+ "which": "role",
145
+ "what": "validity and necessity of role assignments"
146
+ },
147
+ {
148
+ "type": "test",
149
+ "which": "styleDiff",
150
+ "withItems": true,
151
+ "what": "style consistency of headings, buttons, and links"
152
+ },
153
+ {
154
+ "type": "test",
155
+ "which": "tabNav",
156
+ "withItems": true,
157
+ "what": "keyboard navigation within tab lists"
158
+ },
159
+ {
160
+ "type": "test",
161
+ "which": "titledEl",
162
+ "withItems": true,
163
+ "what": "title attributes on inappropriate elements"
164
+ },
165
+ {
166
+ "type": "test",
167
+ "which": "zIndex",
168
+ "withItems": true,
169
+ "what": "elements with non-auto z indexes"
170
+ },
171
+ {
172
+ "type": "test",
173
+ "which": "alfa",
174
+ "what": "Siteimprove alfa"
175
+ },
176
+ {
177
+ "type": "test",
178
+ "which": "axe",
179
+ "detailLevel": 2,
180
+ "rules": [],
181
+ "what": "Axe core, all rules"
182
+ },
183
+ {
184
+ "type": "test",
185
+ "which": "continuum",
186
+ "what": "Continuum"
187
+ },
188
+ {
189
+ "type": "test",
190
+ "which": "htmlcs",
191
+ "what": "HTML CodeSniffer"
192
+ },
193
+ {
194
+ "type": "test",
195
+ "which": "ibm",
196
+ "withItems": true,
197
+ "what": "IBM Accessibility Checker, with page content and again with URL"
198
+ },
199
+ {
200
+ "type": "test",
201
+ "which": "nuVal",
202
+ "what": "Nu Html Checker"
203
+ },
204
+ {
205
+ "type": "test",
206
+ "which": "wave",
207
+ "reportType": 4,
208
+ "what": "WAVE, report-type 4"
209
+ },
210
+ {
211
+ "type": "test",
212
+ "which": "tenon",
213
+ "id": "a",
214
+ "what": "Tenon API version 2 result retrieval"
215
+ }
216
+ ]
217
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ filter
3
+ This test reports elements whose styles include filter. The filter style property is considered
4
+ inherently inaccessible, because it modifies the rendering of content, overriding user settings,
5
+ and requires the user to apply custom styles to neutralize it, which is difficult or impossible
6
+ in some user environments.
7
+ */
8
+ // Runs the test and returns the results.
9
+ exports.reporter = async (page, withItems) => {
10
+ // Identify the elements with filter style properties.
11
+ const data = await page.evaluate(withItems => {
12
+ // Returns a space-minimized copy of a string.
13
+ const compact = string => string.replace(/[\t\n]/g, '').replace(/\s{2,}/g, ' ').trim();
14
+ // Get all elements in the body.
15
+ const elements = Array.from(document.body.querySelectorAll('*'));
16
+ // Get those that have filter styles.
17
+ const filterElements = elements.filter(element => {
18
+ const elementStyles = window.getComputedStyle(element);
19
+ return elementStyles.filter !== 'none';
20
+ });
21
+ const filterData = filterElements.map(element => ({
22
+ element,
23
+ impact: element.querySelectorAll('*').length
24
+ }));
25
+ // Initialize the result.
26
+ const data = {
27
+ totals: {
28
+ styledElements: filterElements.length,
29
+ impactedElements: filterData.reduce((total, current) => total + current.impact, 0)
30
+ }
31
+ };
32
+ // If itemization is required:
33
+ if (withItems) {
34
+ // Add it to the result.
35
+ data.items = [];
36
+ filterData.forEach(filterDatum => {
37
+ data.items.push({
38
+ tagName: filterDatum.element.tagName,
39
+ text: compact(filterDatum.element.textContent),
40
+ impact: filterDatum.impact
41
+ });
42
+ });
43
+ }
44
+ return data;
45
+ }, withItems);
46
+ return {result: data};
47
+ };
package/tests/hover.js CHANGED
@@ -1,25 +1,26 @@
1
1
  /*
2
2
  hover
3
3
  This test reports unexpected impacts of hovering. The effects include additions and removals
4
- of visible elements, opacity changes, unhoverable elements, and suppression of hover indication.
4
+ of visible elements, opacity changes, unhoverable elements, and nonstandard hover indication.
5
5
  The elements that are subjected to hovering (called “triggers”) are the Playwright-visible
6
6
  elements that have 'A', 'BUTTON', or 'LI' tag names or have 'onmouseenter' or 'onmouseover'
7
7
  attributes.
8
8
 
9
- When such an element is hovered over, the test examines the impacts on descendants of the great
10
- grandparents of the elements with tag names 'A' and 'BUTTON', grandparents of elements with tag
11
- name 'LI', and otherwise the descendants of the elements themselves. Four impacts are counted:
9
+ The test examines how the hover event is indicated to the user with the mouse cursor and with
10
+ changes of the styles of the trigger.
11
+
12
+ When a trigger is hovered over, the test also examines the impacts on descendants of the great
13
+ grandparents of triggers with tag names 'A' and 'BUTTON', grandparents of triggers with tag
14
+ name 'LI', and otherwise the descendants of the triggers themselves. Four impacts are counted:
12
15
  (1) an element is added or becomes visible, (2) an element is removed or becomes invisible, (3)
13
16
  the opacity of an element changes, and (4) the element is a descendant of an element whose opacity
14
17
  changes. The test checks up to 4 times for hovering impacts at intervals of 0.3 second.
15
18
 
16
- The test also examines how the hover event is indicated to the user with the mouse cursor and with
17
- style changes.
18
-
19
19
  Despite the delay, the test can make the execution time practical by randomly sampling triggers
20
20
  instead of hovering over all of them. When sampling is performed, the results may vary from one
21
- execution to another. Because hover impacts typically occur near the beginning of a page, the
22
- probability of the inclusion of a trigger in a sample decreases with the index of the trigger.
21
+ execution to another. Because hover impacts typically occur near the beginning of a page with
22
+ navigation menus, the probability of the inclusion of a trigger in a sample decreases with the
23
+ index of the trigger.
23
24
 
24
25
  An element is reported as unhoverable when it fails the Playwright actionability checks for
25
26
  hovering, i.e. fails to be attached to the DOM, visible, stable (not or no longer animating), and
@@ -0,0 +1,46 @@
1
+ {
2
+ "what": "validation of filter test",
3
+ "strict": true,
4
+ "commands": [
5
+ {
6
+ "type": "launch",
7
+ "which": "chromium",
8
+ "what": "usual browser"
9
+ },
10
+ {
11
+ "type": "url",
12
+ "which": "__targets__/filter/good.html",
13
+ "what": "page with no filter styles"
14
+ },
15
+ {
16
+ "type": "test",
17
+ "which": "filter",
18
+ "what": "filter",
19
+ "withItems": true,
20
+ "expect": [
21
+ ["totals.styledElements", "=", 0],
22
+ ["totals.impactedElements", "=", 0]
23
+ ]
24
+ },
25
+ {
26
+ "type": "url",
27
+ "which": "__targets__/filter/bad.html",
28
+ "what": "page with filter styles"
29
+ },
30
+ {
31
+ "type": "test",
32
+ "which": "filter",
33
+ "what": "filter",
34
+ "withItems": true,
35
+ "expect": [
36
+ ["totals.styledElements", "=", 2],
37
+ ["totals.impactedElements", "=", 7],
38
+ ["items.0.tagName", "=", "MAIN"],
39
+ ["items.1.tagName", "=", "UL"],
40
+ ["items.1.text", "i", "Item"],
41
+ ["items.0.impact", "=", 5],
42
+ ["items.1.impact", "=", 2]
43
+ ]
44
+ }
45
+ ]
46
+ }
@@ -24,7 +24,7 @@
24
24
  {
25
25
  "type": "url",
26
26
  "which": "__targets__/zIndex/bad.html",
27
- "what": "page with explicit z-index attributes roles"
27
+ "what": "page with explicit z-index attributes"
28
28
  },
29
29
  {
30
30
  "type": "test",
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en-US">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Page with filter styles</title>
6
+ <meta name="description" content="tester">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <style>
9
+ main {
10
+ filter: blur(5px);
11
+ }
12
+ ul {
13
+ filter: opacity(20%);
14
+ }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <main>
19
+ <h1>Page with filter styles</h1>
20
+ <p>This is a paragraph.</p>
21
+ <ul>
22
+ <li>Item 1</li>
23
+ <li>Item 2</li>
24
+ </ul>
25
+ </main>
26
+ </body>
27
+ </html>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en-US">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Page without filter styles</title>
6
+ <meta name="description" content="tester">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ </head>
9
+ <body>
10
+ <main>
11
+ <h1>Page without filter styles</h1>
12
+ <p>This is a paragraph.</p>
13
+ <ul>
14
+ <li>Item 1</li>
15
+ <li>Item 2</li>
16
+ </ul>
17
+ </main>
18
+ </body>
19
+ </html>