testilo 39.1.1 → 39.1.3
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/README.md +2 -0
- package/package.json +1 -1
- package/procs/digest/tdp44/index.html +78 -0
- package/procs/digest/tdp44/index.js +188 -0
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ Because Testilo supports Testaro, this `README` file presumes that you have acce
|
|
|
19
19
|
|
|
20
20
|
## Dependencies
|
|
21
21
|
|
|
22
|
+
Testilo depends on Plot for the creation of line graphs by trackers used by the `track` module. Plot is inserted as a script from the Plot content delivery network.
|
|
23
|
+
|
|
22
24
|
The `dotenv` dependency lets you set environment variables in an untracked `.env` file. This prevents secret data, such as passwords, from being shared as part of this package.
|
|
23
25
|
|
|
24
26
|
When Testilo is a dependency of another application, the `.env` file is not imported, because it is not tracked, so all needed environment variables must be provided by the importing application.
|
package/package.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html lang="en-US">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="author" content="Testilo">
|
|
7
|
+
<meta name="creator" content="Testilo">
|
|
8
|
+
<meta name="publisher" name="Testilo">
|
|
9
|
+
<meta name="description" content="report of accessibility testing of a web page">
|
|
10
|
+
<meta name="keywords" content="accessibility a11y web testing">
|
|
11
|
+
<title>Accessibility digest</title>
|
|
12
|
+
<link rel="icon" href="favicon.ico">
|
|
13
|
+
<link rel="stylesheet" href="style.css">
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<main>
|
|
17
|
+
<header>
|
|
18
|
+
<h1>Accessibility digest</h1>
|
|
19
|
+
<h2>Contents</h2>
|
|
20
|
+
<ul>
|
|
21
|
+
<li><a href="#intro">Introduction</a></li>
|
|
22
|
+
<li><a href="#summary">Issue summary</a></li>
|
|
23
|
+
<li><a href="#itemization">Itemized issues</a></li>
|
|
24
|
+
<li><a href="#elements">Multi-issue elements</a></li>
|
|
25
|
+
</ul>
|
|
26
|
+
<table class="allBorder">
|
|
27
|
+
<caption>Synopsis</caption>
|
|
28
|
+
<tr><th>Page</th><td>__org__</td></tr>
|
|
29
|
+
<tr><th>URL</th><td>__url__</td></tr>
|
|
30
|
+
<tr><th>Test date</th><td>__dateSlash__</td></tr>
|
|
31
|
+
<tr><th>Score</th><td>__total__</td></tr>
|
|
32
|
+
</table>
|
|
33
|
+
<table class="allBorder">
|
|
34
|
+
<caption>Configuration</caption>
|
|
35
|
+
<tr><th>Redirections</th><td>__redirections__</td></tr>
|
|
36
|
+
<tr><th>Tool isolation</th><td>__isolation__</td></tr>
|
|
37
|
+
<tr><th>Report format(s)</th><td>__standard__</td></tr>
|
|
38
|
+
<tr><th>Requester</th><td>__requester__</td></tr>
|
|
39
|
+
<tr><th>Device</th><td>__device__</td></tr>
|
|
40
|
+
<tr><th>Browser type</th><td>__browser__</td></tr>
|
|
41
|
+
<tr><th>Reduced motion</th><td>__motion__</td></tr>
|
|
42
|
+
<tr><th>Tested by</th><td>Testaro__agent__, procedure <code>__ts__</code></td></tr>
|
|
43
|
+
<tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
|
|
44
|
+
<tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<th>Full report</th>
|
|
47
|
+
<td><a href="__reportURL__"><code>__reportURL__</code></a></td>
|
|
48
|
+
</tr>
|
|
49
|
+
</table>
|
|
50
|
+
</header>
|
|
51
|
+
<h2 id="intro">Introduction</h2>
|
|
52
|
+
<p>How <a href="https://www.w3.org/WAI/">accessible</a> is the __org__ web page at <a href="__url__"><code>__url__</code></a>?</p>
|
|
53
|
+
<p>This digest can help answer that question. Ten different tools (Alfa, ASLint, Axe, Editoria11y, Equal Access, HTML CodeSniffer, Nu Html Checker, QualWeb, Testaro, and WAVE) tested the page to check its compliance with their accessibility rules. In all, the tools define about 990 rules, which are classified here into about 310 accessibility issues.</p>
|
|
54
|
+
<p>The results were interpreted to yield a score, with 0 being ideal. The score for this page was __total__, the sum of __issueCount__ for the count of issues, __issue__ for specific issues, __solo__ for unclassified rule violations, __tool__ for tool-by-tool ratings, __element__ for the count of violating elements, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
|
|
55
|
+
<h2 id="summary">Issue summary</h2>
|
|
56
|
+
<p>This table shows the numbers of rule violations (<q>instances</q>) reported by one or more tools, classified by issue. When an instance count is 0, that means the tool has a rule belonging to the issue but reported no violations of that rule.</p>
|
|
57
|
+
<p>Tools do not always agree on instance counts. Disagreements may be due to non-equivalent rules or invalid tests. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</p>
|
|
58
|
+
<table class="allBorder thirdCellRight">
|
|
59
|
+
<caption>How many violations each tool reported, by issue</caption>
|
|
60
|
+
<thead>
|
|
61
|
+
<tr><th>Issue</th><th>WCAG</th><th>Score</th><th>Instance counts</th></tr>
|
|
62
|
+
</thead>
|
|
63
|
+
<tbody class="headersLeft">
|
|
64
|
+
__issueRows__
|
|
65
|
+
</tbody>
|
|
66
|
+
</table>
|
|
67
|
+
<h2 id="itemization">Itemized issues</h2>
|
|
68
|
+
<p>The reported rule violations are itemized below, issue by issue. Additional details can be inspected in the <a href="__reportURL__">full report</a>.</p>
|
|
69
|
+
__issueDetailRows__
|
|
70
|
+
<h2 id="elements">Multi-issue elements</h2>
|
|
71
|
+
<p>Elements exhibiting more than 1 issue:</p>
|
|
72
|
+
__multiIssueElementRows__
|
|
73
|
+
<footer>
|
|
74
|
+
<p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
|
|
75
|
+
</footer>
|
|
76
|
+
</main>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/*
|
|
2
|
+
© 2024 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// index: digester for scoring procedure tsp43.
|
|
24
|
+
|
|
25
|
+
// IMPORTS
|
|
26
|
+
|
|
27
|
+
// Module to keep secrets.
|
|
28
|
+
require('dotenv').config();
|
|
29
|
+
// Module to classify tool rules into issues
|
|
30
|
+
const {issues} = require('../../score/tic43');
|
|
31
|
+
// Module to process files.
|
|
32
|
+
const fs = require('fs/promises');
|
|
33
|
+
// Utility module.
|
|
34
|
+
const {getNowDate, getNowDateSlash} = require('../../util');
|
|
35
|
+
|
|
36
|
+
// CONSTANTS
|
|
37
|
+
|
|
38
|
+
// Digester ID.
|
|
39
|
+
const digesterID = 'tdp44';
|
|
40
|
+
// Newline with indentations.
|
|
41
|
+
const innerJoiner = '\n ';
|
|
42
|
+
const outerJoiner = '\n ';
|
|
43
|
+
|
|
44
|
+
// FUNCTIONS
|
|
45
|
+
|
|
46
|
+
// Gets a row of the score-summary table.
|
|
47
|
+
const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
|
|
48
|
+
// Gets a row of the issue-score-summary table.
|
|
49
|
+
const getIssueScoreRow = (issueConstants, issueDetails) => {
|
|
50
|
+
const {summary, wcag} = issueConstants;
|
|
51
|
+
const {instanceCounts, score} = issueDetails;
|
|
52
|
+
const toolList = Object
|
|
53
|
+
.keys(instanceCounts)
|
|
54
|
+
.map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
|
|
55
|
+
.join(', ');
|
|
56
|
+
return `<tr><th>${summary}</th><td class="center">${wcag}<td class="right num">${score}</td><td>${toolList}</td></tr>`;
|
|
57
|
+
};
|
|
58
|
+
// Adds parameters to a query for a digest.
|
|
59
|
+
const populateQuery = (report, query) => {
|
|
60
|
+
const {
|
|
61
|
+
browserID, device, id, isolate, lowMotion, score, sources, standard, strict, target
|
|
62
|
+
} = report;
|
|
63
|
+
const {agent, requester, script} = sources;
|
|
64
|
+
const {scoreProcID, summary, details} = score;
|
|
65
|
+
query.ts = script;
|
|
66
|
+
query.sp = scoreProcID;
|
|
67
|
+
query.dp = digesterID;
|
|
68
|
+
// Add the job data to the query.
|
|
69
|
+
query.dateISO = getNowDate();
|
|
70
|
+
query.dateSlash = getNowDateSlash();
|
|
71
|
+
query.org = target.what;
|
|
72
|
+
query.url = target.url;
|
|
73
|
+
query.redirections = strict ? 'prohibited' : 'permitted';
|
|
74
|
+
query.isolation = isolate ? 'yes' : 'no';
|
|
75
|
+
query.standard
|
|
76
|
+
= ['original', 'standard', 'original and standard'][['no', 'only', 'also'].indexOf(standard)];
|
|
77
|
+
query.motion = lowMotion ? 'requested' : 'not requested';
|
|
78
|
+
query.requester = requester;
|
|
79
|
+
query.device = device.id;
|
|
80
|
+
query.browser = browserID;
|
|
81
|
+
query.agent = agent ? ` on agent ${agent}` : '';
|
|
82
|
+
query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
|
|
83
|
+
// Add values for the score-summary table to the query.
|
|
84
|
+
const rows = {
|
|
85
|
+
summaryRows: [],
|
|
86
|
+
issueRows: []
|
|
87
|
+
};
|
|
88
|
+
['total', 'issueCount', 'issue', 'solo', 'tool', 'element', 'prevention', 'log', 'latency']
|
|
89
|
+
.forEach(sumItem => {
|
|
90
|
+
query[sumItem] = summary[sumItem];
|
|
91
|
+
rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
|
|
92
|
+
});
|
|
93
|
+
// Sort the issue IDs in descending score order.
|
|
94
|
+
const issueIDs = Object.keys(details.issue);
|
|
95
|
+
issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
|
|
96
|
+
// Get rows for the issue-score table.
|
|
97
|
+
issueIDs.forEach(issueID => {
|
|
98
|
+
if (issues[issueID]) {
|
|
99
|
+
rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
console.log(`ERROR: Issue ${issueID} not found`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
// Add the rows to the query.
|
|
106
|
+
['summaryRows', 'issueRows'].forEach(rowType => {
|
|
107
|
+
query[rowType] = rows[rowType].join(innerJoiner);
|
|
108
|
+
});
|
|
109
|
+
// Add paragraph groups about the issue details to the query.
|
|
110
|
+
const issueDetailRows = [];
|
|
111
|
+
issueIDs.forEach(issueID => {
|
|
112
|
+
const issueSummary = issues[issueID].summary;
|
|
113
|
+
issueDetailRows.push(`<h3 class="bars">Issue: ${issueSummary}</h3>`);
|
|
114
|
+
issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
|
|
115
|
+
issueDetailRows.push(`<p>WCAG: ${issues[issueID].wcag || 'N/A'}</p>`);
|
|
116
|
+
const issueData = details.issue[issueID];
|
|
117
|
+
issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
|
|
118
|
+
issueDetailRows.push('<h4>Elements</h4>');
|
|
119
|
+
const issuePaths = details.element[issueID];
|
|
120
|
+
if (issuePaths.length) {
|
|
121
|
+
issueDetailRows.push('<ul>');
|
|
122
|
+
issuePaths.forEach(pathID => {
|
|
123
|
+
issueDetailRows.push(` <li>${pathID}</li>`);
|
|
124
|
+
});
|
|
125
|
+
issueDetailRows.push('</ul>');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
issueDetailRows.push('<p>None identified</p>');
|
|
129
|
+
}
|
|
130
|
+
const toolIDs = Object.keys(issueData.tools);
|
|
131
|
+
toolIDs.forEach(toolID => {
|
|
132
|
+
issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h4>`);
|
|
133
|
+
const ruleIDs = Object.keys(issueData.tools[toolID]);
|
|
134
|
+
ruleIDs.forEach(ruleID => {
|
|
135
|
+
const ruleData = issueData.tools[toolID][ruleID];
|
|
136
|
+
issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
|
|
137
|
+
issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
|
|
138
|
+
issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
|
|
139
|
+
/*
|
|
140
|
+
This fails unless the caller handles such URLs and has compatible scored report URLs.
|
|
141
|
+
const href = `${query.reportURL}?tool=${toolID}&rule=${ruleID}`;
|
|
142
|
+
const detailLabel = `Issue ${issueSummary} tool ${toolID} rule ${ruleID} instance details`;
|
|
143
|
+
issueDetailRows.push(
|
|
144
|
+
`<p><a href="${href}" aria-label="${detailLabel}">Instance details</a></p>`
|
|
145
|
+
);
|
|
146
|
+
*/
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
query.issueDetailRows = issueDetailRows.join(outerJoiner);
|
|
151
|
+
// Add paragraphs about the multi-issue elements to the query.
|
|
152
|
+
const multiIssueElementRows = [];
|
|
153
|
+
const issueElements = {};
|
|
154
|
+
Object.keys(details.element).forEach(issueID => {
|
|
155
|
+
const pathIDs = details.element[issueID];
|
|
156
|
+
pathIDs.forEach(pathID => {
|
|
157
|
+
issueElements[pathID] ??= [];
|
|
158
|
+
issueElements[pathID].push(issueID);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
const sortedPathIDs = Object.keys(issueElements).sort();
|
|
162
|
+
sortedPathIDs.forEach(pathID => {
|
|
163
|
+
const elementIssues = issueElements[pathID];
|
|
164
|
+
if (elementIssues && elementIssues.length > 1) {
|
|
165
|
+
multiIssueElementRows.push(
|
|
166
|
+
`<h5>Element <code>${pathID}</code></h5>`,
|
|
167
|
+
'<ul>',
|
|
168
|
+
... elementIssues.map(issueID => ` <li>${issues[issueID].summary}</li>`).sort(),
|
|
169
|
+
'</ul>'
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
query.multiIssueElementRows = multiIssueElementRows.join(outerJoiner);
|
|
174
|
+
};
|
|
175
|
+
// Returns a digested report.
|
|
176
|
+
exports.digester = async report => {
|
|
177
|
+
// Create a query to replace placeholders.
|
|
178
|
+
const query = {};
|
|
179
|
+
populateQuery(report, query);
|
|
180
|
+
// Get the template.
|
|
181
|
+
let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
|
|
182
|
+
// Replace its placeholders.
|
|
183
|
+
Object.keys(query).forEach(param => {
|
|
184
|
+
template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
|
|
185
|
+
});
|
|
186
|
+
// Return the digest.
|
|
187
|
+
return template;
|
|
188
|
+
};
|