-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path01_pa11y_BasicScript.js
239 lines (221 loc) · 9.43 KB
/
01_pa11y_BasicScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
//Updated: 01/18/2021
//Technology: Pa11y CLI JavaScript Test Automation
//How to Execute: Type "node 02_pa11y_BasicScript.js" from Git Bash Command window
//
//
// This test script is customized to work as follows. This script will:
//
// [1] - access a server hosted web page
//
// [2] - suppress testing with unwanted rules, such as for HTMLCS Notices and any
// other test rules not considered TTv5-friendly by using the "ignore:" option
//
// [3] - run rules for HTML Code Sniffer only by disabling the "runners" option because
// when a test runner is not specified in the code, Pa11y uses HTML CodeSniffer
// rules by default.
//-----------------------------------------------------------------------------------------------------
const pa11y = require('pa11y');
var numIssues;
var vWebSite;
vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
//vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
//vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
//vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
//vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
//vWebSite="https://section508coordinators.github.io/BaselineTestPages2/test-cases/TC1005C001.html"
pa11y(vWebSite, {
// Options go here
ignore: [
//Pa11y rules that are "Notices" only
'notice',
// aXe-core version 3.5 rules to ignore as of the anlays performed: 4/15/2020
'accesskeys',
'area-alt',
'aria-allowed-role',
'aria-hidden-body',
'aria-required-attr',
'aria-required-children',
'aria-required-parent',
'aria-roledescription',
'aria-roles',
'aria-valid-attr',
'aria-valid-attr-value',
'autocomplete-valid',
'avoid-inline-spacing',
'blink',
'bypass',
'css-orientation-lock',
'definition-list',
'dlitem',
'duplicate-id-active',
'duplicate-id-aria',
'focus-order-semantics',
'frame-tested',
'heading-order',
'hidden-content',
'html-xml-lang-mismatch',
'identical-links-same-purpose',
'img-redundant-alt',
'label-content-name-mismatch',
'label-title-only',
'landmark-banner-is-top-level',
'landmark-complementary-is-top-level',
'landmark-contentinfo-is-top-level',
'landmark-main-is-top-level',
'landmark-no-duplicate-banner',
'landmark-no-duplicate-contentinfo',
'landmark-no-duplicate-main',
'landmark-one-main',
'landmark-unique',
'link-in-text-block',
'marquee',
'meta-refresh',
'meta-viewport',
'meta-viewport-large',
'no-autoplay-audio',
'object-alt',
'page-has-heading-one',
'p-as-heading',
'region',
'server-side-image-map',
'skip-link',
'svg-img-alt',
'tabindex',
'table-duplicate-name',
'table-fake-caption',
'td-has-header',
'th-has-data-cells',
// End Axe //
// HTML Code Sniffer rules version 2.5.1 to ignore as of the anlays performed: 4/15/2020
'WCAG2A.Principle1.Guideline1_1.1_1_1.H2.EG5',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.G73,G74',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.G94,G92.Applet',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.G94,G92.Object',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.G94.Button',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.G94.Image',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H2.EG3',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H2.EG4',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H24',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H24.2',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H35.2',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H35.3',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H36',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H37',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H53',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H67.1',
'WCAG2AA.Principle1.Guideline1_1.1_1_1.H67.2',
'WCAG2AA.Principle1.Guideline1_2.1_2_1.G158',
'WCAG2AA.Principle1.Guideline1_2.1_2_1.G159,G166',
'WCAG2AA.Principle1.Guideline1_2.1_2_2.G87,G93',
'WCAG2AA.Principle1.Guideline1_2.1_2_4.G9,G87,G93',
'WCAG2AA.Principle1.Guideline1_2.1_2_5.G78,G173,G8',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.G141',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H39,H73.4',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H39.3.Check',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H39.3.NoCaption',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H42',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H43.ScopeAmbiguous',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.1.After',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.1.Before',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.2',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NoForAttr',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NoId',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NoLabelAllowed',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NonExistent',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NonExistentFragment',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H44.NotFormControl',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H48',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H48.1',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H48.2',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H49.AlignAttr',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H63.1',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H63.2',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H63.3',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H65',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H65.3',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H71.2',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H71.3',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H73.3.Check',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H73.3.NoSummary',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H85.2',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H93',
'WCAG2AA.Principle1.Guideline1_3.1_3_2.G57',
'WCAG2AA.Principle1.Guideline1_3.1_3_3.G96',
'WCAG2AA.Principle1.Guideline1_4.1_4_1.G14,G182',
'WCAG2AA.Principle1.Guideline1_4.1_4_2.F23',
'WCAG2AA.Principle1.Guideline1_4.1_4_3.F24.BGColour',
'WCAG2AA.Principle1.Guideline1_4.1_4_3.F24.FGColour',
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G145',
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18',
'WCAG2AA.Principle1.Guideline1_4.1_4_4.G142',
'WCAG2AA.Principle1.Guideline1_4.1_4_5.G140,C22,C30.AALevel',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.DblClick',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.MouseDown',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.MouseMove',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.MouseOut',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.MouseOver',
'WCAG2AA.Principle2.Guideline2_1.2_1_1.SCR20.MouseUp',
'WCAG2AA.Principle2.Guideline2_1.2_1_2.F10',
'WCAG2AA.Principle2.Guideline2_2.2_2_1.F40.2',
'WCAG2AA.Principle2.Guideline2_2.2_2_1.F41.2',
'WCAG2AA.Principle2.Guideline2_2.2_2_2.F4',
'WCAG2AA.Principle2.Guideline2_2.2_2_2.F47',
'WCAG2AA.Principle2.Guideline2_2.2_2_2.SCR33,SCR22,G187,G152,G186,G191',
'WCAG2AA.Principle2.Guideline2_3.2_3_1.G19,G176',
'WCAG2AA.Principle2.Guideline2_4.2_4_1.G1,G123,G124,H69',
'WCAG2AA.Principle2.Guideline2_4.2_4_1.G1,G123,G124.NoSuchId',
'WCAG2AA.Principle2.Guideline2_4.2_4_1.G1,G123,G124.NoSuchIdFragment2.4.2',
'WCAG2AA.Principle2.Guideline2_4.2_4_1.H64.2',
'WCAG2AA.Principle2.Guideline2_4.2_4_2.H25.2',
'WCAG2AA.Principle2.Guideline2_4.2_4_3.H4.2',
'WCAG2AA.Principle2.Guideline2_4.2_4_4.H77,H78,H79,H80,H81',
'WCAG2AA.Principle2.Guideline2_4.2_4_4.H77,H78,H79,H80,H81,H33',
'WCAG2AA.Principle2.Guideline2_4.2_4_5.G125,G64,G63,G161,G126,G185',
'WCAG2AA.Principle2.Guideline2_4.2_4_6.G130,G131',
'WCAG2AA.Principle2.Guideline2_4.2_4_7.G149,G165,G195,C15,SCR31',
'WCAG2AA.Principle3.Guideline3_1.3_1_1.H57.2',
'WCAG2AA.Principle3.Guideline3_1.3_1_1.H57.3.XmlLang',
'WCAG2AA.Principle3.Guideline3_1.3_1_2.H58',
'WCAG2AA.Principle3.Guideline3_1.3_1_2.H58.1.XmlLang',
'WCAG2AA.Principle3.Guideline3_2.3_2_1.G107',
'WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2',
'WCAG2AA.Principle3.Guideline3_2.3_2_3.G61',
'WCAG2AA.Principle3.Guideline3_2.3_2_4.G197',
'WCAG2AA.Principle3.Guideline3_3.3_3_1.G83,G84,G85',
'WCAG2AA.Principle3.Guideline3_3.3_3_2.G131,G89,G184,H90',
'WCAG2AA.Principle3.Guideline3_3.3_3_3.G177',
'WCAG2AA.Principle3.Guideline3_3.3_3_4.G98,G99,G155,G164,G168.LegalForms',
'WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.Empty',
'WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.EmptyWithName',
'WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoHref',
'WCAG2AA.Principle1.Guideline1_3.1_3_1.F92,ARIA4',
'WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.Placeholder'
],
// *** IF YOU DON'T SPECIFY A TEST RUNNER, HTML CODESNIFFER RULES ARE USED BY DEFAULT
// runners: [
// 'axe',
// 'htmlcs'
// ],
reporter: [
]
}).then((results) => {
// Do something with the results
numIssues=results.issues.length;
console.log('');
console.log('There are '+numIssues+' errors detected on the '+vWebSite+ ' web site as follows:');
console.log('');
//Loop through Issues:
var i;
for (i = 0; i < results.issues.length; i++) {
console.log('Issue #: '+' '+(i+1));
console.log(' Code: '+results.issues[i].code);
console.log(' Message: '+results.issues[i].message);
console.log(' Context: '+results.issues[i].context);
console.log(' Selector: '+results.issues[i].selector);
console.log(' ');
console.log('------------------------------------');
console.log(' ');
}
console.log('********* END **********')
});