testilo 10.3.0 → 11.0.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.
Files changed (71) hide show
  1. package/README.md +188 -190
  2. package/batch.js +60 -0
  3. package/call.js +9 -4
  4. package/compare.js +2 -2
  5. package/merge.js +0 -6
  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/{tic24.js → tic25.js} +40 -27
  11. package/procs/score/{tic23.js → tic26.js} +264 -229
  12. package/procs/score/tsp24.js +8 -2
  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/tsp21.js +0 -720
  66. package/procs/score/tsp22.js +0 -720
  67. package/procs/score/tsp23.js +0 -720
  68. package/specs/batches/orgs.json +0 -43
  69. package/specs/scripts/ts21.json +0 -213
  70. package/specs/scripts/ts23.json +0 -219
  71. package/specs/scripts/ts24.json +0 -225
package/call.js CHANGED
@@ -124,11 +124,16 @@ const callDigest = async (digesterID, selector = '') => {
124
124
  }
125
125
  };
126
126
  // Fulfills a comparison request.
127
+ // Get the scored reports to be scored.
127
128
  const callCompare = async (compareProcID, comparisonNameBase) => {
128
- await compare(compareProcID, comparisonNameBase);
129
- console.log(
130
- `Comparison completed. Comparison proc: ${compareProcID}. Directory: ${comparisonDir}.`
131
- );
129
+ const reports = await getReports('scored');
130
+ const comparerDir = `${functionDir}/compare/${compareProcID}`;
131
+ const comparisonTemplate = await fs.readFile(`${comparerDir}/index.html`, 'utf8');
132
+ const comparer = require(`${comparerDir}/index`).getQuery;
133
+ const comparison = await compare(comparisonTemplate, comparer, reports);
134
+ const comparisonDir = `${reportDir}/comparative`;
135
+ await fs.writeFile(`${comparisonDir}/${comparisonNameBase}.html`, comparison);
136
+ console.log(`Comparison completed. Proc: ${compareProcID}. Directory: ${comparisonDir}.`);
132
137
  };
133
138
 
134
139
  // ########## OPERATION
package/compare.js CHANGED
@@ -9,11 +9,11 @@
9
9
  const replaceHolders = (template, query) => template
10
10
  .replace(/__([a-zA-Z]+)__/g, (ph, qp) => query[qp]);
11
11
  // Compares the scored reports and returns a comparison.
12
- exports.compare = (comparisonTemplate, comparer, reports) => {
12
+ exports.compare = async (comparisonTemplate, comparer, reports) => {
13
13
  // Create a query.
14
14
  const query = {};
15
15
  // Populate the query.
16
- comparer(reports, query);
16
+ await comparer(reports, query);
17
17
  // Use it to create a comparison.
18
18
  const comparison = replaceHolders(comparisonTemplate, query);
19
19
  // Return the comparison.
package/merge.js CHANGED
@@ -19,14 +19,8 @@ const stdRequester = process.env.REQUESTER;
19
19
  const contaminantNames = new Set([
20
20
  'axe',
21
21
  'continuum',
22
- 'focAll',
23
- 'focInd',
24
- 'focOp',
25
- 'hover',
26
22
  'htmlcs',
27
23
  'ibm',
28
- 'menuNav',
29
- 'textNodes',
30
24
  'wave'
31
25
  ]);
32
26
  // Tests that are immune to page alteration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "10.3.0",
3
+ "version": "11.0.0",
4
4
  "description": "Client that scores and digests Testaro reports",
5
5
  "main": "aim.js",
6
6
  "scripts": {
@@ -14,26 +14,24 @@ const fs = require('fs/promises');
14
14
 
15
15
  // ########## CONSTANTS
16
16
 
17
- const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
18
17
  const query = {};
19
18
 
20
19
  // ########## FUNCTIONS
21
20
 
22
21
  // Returns data on the targets.
23
22
  const getData = async scoredReports => {
24
- const reportCount = scoredReports.length;
25
23
  const bodyData = [];
26
24
  for (const report of scoredReports) {
27
- const {id, host, score} = report;
25
+ const {id, acts, sources, score} = report;
28
26
  bodyData.push({
29
27
  id,
30
- org: host.what,
31
- url: host.which,
28
+ org: sources.target.what,
29
+ url: acts[1].which,
32
30
  score: score.summary.total
33
31
  });
34
32
  };
35
33
  return {
36
- pageCount,
34
+ pageCount: scoredReports.length,
37
35
  bodyData
38
36
  }
39
37
  };
@@ -57,13 +55,12 @@ const getTableBody = async bodyData => {
57
55
  });
58
56
  return rows.join('\n ');
59
57
  };
60
- // Returns a query for a comparative table.
61
- exports.getQuery = async () => {
62
- const data = await getData();
58
+ // Populates a query for a comparative table.
59
+ exports.getQuery = async (scoredReports, query) => {
60
+ const data = await getData(scoredReports);
63
61
  query.pageCount = data.pageCount;
64
62
  query.tableBody = await getTableBody(data.bodyData);
65
63
  const date = new Date();
66
64
  query.dateISO = date.toISOString().slice(0, 10);
67
65
  query.dateSlash = query.dateISO.replace(/-/g, '/');
68
- return query;
69
66
  };
@@ -21,12 +21,12 @@
21
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 are links to the pages on the web. The scores are links to digests that explain in detail how the scores were computed.</p>
22
22
  <p>The pages were:</p>
23
23
  <ol id="summary">
24
- <li>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp15</code></li>
25
- <li>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp15c</code></li>
26
- <li>Digested by Testilo with procedure <code>dp15a</code></li>
27
- <li>Compared by Testilo with procedure <code>cp15b</code></li>
24
+ <li>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with script <code>ts20</code></li>
25
+ <li>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp20b</code></li>
26
+ <li>Digested by Testilo with procedure <code>dp20d</code></li>
27
+ <li>Compared by Testilo with procedure <code>cp20a</code></li>
28
28
  </ol>
29
- <p>The Testaro procedure performs 1230 tests on each page. Of these, 24 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
29
+ <p>The script made Testaro perform 1230 automated accessibility tests drawn from nine different packages: Alfa, Axe, Continuum, Equal Access, HTML CodeSniffer, Nu Html Checker, Tenon, Testaro, and WAVE. The scoring procedure made Testilo assign a score to each page, with 0 being perfect.</p>
30
30
  <h2>Comparison</h2>
31
31
  <table class="allBorder">
32
32
  <caption>Accessibility scores of web pages</caption>
@@ -1,6 +1,6 @@
1
1
  /*
2
- cp12a.js
3
- Returns a query for an HTML page including a bar-graph table.
2
+ cp24.js
3
+ Returns a query for replacing placeholders in the associated template.
4
4
  */
5
5
 
6
6
  // ########## IMPORTS
@@ -12,31 +12,24 @@ const fs = require('fs/promises');
12
12
 
13
13
  // ########## CONSTANTS
14
14
 
15
- const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
16
15
  const query = {};
17
16
 
18
17
  // ########## FUNCTIONS
19
18
 
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;
19
+ // Returns data on the targets.
20
+ const getData = async scoredReports => {
26
21
  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;
22
+ for (const report of scoredReports) {
23
+ const {id, acts, sources, score} = report;
31
24
  bodyData.push({
32
25
  id,
33
- org: host.what,
34
- url: host.which,
26
+ org: sources.target.what,
27
+ url: acts[1].which,
35
28
  score: score.summary.total
36
29
  });
37
30
  };
38
31
  return {
39
- pageCount,
32
+ pageCount: scoredReports.length,
40
33
  bodyData
41
34
  }
42
35
  };
@@ -51,6 +44,7 @@ const getTableBody = async bodyData => {
51
44
  const {id, org, url, score} = item;
52
45
  const pageCell = `<th scope="row"><a href="${url}">${org}</a></th>`;
53
46
  const numCell = `<td><a href="digests/${id}.html">${score}</a></td>`;
47
+ // Make the bar width proportional.
54
48
  const barWidth = 100 * score / maxScore;
55
49
  const bar = `<rect height="100%" width="${barWidth}%" fill="red"></rect>`;
56
50
  const barCell = `<td aria-hidden="true"><svg width="100%" height="0.7em">${bar}</svg></td>`;
@@ -59,13 +53,12 @@ const getTableBody = async bodyData => {
59
53
  });
60
54
  return rows.join('\n ');
61
55
  };
62
- // Returns a query for a comparative table.
63
- exports.getQuery = async () => {
64
- const data = await getData();
56
+ // Populates a query for a comparative table.
57
+ exports.getQuery = async (scoredReports, query) => {
58
+ const data = await getData(scoredReports);
65
59
  query.pageCount = data.pageCount;
66
60
  query.tableBody = await getTableBody(data.bodyData);
67
61
  const date = new Date();
68
62
  query.dateISO = date.toISOString().slice(0, 10);
69
63
  query.dateSlash = query.dateISO.replace(/-/g, '/');
70
- return query;
71
64
  };
@@ -10,7 +10,8 @@
10
10
  weight: weight of the issue in score computation.
11
11
  tools: tools (including Testaro) providing tests in the issue.
12
12
 
13
- Each property of tools specifies a test of that tool. Its key is the identifier of the test. Its value is an object with these properties:
13
+ Each property of tools specifies a test of that tool. Its key is the identifier of the test.
14
+ Its value is an object with these properties:
14
15
  - variable: whether the identifier is a regular expression.
15
16
  - quality: the estimated quality of the test (normally 1).
16
17
  - what: description of the test.
@@ -3112,7 +3113,7 @@ exports.issues = {
3112
3113
  }
3113
3114
  }
3114
3115
  },
3115
- autocompleteInvalid: {
3116
+ autocompleteBad: {
3116
3117
  wcag: '1.3.5',
3117
3118
  weight: 3,
3118
3119
  tools: {
@@ -3160,14 +3161,14 @@ exports.issues = {
3160
3161
  }
3161
3162
  }
3162
3163
  },
3163
- autocompleteBad: {
3164
+ autocompleteNone: {
3164
3165
  wcag: '1.3.5',
3165
- weight: 4,
3166
+ weight: 1,
3166
3167
  tools: {
3167
3168
  testaro: {
3168
3169
  autocomplete: {
3169
3170
  variable: false,
3170
- quality: 0.7,
3171
+ quality: 1,
3171
3172
  what: 'Name or email input is missing its required autocomplete attribute'
3172
3173
  }
3173
3174
  }
@@ -3690,7 +3691,7 @@ exports.issues = {
3690
3691
  }
3691
3692
  }
3692
3693
  },
3693
- headingStructure: {
3694
+ headingLevelSkip: {
3694
3695
  wcag: '1.3.1',
3695
3696
  weight: 2,
3696
3697
  tools: {
@@ -3708,25 +3709,24 @@ exports.issues = {
3708
3709
  what: 'Heading levels do not increase by only one'
3709
3710
  }
3710
3711
  },
3711
- htmlcs: {
3712
- 'e:AAA.1_3_1_AAA.G141': {
3713
- variable: false,
3714
- quality: 1,
3715
- what: 'Heading level is incorrect'
3716
- }
3717
- },
3718
- nuVal: {
3719
- 'Consider using the h1 element as a top-level heading only (all h1 elements are treated as top-level headings by many screen readers and other tools).': {
3712
+ wave: {
3713
+ 'a:heading_skipped': {
3720
3714
  variable: false,
3721
3715
  quality: 1,
3722
- what: 'Page contains more than 1 h1 element'
3716
+ what: 'Skipped heading level'
3723
3717
  }
3724
- },
3725
- qualWeb: {
3726
- 'QW-WCAG-T9': {
3718
+ }
3719
+ }
3720
+ },
3721
+ headingStructure: {
3722
+ wcag: '1.3.1',
3723
+ weight: 2,
3724
+ tools: {
3725
+ htmlcs: {
3726
+ 'e:AAA.1_3_1_AAA.G141': {
3727
3727
  variable: false,
3728
3728
  quality: 1,
3729
- what: 'Page is not organized using headings'
3729
+ what: 'Heading level is incorrect'
3730
3730
  }
3731
3731
  },
3732
3732
  tenon: {
@@ -3735,13 +3735,6 @@ exports.issues = {
3735
3735
  quality: 1,
3736
3736
  what: 'Headings are not structured in a hierarchical manner'
3737
3737
  }
3738
- },
3739
- wave: {
3740
- 'a:heading_skipped': {
3741
- variable: false,
3742
- quality: 1,
3743
- what: 'Skipped heading level'
3744
- }
3745
3738
  }
3746
3739
  }
3747
3740
  },
@@ -3785,6 +3778,19 @@ exports.issues = {
3785
3778
  }
3786
3779
  }
3787
3780
  },
3781
+ h1Multiple: {
3782
+ wcag: '1.3.1',
3783
+ weight: 2,
3784
+ tools: {
3785
+ nuVal: {
3786
+ 'Consider using the h1 element as a top-level heading only (all h1 elements are treated as top-level headings by many screen readers and other tools).': {
3787
+ variable: false,
3788
+ quality: 1,
3789
+ what: 'Page contains more than 1 h1 element'
3790
+ }
3791
+ }
3792
+ }
3793
+ },
3788
3794
  h1Missing: {
3789
3795
  wcag: '1.3.1',
3790
3796
  weight: 3,
@@ -3840,6 +3846,13 @@ exports.issues = {
3840
3846
  quality: 1,
3841
3847
  what: 'section has no heading'
3842
3848
  }
3849
+ },
3850
+ qualWeb: {
3851
+ 'QW-WCAG-T9': {
3852
+ variable: false,
3853
+ quality: 1,
3854
+ what: 'Page is not organized using headings'
3855
+ }
3843
3856
  }
3844
3857
  }
3845
3858
  },