testilo 10.3.1 → 11.0.2

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.
Files changed (72) hide show
  1. package/README.md +215 -188
  2. package/batch.js +64 -0
  3. package/call.js +29 -4
  4. package/compare.js +2 -2
  5. package/merge.js +1 -7
  6. package/package.json +1 -1
  7. package/procs/compare/cp20sqrt/index.js +7 -10
  8. package/procs/compare/{cp15b → tcp24}/index.html +5 -5
  9. package/procs/compare/{cp12a → tcp24}/index.js +13 -20
  10. package/procs/score/tic25.js +1 -1
  11. package/procs/score/{tic24.js → tic26.js} +205 -199
  12. package/procs/score/tsp24.js +9 -3
  13. package/procs/score/tsp26.js +120 -0
  14. package/score.js +2 -8
  15. package/procs/compare/cp0/index.html +0 -46
  16. package/procs/compare/cp0/index.js +0 -70
  17. package/procs/compare/cp1/index.html +0 -46
  18. package/procs/compare/cp1/index.js +0 -71
  19. package/procs/compare/cp12a/index.html +0 -47
  20. package/procs/compare/cp12b/index.html +0 -47
  21. package/procs/compare/cp12b/index.js +0 -71
  22. package/procs/compare/cp14a/index.html +0 -47
  23. package/procs/compare/cp14a/index.js +0 -71
  24. package/procs/compare/cp15a/index.html +0 -47
  25. package/procs/compare/cp15a/index.js +0 -71
  26. package/procs/compare/cp15b/index.js +0 -74
  27. package/procs/compare/cp16a/index.html +0 -47
  28. package/procs/compare/cp16a/index.js +0 -74
  29. package/procs/compare/cp16b/index.html +0 -47
  30. package/procs/compare/cp16b/index.js +0 -74
  31. package/procs/digest/dp10a/index.html +0 -137
  32. package/procs/digest/dp10a/index.js +0 -402
  33. package/procs/digest/dp10b/index.html +0 -74
  34. package/procs/digest/dp10b/index.js +0 -130
  35. package/procs/digest/dp10c/index.html +0 -55
  36. package/procs/digest/dp10c/index.js +0 -129
  37. package/procs/digest/dp11a/index.html +0 -76
  38. package/procs/digest/dp11a/index.js +0 -127
  39. package/procs/digest/dp12a/index.html +0 -78
  40. package/procs/digest/dp12a/index.js +0 -126
  41. package/procs/digest/dp12b/index.html +0 -78
  42. package/procs/digest/dp12b/index.js +0 -126
  43. package/procs/digest/dp13a/index.html +0 -78
  44. package/procs/digest/dp13a/index.js +0 -126
  45. package/procs/digest/dp14a/index.html +0 -79
  46. package/procs/digest/dp14a/index.js +0 -126
  47. package/procs/digest/dp15a/index.html +0 -80
  48. package/procs/digest/dp15a/index.js +0 -126
  49. package/procs/digest/dp16a/index.html +0 -80
  50. package/procs/digest/dp16a/index.js +0 -126
  51. package/procs/digest/dp16b/index.html +0 -80
  52. package/procs/digest/dp16b/index.js +0 -126
  53. package/procs/digest/dp18a/index.html +0 -80
  54. package/procs/digest/dp18a/index.js +0 -129
  55. package/procs/digest/dp20c/index.html +0 -54
  56. package/procs/digest/dp20c/index.js +0 -117
  57. package/procs/digest/dp20d/index.html +0 -54
  58. package/procs/digest/dp20d/index.js +0 -121
  59. package/procs/digest/tdp09a/index.html +0 -126
  60. package/procs/digest/tdp09a/index.js +0 -381
  61. package/procs/digest/tdp22/index.html +0 -54
  62. package/procs/digest/tdp22/index.js +0 -120
  63. package/procs/score/tic21.js +0 -6868
  64. package/procs/score/tic22.js +0 -6911
  65. package/procs/score/tic23.js +0 -6924
  66. package/procs/score/tsp21.js +0 -720
  67. package/procs/score/tsp22.js +0 -720
  68. package/procs/score/tsp23.js +0 -720
  69. package/specs/batches/orgs.json +0 -43
  70. package/specs/scripts/ts21.json +0 -213
  71. package/specs/scripts/ts23.json +0 -219
  72. package/specs/scripts/ts24.json +0 -225
@@ -1,8 +1,8 @@
1
1
  /*
2
- tsp23
2
+ tsp24
3
3
  Testilo score proc 24
4
4
 
5
- Computes scores from Testilo script ts23 and adds them to a report.
5
+ Computes scores from Testilo script ts23 or ts24 and adds them to a report.
6
6
  */
7
7
 
8
8
  // IMPORTS
@@ -105,6 +105,12 @@ exports.scorer = async report => {
105
105
  if (testActs.length) {
106
106
  // For each test act:
107
107
  testActs.forEach(test => {
108
+ // Add a prevented result if no result exists.
109
+ if (! test.result) {
110
+ test.result = {
111
+ prevented: true
112
+ };
113
+ }
108
114
  const {which} = test;
109
115
  // Add scores to the tool details.
110
116
  if (which === 'alfa') {
@@ -483,7 +489,7 @@ exports.scorer = async report => {
483
489
  changeFrequency
484
490
  } = data;
485
491
  const score = 2 * (meanLocalRatio - 1)
486
- + (maxLocalRatio - 1)
492
+ + maxLocalRatio - 1
487
493
  + globalRatio - 1
488
494
  + meanPixelChange / 10000
489
495
  + maxPixelChange / 25000
@@ -0,0 +1,120 @@
1
+ /*
2
+ tsp26
3
+ Testilo score proc 26
4
+
5
+ Computes scores from Testilo script ts26 and adds them to a report.
6
+ */
7
+
8
+ // IMPORTS
9
+
10
+ const {issues} = require('./tic26');
11
+
12
+ // CONSTANTS
13
+
14
+ // ID of this proc.
15
+ const scoreProcID = 'tsp26';
16
+ // Configuration disclosures.
17
+ const severityWeights = [1, 2, 3, 4];
18
+ const logWeights = {
19
+ logCount: 0.5,
20
+ logSize: 0.01,
21
+ errorLogCount: 1,
22
+ errorLogSize: 0.02,
23
+ prohibitedCount: 15,
24
+ visitRejectionCount: 10
25
+ };
26
+ const latencyWeight = 1;
27
+ // Normal latency (1.5 second per visit).
28
+ const normalLatency = 20;
29
+ // How much each prevention adds to the score.
30
+ const preventionWeight = 100;
31
+
32
+ // VARIABLES
33
+
34
+ let summary = {};
35
+ let preventionScores = {};
36
+
37
+ // FUNCTIONS
38
+
39
+ // Scores a report.
40
+ exports.scorer = async report => {
41
+ // Initialize the score.
42
+ report.score = {
43
+ scoreProcID,
44
+ summary: {
45
+ total: 0,
46
+ tools: 0,
47
+ preventions: 0,
48
+ log: 0,
49
+ latency: 0
50
+ },
51
+ toolTotals: [],
52
+ tools: {},
53
+ preventions: {}
54
+ };
55
+ // If there are any acts in the report:
56
+ const {acts} = report;
57
+ if (Array.isArray(acts) && acts.length) {
58
+ // If any of them are test acts:
59
+ const testActs = acts.filter(act => act.type === 'test');
60
+ if (testActs.length) {
61
+ // Initialize a report score.
62
+ report.score = {
63
+ tools: {},
64
+ total: 0
65
+ };
66
+ const {score} = report;
67
+ const {summary} = score;
68
+ // For each test act:
69
+ testActs.forEach(act => {
70
+ // If a result with totals exists:
71
+ const {which} = act;
72
+ if (act.result && act.result.totals && act.result.totals.length === 4) {
73
+ // Add the tool totals to the score.
74
+ const {totals} = act.result;
75
+ score.tools[which] = totals;
76
+ score.toolTotals.forEach((total, index) => {
77
+ score.toolTotals[index] += totals[index];
78
+ summary.tools += totals[index] * severityWeights[index];
79
+ });
80
+ }
81
+ // Otherwise, i.e. if no result with totals exists:
82
+ else {
83
+ // Add a prevented result to the act if not already there.
84
+ if (! act.result) {
85
+ act.result = {};
86
+ }
87
+ if (! act.result.prevented) {
88
+ act.result.prevented = true;
89
+ };
90
+ // Add the tool and the prevention score to the score.
91
+ report.score.preventions[which] = preventionWeight;
92
+ report.score.preventions += preventionWeight;
93
+ }
94
+ });
95
+ // Add the log score to the score.
96
+ const {jobData} = report;
97
+ summary.log = Math.max(0, Math.round(
98
+ logWeights.logCount * jobData.logCount
99
+ + logWeights.logSize * jobData.logSize +
100
+ + logWeights.errorLogCount * jobData.errorLogCount
101
+ + logWeights.errorLogSize * jobData.errorLogSize
102
+ + logWeights.prohibitedCount * jobData.prohibitedCount +
103
+ + logWeights.visitRejectionCount * jobData.visitRejectionCount
104
+ ));
105
+ summary.latency = Math.round(latencyWeight * (jobData.visitLatency - normalLatency));
106
+ // Add the total score to the score.
107
+ summary.total = summary.tools + summary.preventions + summary.log + summary.latency;
108
+ }
109
+ // Otherwise, i.e. if none of them is a test act:
110
+ else {
111
+ // Report this.
112
+ console.log('ERROR: No test acts');
113
+ }
114
+ }
115
+ // Otherwise, i.e. if there are no acts in the report:
116
+ else {
117
+ // Report this.
118
+ console.log('ERROR: No acts');
119
+ }
120
+ };
package/score.js CHANGED
@@ -8,19 +8,13 @@
8
8
 
9
9
  // ########## FUNCTIONS
10
10
 
11
- // Scores the specified raw reports and returns them, scored.
11
+ // Scores the specified raw reports.
12
12
  exports.score = (scorer, reports) => {
13
- const scoredReports = [];
14
13
  // For each report:
15
14
  for (const report of reports) {
16
15
  // Score it.
17
- const scoredReport = JSON.parse(JSON.stringify(report));
18
- scorer(scoredReport);
19
- // Append it to the array of scored reports.
20
- scoredReports.push(scoredReport);
16
+ scorer(report);
21
17
  console.log(`Report ${report.id} scored`);
22
18
  }
23
- // Return the array of scored reports.
24
19
  console.log(`Scoring complete; report count ${reports.length}`);
25
- return scoredReports;
26
20
  };
@@ -1,46 +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="comparison of accessibility scores from tsp10 procedure">
10
- <meta name="keywords" content="accessibility a11y web testing">
11
- <title>Accessibility score comparison</title>
12
- <link rel="icon" href="favicon.png">
13
- <link rel="stylesheet" href="style.css">
14
- </head>
15
- <body>
16
- <main>
17
- <header>
18
- <h1>Accessibility score comparison</h1>
19
- </header>
20
- <h2>Introduction</h2>
21
- <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
- <p>The pages were:</p>
23
- <div id="summary">
24
- <p>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp10</code></p>
25
- <p>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp10a</code></p>
26
- <p>Digested by Testilo with procedure <code>dp10a</code></p>
27
- <p>Compared by Testilo with procedure <code>cp0</code></p>
28
- </div>
29
- <p>The <code>tp10</code> procedure performs 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
31
- <h2>Comparison</h2>
32
- <table class="allBorder">
33
- <caption>Accessibility scores of web pages</caption>
34
- <thead>
35
- <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
36
- </thead>
37
- <tbody class="linkSmaller secondCellRight">
38
- __tableBody__
39
- </tbody>
40
- </table>
41
- <footer>
42
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
43
- </footer>
44
- </main>
45
- </body>
46
- </html>
@@ -1,70 +0,0 @@
1
- /*
2
- ttp0.js
3
- Returns a query for an HTML page including a bar-graph table.
4
- */
5
-
6
- // ########## IMPORTS
7
-
8
- // Module to keep secrets local.
9
- require('dotenv').config();
10
- // Module to access files.
11
- const fs = require('fs/promises');
12
-
13
- // ########## CONSTANTS
14
-
15
- const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
16
- const query = {};
17
-
18
- // ########## FUNCTIONS
19
-
20
- // Gets data on the hosts and their scores and adds query parameter.
21
- const getData = async () => {
22
- const reportDirAbs = `${__dirname}/../../../${reportDirScored}`;
23
- const reportFileNamesAll = await fs.readdir(reportDirAbs);
24
- const reportFileNamesSource = reportFileNamesAll.filter(fileName => fileName.endsWith('.json'));
25
- const pageCount = reportFileNamesSource.length;
26
- const bodyData = [];
27
- for (const fileName of reportFileNamesSource) {
28
- const fileJSON = await fs.readFile(`${reportDirAbs}/${fileName}`, 'utf8');
29
- const file = JSON.parse(fileJSON);
30
- const {id, host, score} = file;
31
- bodyData.push({
32
- id,
33
- host,
34
- score: score.scores.total
35
- });
36
- };
37
- return {
38
- pageCount,
39
- bodyData
40
- }
41
- };
42
- // Gets the maximum score.
43
- const getMaxScore = tableData => tableData.reduce((max, item) => Math.max(max, item.score), 0);
44
- // Converts report data to a table body.
45
- const getTableBody = async bodyData => {
46
- const maxScore = getMaxScore(bodyData);
47
- const rows = bodyData
48
- .sort((a, b) => a.score - b.score)
49
- .map(item => {
50
- const {id, host, score} = item;
51
- const pageCell = `<th scope="row"><a href="${host.which}">${host.what}</a></th>`;
52
- const numCell = `<td><a href="digests/${id}.html">${score}</a></td>`;
53
- const barWidth = 100 * score / maxScore;
54
- const bar = `<rect height="100%" width="${barWidth}%" fill="red"></rect>`;
55
- const barCell = `<td aria-hidden="true"><svg width="100%" height="0.7em">${bar}</svg></td>`;
56
- const row = `<tr>${pageCell}${numCell}${barCell}</tr>`;
57
- return row;
58
- });
59
- return rows.join('\n ');
60
- };
61
- // Returns a query for a comparative table.
62
- exports.getQuery = async () => {
63
- const data = await getData();
64
- query.pageCount = data.pageCount;
65
- query.tableBody = await getTableBody(data.bodyData);
66
- const date = new Date();
67
- query.dateISO = date.toISOString().slice(0, 10);
68
- query.dateSlash = query.dateISO.replace(/-/g, '/');
69
- return query;
70
- };
@@ -1,46 +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="comparison of accessibility scores">
10
- <meta name="keywords" content="accessibility a11y web testing">
11
- <title>Accessibility score comparison</title>
12
- <link rel="icon" href="favicon.png">
13
- <link rel="stylesheet" href="style.css">
14
- </head>
15
- <body>
16
- <main>
17
- <header>
18
- <h1>Accessibility score comparison</h1>
19
- </header>
20
- <h2>Introduction</h2>
21
- <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
- <p>The pages were:</p>
23
- <div id="summary">
24
- <p>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a></p>
25
- <p>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp10c</code></p>
26
- <p>Digested by Testilo with procedure <code>dp10c</code></p>
27
- <p>Compared by Testilo with procedure <code>cp1</code></p>
28
- </div>
29
- <p>The Testaro procedure performs about 600 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
31
- <h2>Comparison</h2>
32
- <table class="allBorder">
33
- <caption>Accessibility scores of web pages</caption>
34
- <thead>
35
- <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
36
- </thead>
37
- <tbody class="linkSmaller secondCellRight">
38
- __tableBody__
39
- </tbody>
40
- </table>
41
- <footer>
42
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
43
- </footer>
44
- </main>
45
- </body>
46
- </html>
@@ -1,71 +0,0 @@
1
- /*
2
- cp1.js
3
- Returns a query for an HTML page including a bar-graph table.
4
- */
5
-
6
- // ########## IMPORTS
7
-
8
- // Module to keep secrets local.
9
- require('dotenv').config();
10
- // Module to access files.
11
- const fs = require('fs/promises');
12
-
13
- // ########## CONSTANTS
14
-
15
- const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
16
- const query = {};
17
-
18
- // ########## FUNCTIONS
19
-
20
- // Gets data on the hosts and their scores and adds query parameter.
21
- const getData = async () => {
22
- const reportDirAbs = `${__dirname}/../../../${reportDirScored}`;
23
- const reportFileNamesAll = await fs.readdir(reportDirAbs);
24
- const reportFileNamesSource = reportFileNamesAll.filter(fileName => fileName.endsWith('.json'));
25
- const pageCount = reportFileNamesSource.length;
26
- const bodyData = [];
27
- for (const fileName of reportFileNamesSource) {
28
- const fileJSON = await fs.readFile(`${reportDirAbs}/${fileName}`, 'utf8');
29
- const file = JSON.parse(fileJSON);
30
- const {id, script, score} = file;
31
- bodyData.push({
32
- id,
33
- org: script.what,
34
- url: script.commands.find(command => command.type === 'url').which,
35
- score: score.summary.total
36
- });
37
- };
38
- return {
39
- pageCount,
40
- bodyData
41
- }
42
- };
43
- // Gets the maximum score.
44
- const getMaxScore = tableData => tableData.reduce((max, item) => Math.max(max, item.score), 0);
45
- // Converts report data to a table body.
46
- const getTableBody = async bodyData => {
47
- const maxScore = getMaxScore(bodyData);
48
- const rows = bodyData
49
- .sort((a, b) => a.score - b.score)
50
- .map(item => {
51
- const {id, org, url, score} = item;
52
- const pageCell = `<th scope="row"><a href="${url}">${org}</a></th>`;
53
- const numCell = `<td><a href="digests/${id}.html">${score}</a></td>`;
54
- const barWidth = 100 * score / maxScore;
55
- const bar = `<rect height="100%" width="${barWidth}%" fill="red"></rect>`;
56
- const barCell = `<td aria-hidden="true"><svg width="100%" height="0.7em">${bar}</svg></td>`;
57
- const row = `<tr>${pageCell}${numCell}${barCell}</tr>`;
58
- return row;
59
- });
60
- return rows.join('\n ');
61
- };
62
- // Returns a query for a comparative table.
63
- exports.getQuery = async () => {
64
- const data = await getData();
65
- query.pageCount = data.pageCount;
66
- query.tableBody = await getTableBody(data.bodyData);
67
- const date = new Date();
68
- query.dateISO = date.toISOString().slice(0, 10);
69
- query.dateSlash = query.dateISO.replace(/-/g, '/');
70
- return query;
71
- };
@@ -1,47 +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="comparison of accessibility scores">
10
- <meta name="keywords" content="accessibility a11y web testing">
11
- <title>Accessibility score comparison</title>
12
- <link rel="icon" href="favicon.png">
13
- <link rel="stylesheet" href="style.css">
14
- </head>
15
- <body>
16
- <main>
17
- <header>
18
- <h1>Accessibility score comparison</h1>
19
- </header>
20
- <h2>Introduction</h2>
21
- <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
- <p>The pages were:</p>
23
- <ol id="summary">
24
- <li>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp12</code></li>
25
- <li>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp12a</code></li>
26
- <li>Digested by Testilo with procedure <code>dp12a</code></li>
27
- <li>Compared by Testilo with procedure <code>cp12a</code></li>
28
- </ol>
29
- <p>The Testaro procedure performs 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
- <h2>Comparison</h2>
31
- <table class="allBorder">
32
- <caption>Accessibility scores of web pages</caption>
33
- <thead>
34
- <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
35
- </thead>
36
- <tbody class="linkSmaller secondCellRight">
37
- __tableBody__
38
- </tbody>
39
- </table>
40
- <h2>Discussion</h2>
41
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults are not detectable with these tests. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
42
- <footer>
43
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
44
- </footer>
45
- </main>
46
- </body>
47
- </html>
@@ -1,47 +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="comparison of accessibility scores">
10
- <meta name="keywords" content="accessibility a11y web testing">
11
- <title>Accessibility score comparison</title>
12
- <link rel="icon" href="favicon.png">
13
- <link rel="stylesheet" href="style.css">
14
- </head>
15
- <body>
16
- <main>
17
- <header>
18
- <h1>Accessibility score comparison</h1>
19
- </header>
20
- <h2>Introduction</h2>
21
- <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
- <p>The pages were:</p>
23
- <ol id="summary">
24
- <li>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp12</code></li>
25
- <li>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp12b</code></li>
26
- <li>Digested by Testilo with procedure <code>dp12b</code></li>
27
- <li>Compared by Testilo with procedure <code>cp12b</code></li>
28
- </ol>
29
- <p>The Testaro procedure performs 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
- <h2>Comparison</h2>
31
- <table class="allBorder">
32
- <caption>Accessibility scores of web pages</caption>
33
- <thead>
34
- <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
35
- </thead>
36
- <tbody class="linkSmaller secondCellRight">
37
- __tableBody__
38
- </tbody>
39
- </table>
40
- <h2>Discussion</h2>
41
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults are not detectable with these tests. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
42
- <footer>
43
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
44
- </footer>
45
- </main>
46
- </body>
47
- </html>
@@ -1,71 +0,0 @@
1
- /*
2
- cp12b.js
3
- Returns a query for an HTML page including a bar-graph table.
4
- */
5
-
6
- // ########## IMPORTS
7
-
8
- // Module to keep secrets local.
9
- require('dotenv').config();
10
- // Module to access files.
11
- const fs = require('fs/promises');
12
-
13
- // ########## CONSTANTS
14
-
15
- const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
16
- const query = {};
17
-
18
- // ########## FUNCTIONS
19
-
20
- // Returns data on the hosts in the report directory.
21
- const getData = async () => {
22
- const reportDirAbs = `${__dirname}/../../../${reportDirScored}`;
23
- const reportFileNamesAll = await fs.readdir(reportDirAbs);
24
- const reportFileNamesSource = reportFileNamesAll.filter(fileName => fileName.endsWith('.json'));
25
- const pageCount = reportFileNamesSource.length;
26
- const bodyData = [];
27
- for (const fileName of reportFileNamesSource) {
28
- const fileJSON = await fs.readFile(`${reportDirAbs}/${fileName}`, 'utf8');
29
- const file = JSON.parse(fileJSON);
30
- const {id, host, score} = file;
31
- bodyData.push({
32
- id,
33
- org: host.what,
34
- url: host.which,
35
- score: score.summary.total
36
- });
37
- };
38
- return {
39
- pageCount,
40
- bodyData
41
- }
42
- };
43
- // Returns the maximum score.
44
- const getMaxScore = tableData => tableData.reduce((max, item) => Math.max(max, item.score), 0);
45
- // Converts report data to a table body.
46
- const getTableBody = async bodyData => {
47
- const maxScore = getMaxScore(bodyData);
48
- const rows = bodyData
49
- .sort((a, b) => a.score - b.score)
50
- .map(item => {
51
- const {id, org, url, score} = item;
52
- const pageCell = `<th scope="row"><a href="${url}">${org}</a></th>`;
53
- const numCell = `<td><a href="digests/${id}.html">${score}</a></td>`;
54
- const barWidth = 100 * score / maxScore;
55
- const bar = `<rect height="100%" width="${barWidth}%" fill="red"></rect>`;
56
- const barCell = `<td aria-hidden="true"><svg width="100%" height="0.7em">${bar}</svg></td>`;
57
- const row = `<tr>${pageCell}${numCell}${barCell}</tr>`;
58
- return row;
59
- });
60
- return rows.join('\n ');
61
- };
62
- // Returns a query for a comparative table.
63
- exports.getQuery = async () => {
64
- const data = await getData();
65
- query.pageCount = data.pageCount;
66
- query.tableBody = await getTableBody(data.bodyData);
67
- const date = new Date();
68
- query.dateISO = date.toISOString().slice(0, 10);
69
- query.dateSlash = query.dateISO.replace(/-/g, '/');
70
- return query;
71
- };
@@ -1,47 +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="comparison of accessibility scores">
10
- <meta name="keywords" content="accessibility a11y web testing">
11
- <title>Accessibility score comparison</title>
12
- <link rel="icon" href="favicon.png">
13
- <link rel="stylesheet" href="style.css">
14
- </head>
15
- <body>
16
- <main>
17
- <header>
18
- <h1>Accessibility score comparison</h1>
19
- </header>
20
- <h2>Introduction</h2>
21
- <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
- <p>The pages were:</p>
23
- <ol id="summary">
24
- <li>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp14</code></li>
25
- <li>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp14a</code></li>
26
- <li>Digested by Testilo with procedure <code>dp14a</code></li>
27
- <li>Compared by Testilo with procedure <code>cp14a</code></li>
28
- </ol>
29
- <p>The Testaro procedure performs 1075 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
- <h2>Comparison</h2>
31
- <table class="allBorder">
32
- <caption>Accessibility scores of web pages</caption>
33
- <thead>
34
- <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
35
- </thead>
36
- <tbody class="linkSmaller secondCellRight">
37
- __tableBody__
38
- </tbody>
39
- </table>
40
- <h2>Discussion</h2>
41
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults are not detectable with these tests. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
42
- <footer>
43
- <p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
44
- </footer>
45
- </main>
46
- </body>
47
- </html>