testaro 4.15.0 → 5.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.
Binary file
Binary file
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2012, Squiz Pty Ltd (ABN 77 084 670 600)
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of Squiz Pty Ltd nor the
12
+ names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "4.15.0",
3
+ "version": "5.1.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,6 @@
27
27
  "@siteimprove/alfa-playwright": "*",
28
28
  "@siteimprove/alfa-rules": "*",
29
29
  "@siteimprove/alfa-scraper": "*",
30
- "aatt": "*",
31
30
  "accessibility-checker": "*",
32
31
  "axe-playwright": "*",
33
32
  "dotenv": "*",
package/run.js CHANGED
@@ -29,7 +29,6 @@ const moves = {
29
29
  };
30
30
  // Names and descriptions of tests.
31
31
  const tests = {
32
- aatt: 'AATT with HTML CodeSniffer WCAG 2.1 AA ruleset',
33
32
  alfa: 'alfa',
34
33
  axe: 'Axe',
35
34
  bulk: 'count of visible elements',
@@ -38,6 +37,7 @@ const tests = {
38
37
  focInd: 'focus indicators',
39
38
  focOp: 'focusability and operability',
40
39
  hover: 'hover-caused content additions',
40
+ htmlcs: 'HTML CodeSniffer WCAG 2.1 A, AA, and AAA rulesets',
41
41
  ibm: 'IBM Accessibility Checker',
42
42
  labClash: 'labeling inconsistencies',
43
43
  linkUl: 'adjacent-link underlining',
@@ -53,7 +53,7 @@ const tests = {
53
53
  };
54
54
  // Tests that may change the DOM.
55
55
  const domChangers = new Set([
56
- 'axe', 'focAll', 'focInd', 'focOp', 'hover', 'ibm', 'menuNav', 'wave'
56
+ 'axe', 'focAll', 'focInd', 'focOp', 'hover', 'htmlcs', 'ibm', 'menuNav', 'wave'
57
57
  ]);
58
58
  // Browser types available in PlayWright.
59
59
  const browserTypeNames = {
@@ -0,0 +1,164 @@
1
+ {
2
+ "id": "tp11",
3
+ "what": "AATT, Alfa, Axe, IBM, Tenon, WAVE, and 16 custom tests",
4
+ "strict": true,
5
+ "commands": [
6
+ {
7
+ "type": "launch",
8
+ "which": "webkit",
9
+ "what": "Webkit browser"
10
+ },
11
+ {
12
+ "type": "url",
13
+ "which": "https://*",
14
+ "what": "any page"
15
+ },
16
+ {
17
+ "type": "tenonRequest",
18
+ "id": "a",
19
+ "withNewContent": true,
20
+ "what": "Tenon API version 2 test request"
21
+ },
22
+ {
23
+ "type": "test",
24
+ "which": "motion",
25
+ "what": "spontaneous change of content; requires webkit",
26
+ "delay": 2500,
27
+ "interval": 2500,
28
+ "count": 5
29
+ },
30
+ {
31
+ "type": "launch",
32
+ "which": "chromium",
33
+ "what": "Chromium browser"
34
+ },
35
+ {
36
+ "type": "url",
37
+ "which": "https://*",
38
+ "what": "any page"
39
+ },
40
+ {
41
+ "type": "test",
42
+ "which": "bulk",
43
+ "what": "count of visible elements"
44
+ },
45
+ {
46
+ "type": "test",
47
+ "which": "embAc",
48
+ "withItems": true,
49
+ "what": "active elements incorrectly embedded in each other"
50
+ },
51
+ {
52
+ "type": "test",
53
+ "which": "focAll",
54
+ "what": "Tab-focusability"
55
+ },
56
+ {
57
+ "type": "test",
58
+ "which": "focInd",
59
+ "revealAll": false,
60
+ "allowedDelay": 250,
61
+ "withItems": true,
62
+ "what": "focus indicators"
63
+ },
64
+ {
65
+ "type": "test",
66
+ "which": "focOp",
67
+ "withItems": true,
68
+ "what": "focusability and operability of elements"
69
+ },
70
+ {
71
+ "type": "test",
72
+ "which": "hover",
73
+ "headSize": 20,
74
+ "headSampleSize": 20,
75
+ "tailSampleSize": 15,
76
+ "withItems": true,
77
+ "what": "hover impacts"
78
+ },
79
+ {
80
+ "type": "test",
81
+ "which": "labClash",
82
+ "withItems": true,
83
+ "what": "unlabeled and mislabeled form controls"
84
+ },
85
+ {
86
+ "type": "test",
87
+ "which": "linkUl",
88
+ "withItems": true,
89
+ "what": "underlining of inline links"
90
+ },
91
+ {
92
+ "type": "test",
93
+ "which": "menuNav",
94
+ "withItems": true,
95
+ "what": "keyboard navigation within true-focus menus"
96
+ },
97
+ {
98
+ "type": "test",
99
+ "which": "radioSet",
100
+ "withItems": true,
101
+ "what": "grouping of radio buttons in fieldsets"
102
+ },
103
+ {
104
+ "type": "test",
105
+ "which": "role",
106
+ "what": "validity and necessity of role assignments"
107
+ },
108
+ {
109
+ "type": "test",
110
+ "which": "styleDiff",
111
+ "withItems": true,
112
+ "what": "style consistency of headings, buttons, and links"
113
+ },
114
+ {
115
+ "type": "test",
116
+ "which": "tabNav",
117
+ "withItems": true,
118
+ "what": "keyboard navigation within tab lists"
119
+ },
120
+ {
121
+ "type": "test",
122
+ "which": "zIndex",
123
+ "withItems": true,
124
+ "what": "elements with non-auto z indexes"
125
+ },
126
+ {
127
+ "type": "test",
128
+ "which": "aatt",
129
+ "waitLong": true,
130
+ "tryLimit": 2,
131
+ "what": "AATT with HTML CodeSniffer"
132
+ },
133
+ {
134
+ "type": "test",
135
+ "which": "alfa",
136
+ "what": "Siteimprove alfa"
137
+ },
138
+ {
139
+ "type": "test",
140
+ "which": "axe",
141
+ "detailLevel": 2,
142
+ "rules": [],
143
+ "what": "Axe core, all rules"
144
+ },
145
+ {
146
+ "type": "test",
147
+ "which": "ibm",
148
+ "withItems": true,
149
+ "what": "IBM Accessibility Checker, with page content and again with URL"
150
+ },
151
+ {
152
+ "type": "test",
153
+ "which": "tenon",
154
+ "id": "a",
155
+ "what": "Tenon API version 2 result retrieval"
156
+ },
157
+ {
158
+ "type": "test",
159
+ "which": "wave",
160
+ "reportType": 4,
161
+ "what": "WAVE, report-type 4"
162
+ }
163
+ ]
164
+ }
@@ -0,0 +1,162 @@
1
+ {
2
+ "id": "tp12",
3
+ "what": "Alfa, Axe, HTML CodeSniffer, IBM, Tenon, WAVE, and 16 custom tests",
4
+ "strict": true,
5
+ "commands": [
6
+ {
7
+ "type": "launch",
8
+ "which": "webkit",
9
+ "what": "Webkit browser"
10
+ },
11
+ {
12
+ "type": "url",
13
+ "which": "https://*",
14
+ "what": "any page"
15
+ },
16
+ {
17
+ "type": "tenonRequest",
18
+ "id": "a",
19
+ "withNewContent": true,
20
+ "what": "Tenon API version 2 test request"
21
+ },
22
+ {
23
+ "type": "test",
24
+ "which": "motion",
25
+ "what": "spontaneous change of content; requires webkit",
26
+ "delay": 2500,
27
+ "interval": 2500,
28
+ "count": 5
29
+ },
30
+ {
31
+ "type": "launch",
32
+ "which": "chromium",
33
+ "what": "Chromium browser"
34
+ },
35
+ {
36
+ "type": "url",
37
+ "which": "https://*",
38
+ "what": "any page"
39
+ },
40
+ {
41
+ "type": "test",
42
+ "which": "bulk",
43
+ "what": "count of visible elements"
44
+ },
45
+ {
46
+ "type": "test",
47
+ "which": "embAc",
48
+ "withItems": true,
49
+ "what": "active elements incorrectly embedded in each other"
50
+ },
51
+ {
52
+ "type": "test",
53
+ "which": "focAll",
54
+ "what": "Tab-focusability"
55
+ },
56
+ {
57
+ "type": "test",
58
+ "which": "focInd",
59
+ "revealAll": false,
60
+ "allowedDelay": 250,
61
+ "withItems": true,
62
+ "what": "focus indicators"
63
+ },
64
+ {
65
+ "type": "test",
66
+ "which": "focOp",
67
+ "withItems": true,
68
+ "what": "focusability and operability of elements"
69
+ },
70
+ {
71
+ "type": "test",
72
+ "which": "hover",
73
+ "headSize": 20,
74
+ "headSampleSize": 20,
75
+ "tailSampleSize": 15,
76
+ "withItems": true,
77
+ "what": "hover impacts"
78
+ },
79
+ {
80
+ "type": "test",
81
+ "which": "labClash",
82
+ "withItems": true,
83
+ "what": "unlabeled and mislabeled form controls"
84
+ },
85
+ {
86
+ "type": "test",
87
+ "which": "linkUl",
88
+ "withItems": true,
89
+ "what": "underlining of inline links"
90
+ },
91
+ {
92
+ "type": "test",
93
+ "which": "menuNav",
94
+ "withItems": true,
95
+ "what": "keyboard navigation within true-focus menus"
96
+ },
97
+ {
98
+ "type": "test",
99
+ "which": "radioSet",
100
+ "withItems": true,
101
+ "what": "grouping of radio buttons in fieldsets"
102
+ },
103
+ {
104
+ "type": "test",
105
+ "which": "role",
106
+ "what": "validity and necessity of role assignments"
107
+ },
108
+ {
109
+ "type": "test",
110
+ "which": "styleDiff",
111
+ "withItems": true,
112
+ "what": "style consistency of headings, buttons, and links"
113
+ },
114
+ {
115
+ "type": "test",
116
+ "which": "tabNav",
117
+ "withItems": true,
118
+ "what": "keyboard navigation within tab lists"
119
+ },
120
+ {
121
+ "type": "test",
122
+ "which": "zIndex",
123
+ "withItems": true,
124
+ "what": "elements with non-auto z indexes"
125
+ },
126
+ {
127
+ "type": "test",
128
+ "which": "alfa",
129
+ "what": "Siteimprove alfa"
130
+ },
131
+ {
132
+ "type": "test",
133
+ "which": "axe",
134
+ "detailLevel": 2,
135
+ "rules": [],
136
+ "what": "Axe core, all rules"
137
+ },
138
+ {
139
+ "type": "test",
140
+ "which": "htmlcs",
141
+ "what": "HTML CodeSniffer"
142
+ },
143
+ {
144
+ "type": "test",
145
+ "which": "ibm",
146
+ "withItems": true,
147
+ "what": "IBM Accessibility Checker, with page content and again with URL"
148
+ },
149
+ {
150
+ "type": "test",
151
+ "which": "tenon",
152
+ "id": "a",
153
+ "what": "Tenon API version 2 result retrieval"
154
+ },
155
+ {
156
+ "type": "test",
157
+ "which": "wave",
158
+ "reportType": 4,
159
+ "what": "WAVE, report-type 4"
160
+ }
161
+ ]
162
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ htmlcs
3
+ This test implements the HTML CodeSniffer ruleset.
4
+ */
5
+
6
+ // FUNCTIONS
7
+ // Runs HTML CodeSniffer on the page.
8
+ exports.reporter = async page => {
9
+ await page.addScriptTag({
10
+ path: `${__dirname}/../htmlcs/HTMLCS.js`
11
+ });
12
+ let messageStrings = [];
13
+ for (const standard of ['WCAG2AA']) {
14
+ const nextIssues = await page.evaluate(standard => HTMLCS_RUNNER.run(standard), standard);
15
+ messageStrings.push(... nextIssues);
16
+ }
17
+ // Sort the issues by class and standard.
18
+ messageStrings.sort();
19
+ // Remove any duplicate issues.
20
+ messageStrings = [... new Set(messageStrings)];
21
+ // Initialize the result.
22
+ const result = {
23
+ Error: {},
24
+ Warning: {}
25
+ };
26
+ // For each issue:
27
+ messageStrings.forEach(string => {
28
+ const parts = string.split(/\|/g);
29
+ const partCount = parts.length;
30
+ if (partCount !== 6) {
31
+ console.log(`ERROR: Issue string ${string} has too few or too many parts`);
32
+ }
33
+ // If it is an error or a warning (not a notice):
34
+ else if (['Error', 'Warning'].includes(parts[0])) {
35
+ /*
36
+ Add the issue to an issueClass.issueCode.description array in the result.
37
+ This saves space, because, although some descriptions are issue-specific, such as
38
+ descriptions that state the contrast ratio of an element, most descriptions are
39
+ generic, so typically many issues share a description.
40
+ */
41
+ const issueCode = parts[1].replace(/^WCAG2|\.Principle\d\.Guideline[\d_]+/g, '');
42
+ if (! result[parts[0]][issueCode]) {
43
+ result[parts[0]][issueCode] = {};
44
+ }
45
+ if (! result[parts[0]][issueCode][parts[4]]) {
46
+ result[parts[0]][issueCode][parts[4]] = [];
47
+ }
48
+ result[parts[0]][issueCode][parts[4]].push({
49
+ tagName: parts[2],
50
+ id: parts[3],
51
+ code: parts[5]
52
+ });
53
+ }
54
+ });
55
+ return {result};
56
+ };