testilo 33.4.0 → 33.5.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/README.md +4 -10
- package/compare.js +4 -2
- package/package.json +1 -1
- package/procs/compare/tcp40/index.js +2 -2
- package/procs/digest/tdp40/index.js +1 -1
- package/procs/digest/tdp41/index.html +59 -0
- package/procs/digest/tdp41/index.js +111 -0
- package/procs/score/tic41.js +8732 -0
- package/reconcile.js +18 -0
- package/reports/digested/style.css +9 -0
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Testilo can, however, make job preparation more efficient in these scenarios:
|
|
|
58
58
|
|
|
59
59
|
### Target lists
|
|
60
60
|
|
|
61
|
-
The simplest version of a list of targets is a _target list_. It is an array of arrays defining 1 or more targets.
|
|
61
|
+
The simplest version of a list of targets is a _target list_. It is an array of arrays defining 1 or more targets.
|
|
62
62
|
|
|
63
63
|
A target is defined by 2 items:
|
|
64
64
|
- A description
|
|
@@ -73,12 +73,7 @@ For example, a target list might be:
|
|
|
73
73
|
]
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```text
|
|
79
|
-
World Wide Web Consortium|https://www.w3.org/
|
|
80
|
-
Mozilla Foundation|https://foundation.mozilla.org/en/
|
|
81
|
-
```
|
|
76
|
+
A target list can be represented by a text file, in which each target is specified on a line with a Tab character delimiting its description and its URL, which are not quoted.
|
|
82
77
|
|
|
83
78
|
### Batches
|
|
84
79
|
|
|
@@ -791,7 +786,7 @@ When a user invokes `summarize` in this example, the `call` module:
|
|
|
791
786
|
- gets all the reports in the `scored` subdirectory of the `REPORTDIR` directory, or (if the third argument is present) all those whose file names begin with `2411`.
|
|
792
787
|
- creates a summary of each report.
|
|
793
788
|
- combines the summaries into an array.
|
|
794
|
-
- creates a _summary report_, an object containing three properties: an ID, a description
|
|
789
|
+
- creates a _summary report_, an object containing three properties: `id` (an ID), `what` (a description, such as `'divisions'`), and `summaries` (the array of summaries).
|
|
795
790
|
- writes the summary report in JSON format to the `summarized` subdirectory of the `REPORTDIR` directory, using the ID as the base of the file name.
|
|
796
791
|
|
|
797
792
|
#### Summary reports
|
|
@@ -917,8 +912,7 @@ A module can invoke `credit()` in this way:
|
|
|
917
912
|
```javaScript
|
|
918
913
|
const {credit} = require('testilo/credit');
|
|
919
914
|
const reportScores = […];
|
|
920
|
-
credit('June 2025', reportScores)
|
|
921
|
-
.then(creditReport => {…});
|
|
915
|
+
const creditReport = credit('June 2025', reportScores);
|
|
922
916
|
```
|
|
923
917
|
|
|
924
918
|
The first argument to `credit()` is a description to be included in the credit report. The second argument is an array of `score` properties of scored report objects. The `credit()` function returns a credit report. The invoking module can further dispose of the credit report as needed.
|
package/compare.js
CHANGED
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ const getMaxScore = summaryReport => summaryReport.summaries.reduce(
|
|
|
21
21
|
(max, result) => Math.max(max, result.score), 0
|
|
22
22
|
);
|
|
23
23
|
// Converts summary report data to a table body.
|
|
24
|
-
const getTableBody = async summaryReport => {
|
|
24
|
+
const getTableBody = exports.getTableBody = async summaryReport => {
|
|
25
25
|
const maxScore = getMaxScore(summaryReport);
|
|
26
26
|
const rows = summaryReport.summaries
|
|
27
27
|
.sort((a, b) => a.score - b.score)
|
|
@@ -39,7 +39,7 @@ const getTableBody = async summaryReport => {
|
|
|
39
39
|
return rows.join(innestJoiner);
|
|
40
40
|
};
|
|
41
41
|
// Populates a query for a comparative table.
|
|
42
|
-
const populateQuery = async (id, what, summaryReport, query) => {
|
|
42
|
+
const populateQuery = exports.populateQuery = async (id, what, summaryReport, query) => {
|
|
43
43
|
query.id = id;
|
|
44
44
|
query.what = what;
|
|
45
45
|
query.pageCount = summaryReport.summaries.length;
|
|
@@ -29,7 +29,7 @@ const getIssueScoreRow = (summary, wcag, score, tools) => {
|
|
|
29
29
|
};
|
|
30
30
|
// Adds parameters to a query for a digest.
|
|
31
31
|
const populateQuery = (report, query) => {
|
|
32
|
-
const {id, sources,
|
|
32
|
+
const {id, sources, score} = report;
|
|
33
33
|
const {script, target, requester} = sources;
|
|
34
34
|
const {scoreProcID, summary, details} = score;
|
|
35
35
|
query.ts = script;
|
|
@@ -0,0 +1,59 @@
|
|
|
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>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// index: digester for scoring procedure tsp40.
|
|
2
|
+
|
|
3
|
+
// IMPORTS
|
|
4
|
+
|
|
5
|
+
// Module to keep secrets.
|
|
6
|
+
require('dotenv').config();
|
|
7
|
+
// Module to classify tool rules into issues
|
|
8
|
+
const {issues} = require('../../score/tic40');
|
|
9
|
+
// Module to process files.
|
|
10
|
+
const fs = require('fs/promises');
|
|
11
|
+
// Utility module.
|
|
12
|
+
const {getNowDate, getNowDateSlash} = require('../../util');
|
|
13
|
+
|
|
14
|
+
// CONSTANTS
|
|
15
|
+
|
|
16
|
+
// Digester ID.
|
|
17
|
+
const digesterID = 'tdp41';
|
|
18
|
+
// Newline with indentations.
|
|
19
|
+
const innerJoiner = '\n ';
|
|
20
|
+
|
|
21
|
+
// FUNCTIONS
|
|
22
|
+
|
|
23
|
+
// Gets a row of the score-summary table.
|
|
24
|
+
const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
|
|
25
|
+
// Gets a row of the issue-score-summary table.
|
|
26
|
+
const getIssueScoreRow = (issueConstants, issueDetails) => {
|
|
27
|
+
const {summary, wcag} = issueConstants;
|
|
28
|
+
const {instanceCounts, score} = issueDetails;
|
|
29
|
+
const toolList = Object
|
|
30
|
+
.keys(instanceCounts)
|
|
31
|
+
.map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
|
|
32
|
+
.join(', ');
|
|
33
|
+
return `<tr><th>${summary}</th><td class="center">${wcag}<td class="right num">${score}</td><td>${toolList}</td></tr>`;
|
|
34
|
+
};
|
|
35
|
+
// Adds parameters to a query for a digest.
|
|
36
|
+
const populateQuery = (report, query) => {
|
|
37
|
+
const {id, sources, score} = report;
|
|
38
|
+
const {script, target, requester} = sources;
|
|
39
|
+
const {scoreProcID, summary, details} = score;
|
|
40
|
+
query.ts = script;
|
|
41
|
+
query.sp = scoreProcID;
|
|
42
|
+
query.dp = digesterID;
|
|
43
|
+
// Add the job data to the query.
|
|
44
|
+
query.dateISO = getNowDate();
|
|
45
|
+
query.dateSlash = getNowDateSlash();
|
|
46
|
+
query.org = target.what;
|
|
47
|
+
query.url = target.which;
|
|
48
|
+
query.requester = requester;
|
|
49
|
+
query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
|
|
50
|
+
// Add values for the score-summary table to the query.
|
|
51
|
+
const rows = {
|
|
52
|
+
summaryRows: [],
|
|
53
|
+
issueRows: []
|
|
54
|
+
};
|
|
55
|
+
['total', 'issueCount', 'issue', 'solo', 'tool', 'prevention', 'log', 'latency']
|
|
56
|
+
.forEach(sumItem => {
|
|
57
|
+
query[sumItem] = summary[sumItem];
|
|
58
|
+
rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
|
|
59
|
+
});
|
|
60
|
+
// Sort the issue IDs in descending score order.
|
|
61
|
+
const issueIDs = Object.keys(details.issue);
|
|
62
|
+
issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
|
|
63
|
+
// Get rows for the issue-score table.
|
|
64
|
+
issueIDs.forEach(issueID => {
|
|
65
|
+
if (issues[issueID]) {
|
|
66
|
+
rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.log(`ERROR: Issue ${issueID} not found`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
// Add the rows to the query.
|
|
73
|
+
['summaryRows', 'issueRows'].forEach(rowType => {
|
|
74
|
+
query[rowType] = rows[rowType].join(innerJoiner);
|
|
75
|
+
});
|
|
76
|
+
// Add paragraph groups about the issue details to the query.
|
|
77
|
+
const issueDetailRows = [];
|
|
78
|
+
issueIDs.forEach(issueID => {
|
|
79
|
+
issueDetailRows.push(`<h3 class="bars">Issue: ${issues[issueID].summary}</h3>`);
|
|
80
|
+
issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
|
|
81
|
+
issueDetailRows.push(`<p>WCAG: ${issues[issueID].wcag || 'N/A'}</p>`);
|
|
82
|
+
const issueData = details.issue[issueID];
|
|
83
|
+
issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
|
|
84
|
+
const toolIDs = Object.keys(issueData.tools);
|
|
85
|
+
toolIDs.forEach(toolID => {
|
|
86
|
+
issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h5>`);
|
|
87
|
+
const ruleIDs = Object.keys(issueData.tools[toolID]);
|
|
88
|
+
ruleIDs.forEach(ruleID => {
|
|
89
|
+
const ruleData = issueData.tools[toolID][ruleID];
|
|
90
|
+
issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
|
|
91
|
+
issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
|
|
92
|
+
issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
query.issueDetailRows = issueDetailRows.join(innerJoiner);
|
|
97
|
+
};
|
|
98
|
+
// Returns a digested report.
|
|
99
|
+
exports.digester = async report => {
|
|
100
|
+
// Create a query to replace placeholders.
|
|
101
|
+
const query = {};
|
|
102
|
+
populateQuery(report, query);
|
|
103
|
+
// Get the template.
|
|
104
|
+
let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
|
|
105
|
+
// Replace its placeholders.
|
|
106
|
+
Object.keys(query).forEach(param => {
|
|
107
|
+
template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
|
|
108
|
+
});
|
|
109
|
+
// Return the digest.
|
|
110
|
+
return template;
|
|
111
|
+
};
|