testilo 41.0.5 → 41.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.
@@ -1,57 +0,0 @@
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
- <table class="allBorder">
20
- <caption>Synopsis</caption>
21
- <tr><th>Page</th><td>__org__</td></tr>
22
- <tr><th>URL</th><td>__url__</td></tr>
23
- <tr><th>Requester</th><td>__requester__</td></tr>
24
- <tr><th>Test date</th><td>__dateSlash__</td></tr>
25
- <tr><th>Score</th><td>__total__</td></tr>
26
- <tr><th>Tested by</th><td>Testaro, procedure <code>__ts__</code></td></tr>
27
- <tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
28
- <tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
29
- <tr>
30
- <th>Full report</th>
31
- <td><a href="__reportURL__"><code>__reportURL__</code></a></td>
32
- </tr>
33
- </table>
34
- </header>
35
- <h2>Introduction</h2>
36
- <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>
37
- <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>
38
- <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, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
39
- <h2>Issue summary</h2>
40
- <table class="allBorder thirdCellRight">
41
- <caption>Summary of issues</caption>
42
- <thead>
43
- <tr><th>Issue</th><th>WCAG</th><th>Score</th><th>Tools reporting the issue</th></tr>
44
- </thead>
45
- <tbody class="headersLeft">
46
- __issueRows__
47
- </tbody>
48
- </table>
49
- <h2>Itemized issues</h2>
50
- <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>
51
- __issueDetailRows__
52
- <footer>
53
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
54
- </footer>
55
- </main>
56
- </body>
57
- </html>
@@ -1,131 +0,0 @@
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 tsp40.
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/tic40');
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 = 'tdp40';
40
- // Newline with indentations.
41
- const innerJoiner = '\n ';
42
-
43
- // FUNCTIONS
44
-
45
- // Gets a row of the score-summary table.
46
- const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
47
- // Gets a row of the issue-score-summary table.
48
- const getIssueScoreRow = (summary, wcag, score, tools) => {
49
- const toolList = tools.map(tool => `<code>${tool}</code>`).join(', ');
50
- return `<tr><th>${summary}</th><td class="center">${wcag}<td class="right">${score}</td><td>${toolList}</td></tr>`;
51
- };
52
- // Adds parameters to a query for a digest.
53
- const populateQuery = (report, query) => {
54
- const {id, score, sources, target} = report;
55
- const {script, requester} = sources;
56
- const {scoreProcID, summary, details} = score;
57
- query.ts = script;
58
- query.sp = scoreProcID;
59
- query.dp = digesterID;
60
- // Add the job data to the query.
61
- query.dateISO = getNowDate();
62
- query.dateSlash = getNowDateSlash();
63
- query.org = target.what;
64
- query.url = target.which;
65
- query.requester = requester;
66
- query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
67
- // Add values for the score-summary table to the query.
68
- const rows = {
69
- summaryRows: [],
70
- issueRows: []
71
- };
72
- ['total', 'issueCount', 'issue', 'solo', 'tool', 'prevention', 'log', 'latency']
73
- .forEach(sumItem => {
74
- query[sumItem] = summary[sumItem];
75
- rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
76
- });
77
- // Sort the issue IDs in descending score order.
78
- const issueIDs = Object.keys(details.issue);
79
- issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
80
- // Get rows for the issue-score table.
81
- issueIDs.forEach(issueID => {
82
- const {score, tools} = details.issue[issueID];
83
- if (issues[issueID]) {
84
- rows.issueRows.push(
85
- getIssueScoreRow(issues[issueID].summary, issues[issueID].wcag, score, Object.keys(tools))
86
- );
87
- }
88
- else {
89
- console.log(`ERROR: Issue ${issueID} not found`);
90
- }
91
- });
92
- // Add the rows to the query.
93
- ['summaryRows', 'issueRows'].forEach(rowType => {
94
- query[rowType] = rows[rowType].join(innerJoiner);
95
- });
96
- // Add paragraph groups about the issue details to the query.
97
- const issueDetailRows = [];
98
- issueIDs.forEach(issueID => {
99
- issueDetailRows.push(`<h3 class="bars">Issue: ${issues[issueID].summary}</h3>`);
100
- issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
101
- issueDetailRows.push(`<p>WCAG: ${issues[issueID].wcag || 'N/A'}</p>`);
102
- const issueData = details.issue[issueID];
103
- issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
104
- const toolIDs = Object.keys(issueData.tools);
105
- toolIDs.forEach(toolID => {
106
- issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h5>`);
107
- const ruleIDs = Object.keys(issueData.tools[toolID]);
108
- ruleIDs.forEach(ruleID => {
109
- const ruleData = issueData.tools[toolID][ruleID];
110
- issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
111
- issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
112
- issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
113
- });
114
- });
115
- });
116
- query.issueDetailRows = issueDetailRows.join(innerJoiner);
117
- };
118
- // Returns a digested report.
119
- exports.digester = async report => {
120
- // Create a query to replace placeholders.
121
- const query = {};
122
- populateQuery(report, query);
123
- // Get the template.
124
- let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
125
- // Replace its placeholders.
126
- Object.keys(query).forEach(param => {
127
- template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
128
- });
129
- // Return the digest.
130
- return template;
131
- };
@@ -1,59 +0,0 @@
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
- <table class="allBorder">
20
- <caption>Synopsis</caption>
21
- <tr><th>Page</th><td>__org__</td></tr>
22
- <tr><th>URL</th><td>__url__</td></tr>
23
- <tr><th>Requester</th><td>__requester__</td></tr>
24
- <tr><th>Test date</th><td>__dateSlash__</td></tr>
25
- <tr><th>Score</th><td>__total__</td></tr>
26
- <tr><th>Tested by</th><td>Testaro, procedure <code>__ts__</code></td></tr>
27
- <tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
28
- <tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
29
- <tr>
30
- <th>Full report</th>
31
- <td><a href="__reportURL__"><code>__reportURL__</code></a></td>
32
- </tr>
33
- </table>
34
- </header>
35
- <h2>Introduction</h2>
36
- <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>
37
- <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>
38
- <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, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
39
- <h2>Issue summary</h2>
40
- <p>This table shows the issues discovered by one or more tools. When an instance count is 0, that means the tool has a test for the issue but the page passed that test.</p>
41
- <p>Why do instance counts differ among tools? Possibly because the tests are not really equivalent, or a test is unreliable. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</p>
42
- <table class="allBorder thirdCellRight">
43
- <caption>Summary of issues</caption>
44
- <thead>
45
- <tr><th>Issue</th><th>WCAG</th><th>Score</th><th>Instance counts</th></tr>
46
- </thead>
47
- <tbody class="headersLeft">
48
- __issueRows__
49
- </tbody>
50
- </table>
51
- <h2>Itemized issues</h2>
52
- <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>
53
- __issueDetailRows__
54
- <footer>
55
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
56
- </footer>
57
- </main>
58
- </body>
59
- </html>
@@ -1,133 +0,0 @@
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 tsp41.
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/tic41');
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 = 'tdp41';
40
- // Newline with indentations.
41
- const innerJoiner = '\n ';
42
-
43
- // FUNCTIONS
44
-
45
- // Gets a row of the score-summary table.
46
- const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
47
- // Gets a row of the issue-score-summary table.
48
- const getIssueScoreRow = (issueConstants, issueDetails) => {
49
- const {summary, wcag} = issueConstants;
50
- const {instanceCounts, score} = issueDetails;
51
- const toolList = Object
52
- .keys(instanceCounts)
53
- .map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
54
- .join(', ');
55
- return `<tr><th>${summary}</th><td class="center">${wcag}<td class="right num">${score}</td><td>${toolList}</td></tr>`;
56
- };
57
- // Adds parameters to a query for a digest.
58
- const populateQuery = (report, query) => {
59
- const {id, sources, score} = report;
60
- const {script, target, requester} = sources;
61
- const {scoreProcID, summary, details} = score;
62
- query.ts = script;
63
- query.sp = scoreProcID;
64
- query.dp = digesterID;
65
- // Add the job data to the query.
66
- query.dateISO = getNowDate();
67
- query.dateSlash = getNowDateSlash();
68
- query.org = target.what;
69
- query.url = target.which;
70
- query.requester = requester;
71
- query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
72
- // Add values for the score-summary table to the query.
73
- const rows = {
74
- summaryRows: [],
75
- issueRows: []
76
- };
77
- ['total', 'issueCount', 'issue', 'solo', 'tool', 'prevention', 'log', 'latency']
78
- .forEach(sumItem => {
79
- query[sumItem] = summary[sumItem];
80
- rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
81
- });
82
- // Sort the issue IDs in descending score order.
83
- const issueIDs = Object.keys(details.issue);
84
- issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
85
- // Get rows for the issue-score table.
86
- issueIDs.forEach(issueID => {
87
- if (issues[issueID]) {
88
- rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
89
- }
90
- else {
91
- console.log(`ERROR: Issue ${issueID} not found`);
92
- }
93
- });
94
- // Add the rows to the query.
95
- ['summaryRows', 'issueRows'].forEach(rowType => {
96
- query[rowType] = rows[rowType].join(innerJoiner);
97
- });
98
- // Add paragraph groups about the issue details to the query.
99
- const issueDetailRows = [];
100
- issueIDs.forEach(issueID => {
101
- issueDetailRows.push(`<h3 class="bars">Issue: ${issues[issueID].summary}</h3>`);
102
- issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
103
- issueDetailRows.push(`<p>WCAG: ${issues[issueID].wcag || 'N/A'}</p>`);
104
- const issueData = details.issue[issueID];
105
- issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
106
- const toolIDs = Object.keys(issueData.tools);
107
- toolIDs.forEach(toolID => {
108
- issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h5>`);
109
- const ruleIDs = Object.keys(issueData.tools[toolID]);
110
- ruleIDs.forEach(ruleID => {
111
- const ruleData = issueData.tools[toolID][ruleID];
112
- issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
113
- issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
114
- issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
115
- });
116
- });
117
- });
118
- query.issueDetailRows = issueDetailRows.join(innerJoiner);
119
- };
120
- // Returns a digested report.
121
- exports.digester = async report => {
122
- // Create a query to replace placeholders.
123
- const query = {};
124
- populateQuery(report, query);
125
- // Get the template.
126
- let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
127
- // Replace its placeholders.
128
- Object.keys(query).forEach(param => {
129
- template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
130
- });
131
- // Return the digest.
132
- return template;
133
- };
@@ -1,60 +0,0 @@
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
- <table class="allBorder">
20
- <caption>Synopsis</caption>
21
- <tr><th>Page</th><td>__org__</td></tr>
22
- <tr><th>URL</th><td>__url__</td></tr>
23
- <tr><th>Requester</th><td>__requester__</td></tr>
24
- <tr><th>Device</th><td>__device__</td></tr>
25
- <tr><th>Test date</th><td>__dateSlash__</td></tr>
26
- <tr><th>Score</th><td>__total__</td></tr>
27
- <tr><th>Tested by</th><td>Testaro, procedure <code>__ts__</code></td></tr>
28
- <tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
29
- <tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
30
- <tr>
31
- <th>Full report</th>
32
- <td><a href="__reportURL__"><code>__reportURL__</code></a></td>
33
- </tr>
34
- </table>
35
- </header>
36
- <h2>Introduction</h2>
37
- <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>
38
- <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>
39
- <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>
40
- <h2>Issue summary</h2>
41
- <p>This table shows the issues discovered by one or more tools. When an instance count is 0, that means the tool has a test for the issue but the page passed that test.</p>
42
- <p>Why do instance counts differ among tools? Possibly because the tests are not really equivalent, or a test is unreliable. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</p>
43
- <table class="allBorder thirdCellRight">
44
- <caption>Summary of issues</caption>
45
- <thead>
46
- <tr><th>Issue</th><th>WCAG</th><th>Score</th><th>Instance counts</th></tr>
47
- </thead>
48
- <tbody class="headersLeft">
49
- __issueRows__
50
- </tbody>
51
- </table>
52
- <h2>Itemized issues</h2>
53
- <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>
54
- __issueDetailRows__
55
- <footer>
56
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
57
- </footer>
58
- </main>
59
- </body>
60
- </html>
@@ -1,146 +0,0 @@
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 tsp42.
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/tic41');
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 = 'tdp42';
40
- // Newline with indentations.
41
- const innerJoiner = '\n ';
42
-
43
- // FUNCTIONS
44
-
45
- // Gets a row of the score-summary table.
46
- const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
47
- // Gets a row of the issue-score-summary table.
48
- const getIssueScoreRow = (issueConstants, issueDetails) => {
49
- const {summary, wcag} = issueConstants;
50
- const {instanceCounts, score} = issueDetails;
51
- const toolList = Object
52
- .keys(instanceCounts)
53
- .map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
54
- .join(', ');
55
- return `<tr><th>${summary}</th><td class="center">${wcag}<td class="right num">${score}</td><td>${toolList}</td></tr>`;
56
- };
57
- // Adds parameters to a query for a digest.
58
- const populateQuery = (report, query) => {
59
- const {acts, id, sources, score} = report;
60
- const {script, target, requester} = sources;
61
- const {scoreProcID, summary, details} = score;
62
- query.ts = script;
63
- query.sp = scoreProcID;
64
- query.dp = digesterID;
65
- // Add the job data to the query.
66
- query.dateISO = getNowDate();
67
- query.dateSlash = getNowDateSlash();
68
- query.org = target.what;
69
- query.url = target.which;
70
- query.requester = requester;
71
- const firstLaunch = acts.find(act => act.type === 'launch');
72
- if (firstLaunch) {
73
- query.device = firstLaunch.deviceID || 'unknown';
74
- }
75
- else {
76
- query.device = 'unknown';
77
- }
78
- query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
79
- // Add values for the score-summary table to the query.
80
- const rows = {
81
- summaryRows: [],
82
- issueRows: []
83
- };
84
- ['total', 'issueCount', 'issue', 'solo', 'tool', 'element', 'prevention', 'log', 'latency']
85
- .forEach(sumItem => {
86
- query[sumItem] = summary[sumItem];
87
- rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
88
- });
89
- // Sort the issue IDs in descending score order.
90
- const issueIDs = Object.keys(details.issue);
91
- issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
92
- // Get rows for the issue-score table.
93
- issueIDs.forEach(issueID => {
94
- if (issues[issueID]) {
95
- rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
96
- }
97
- else {
98
- console.log(`ERROR: Issue ${issueID} not found`);
99
- }
100
- });
101
- // Add the rows to the query.
102
- ['summaryRows', 'issueRows'].forEach(rowType => {
103
- query[rowType] = rows[rowType].join(innerJoiner);
104
- });
105
- // Add paragraph groups about the issue details to the query.
106
- const issueDetailRows = [];
107
- issueIDs.forEach(issueID => {
108
- const issueSummary = issues[issueID].summary;
109
- issueDetailRows.push(`<h3 class="bars">Issue: ${issueSummary}</h3>`);
110
- issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
111
- issueDetailRows.push(`<p>WCAG: ${issues[issueID].wcag || 'N/A'}</p>`);
112
- const issueData = details.issue[issueID];
113
- issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
114
- const toolIDs = Object.keys(issueData.tools);
115
- toolIDs.forEach(toolID => {
116
- issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h4>`);
117
- const ruleIDs = Object.keys(issueData.tools[toolID]);
118
- ruleIDs.forEach(ruleID => {
119
- const ruleData = issueData.tools[toolID][ruleID];
120
- issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
121
- issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
122
- issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
123
- const href = `${query.reportURL}?tool=${toolID}&rule=${ruleID}`;
124
- const detailLabel = `Issue ${issueSummary} tool ${toolID} rule ${ruleID} instance details`;
125
- issueDetailRows.push(
126
- `<p><a href="${href}" aria-label="${detailLabel}">Instance details</a></p>`
127
- );
128
- });
129
- });
130
- });
131
- query.issueDetailRows = issueDetailRows.join(innerJoiner);
132
- };
133
- // Returns a digested report.
134
- exports.digester = async report => {
135
- // Create a query to replace placeholders.
136
- const query = {};
137
- populateQuery(report, query);
138
- // Get the template.
139
- let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
140
- // Replace its placeholders.
141
- Object.keys(query).forEach(param => {
142
- template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
143
- });
144
- // Return the digest.
145
- return template;
146
- };
@@ -1,60 +0,0 @@
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
- <table class="allBorder">
20
- <caption>Synopsis</caption>
21
- <tr><th>Page</th><td>__org__</td></tr>
22
- <tr><th>URL</th><td>__url__</td></tr>
23
- <tr><th>Requester</th><td>__requester__</td></tr>
24
- <tr><th>Device</th><td>__device__</td></tr>
25
- <tr><th>Test date</th><td>__dateSlash__</td></tr>
26
- <tr><th>Score</th><td>__total__</td></tr>
27
- <tr><th>Tested by</th><td>Testaro, procedure <code>__ts__</code></td></tr>
28
- <tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
29
- <tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
30
- <tr>
31
- <th>Full report</th>
32
- <td><a href="__reportURL__"><code>__reportURL__</code></a></td>
33
- </tr>
34
- </table>
35
- </header>
36
- <h2>Introduction</h2>
37
- <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>
38
- <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>
39
- <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>
40
- <h2>Issue summary</h2>
41
- <p>This table shows the issues discovered by one or more tools. When an instance count is 0, that means the tool has a test for the issue but the page passed that test.</p>
42
- <p>Why do instance counts differ among tools? Possibly because the tests are not really equivalent, or a test is unreliable. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</p>
43
- <table class="allBorder thirdCellRight">
44
- <caption>Summary of issues</caption>
45
- <thead>
46
- <tr><th>Issue</th><th>WCAG</th><th>Score</th><th>Instance counts</th></tr>
47
- </thead>
48
- <tbody class="headersLeft">
49
- __issueRows__
50
- </tbody>
51
- </table>
52
- <h2>Itemized issues</h2>
53
- <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>
54
- __issueDetailRows__
55
- <footer>
56
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
57
- </footer>
58
- </main>
59
- </body>
60
- </html>