testilo 30.1.0 → 31.0.1

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 CHANGED
@@ -745,25 +745,25 @@ const {track} = require('testilo/track');
745
745
  const trackerDir = `${process.env.FUNCTIONDIR}/track/ttp99a`;
746
746
  const {tracker} = require(`${trackerDir}/index`);
747
747
  const summaryReport = …;
748
- const [reportID, trackReport] = track(tracker, summaryReport);
748
+ const [reportID, 'main competitors', trackReport] = track(tracker, summaryReport);
749
749
  ```
750
750
 
751
- The `track()` function returns an ID and an HTML tracking report that shows data for all of the results in the summary report. The invoking module can further dispose of the tracking report as needed.
751
+ The `track()` function returns an ID and an HTML tracking report that shows data for all of the results in the summary report and identifies “main competitors” as its subject. The invoking module can further dispose of the tracking report as needed.
752
752
 
753
753
  ##### By a user
754
754
 
755
755
  A user can invoke `track()` in one of these ways:
756
756
 
757
757
  ```javaScript
758
- node call track ttp99a
759
- node call track ttp99a 241016
760
- node call track ttp99a 241016 'ABC Foundation'
758
+ node call track ttp99a 'main competitors'
759
+ node call track ttp99a 'main competitors' 241016
760
+ node call track ttp99a 'main competitors' 241016 'ABC Foundation'
761
761
  ```
762
762
 
763
763
  When a user invokes `track()` in this example, the `call` module:
764
764
  - gets the summary report from the last file in the `summarized` subdirectory of the `REPORTDIR` directory, or if the third argument to `call()` exists the last one whose name begins with `'241016'`.
765
765
  - selects the summarized data for all results in the summary report, or if the fourth argument to `call()` exists from all results whose `target.what` property has the value `'ABC Foundation'`.
766
- - uses tracker `ttp99a` to create a tracking report.
766
+ - uses tracker `ttp99a` to create a tracking report that identifies “main competitors” as its subject.
767
767
  - assigns an ID to the tracking report.
768
768
  - writes the tracking report to the `tracking` subdirectory of the `REPORTDIR` directory, with the ID as the base of its file name.
769
769
 
package/call.js CHANGED
@@ -309,24 +309,24 @@ const callCompare = async (what, compareProcID, selector) => {
309
309
  }
310
310
  };
311
311
  // Fulfills a tracking request.
312
- const callTrack = async (trackerID, selector, targetWhat) => {
312
+ const callTrack = async (trackerID, what, selector, targetWhat) => {
313
313
  // Get the summary report.
314
314
  try {
315
315
  const summaryReport = await getSummaryReport(selector);
316
- // Remove unwanted results from it.
317
- summaryReport.summaries = summaryReport.summaries.filter(
318
- result => targetWhat
319
- ? result.sources
320
- && result.sources.target
321
- && result.sources.target.what === targetWhat
322
- : true
323
- );
316
+ // Remove unwanted results, if any, from it.
317
+ if (targetWhat) {
318
+ summaryReport.summaries = summaryReport.summaries.filter(
319
+ result => result.sources
320
+ && result.sources.target
321
+ && result.sources.target.what === targetWhat
322
+ );
323
+ }
324
324
  // If any results remain:
325
325
  if (summaryReport.summaries.length) {
326
326
  // Get the tracker.
327
327
  const {tracker} = require(`${functionDir}/track/${trackerID}/index`);
328
328
  // Track the results.
329
- const [reportID, trackingReport] = await track(tracker, summaryReport);
329
+ const [reportID, trackingReport] = await track(tracker, what, summaryReport);
330
330
  // Save the tracking report.
331
331
  await fs.mkdir(`${reportDir}/tracking`, {recursive: true});
332
332
  const reportPath = `${reportDir}/tracking/${reportID}.html`;
@@ -429,14 +429,14 @@ else if (fn === 'compare' && fnArgs.length === 3) {
429
429
  console.log('Execution completed');
430
430
  });
431
431
  }
432
- else if (fn === 'credit' && fnArgs.length > 0 && fnArgs.length < 3) {
433
- callCredit(... fnArgs)
432
+ else if (fn === 'track' && fnArgs.length > 2 && fnArgs.length < 6) {
433
+ callTrack(... fnArgs)
434
434
  .then(() => {
435
435
  console.log('Execution completed');
436
436
  });
437
437
  }
438
- else if (fn === 'track' && fnArgs.length > 1 && fnArgs.length < 5) {
439
- callTrack(... fnArgs)
438
+ else if (fn === 'credit' && fnArgs.length > 0 && fnArgs.length < 3) {
439
+ callCredit(... fnArgs)
440
440
  .then(() => {
441
441
  console.log('Execution completed');
442
442
  });
package/merge.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  // Module to keep secrets.
9
9
  require('dotenv').config();
10
- // Module to perform common actions.
10
+ // Utility module.
11
11
  const {alphaNumOf, dateOf, getRandomString, getNowStamp} = require('./procs/util');
12
12
 
13
13
  // ########## CONSTANTS
@@ -119,12 +119,13 @@ exports.merge = (script, batch, standard, observe, requester, timeStamp) => {
119
119
  // Add other properties to the job.
120
120
  job.mergeID = mergeID;
121
121
  job.sendReportTo = process.env.SEND_REPORT_TO || '';
122
- // Add data to the sources property of the job.
123
- job.sources.target.id = targetID;
122
+ // If the target is the last one:
124
123
  if (index === targets.length - 1) {
125
- // Add that fact to the job.
124
+ // Add that fact to the sources property of the job.
126
125
  job.sources.lastTarget = true;
127
126
  }
127
+ // Add other data to the sources property of the job.
128
+ job.sources.target.id = targetID;
128
129
  job.sources.target.what = target.what;
129
130
  job.sources.target.which = target.which;
130
131
  // Replace each placeholder object in the job with the named replacer array of the target.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "30.1.0",
3
+ "version": "31.0.1",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
@@ -88,49 +88,49 @@ exports.issues = {
88
88
  },
89
89
  'frame-tested': {
90
90
  variable: false,
91
- quality: 0.2,
91
+ quality: 0,
92
92
  what: 'Some content is in an iframe and so may not be testable for accessibility [speculative]'
93
93
  },
94
94
  'hidden-content': {
95
95
  variable: false,
96
- quality: 1,
96
+ quality: 0,
97
97
  what: 'Some content is hidden and so may not be testable for accessibility [speculative]'
98
98
  }
99
99
  },
100
100
  ed11y: {
101
101
  altNull: {
102
102
  variable: false,
103
- quality: 1,
103
+ quality: 0,
104
104
  what: 'img element not inside a link has an empty alt attribute [speculative]'
105
105
  },
106
106
  altPartOfLinkWithText: {
107
107
  variable: false,
108
- quality: 1,
108
+ quality: 0,
109
109
  what: 'Name of the link enclosing the img element includes its alt attribute, so may be unclear [speculative]'
110
110
  },
111
111
  embedAudio: {
112
112
  variable: false,
113
- quality: 1,
113
+ quality: 0,
114
114
  what: 'Element is audio, so may lack an accurate transcript [speculative]'
115
115
  },
116
116
  embedCustom: {
117
117
  variable: false,
118
- quality: 1,
118
+ quality: 0,
119
119
  what: 'Embedded custom element may fail to be accessible [speculative]'
120
120
  },
121
121
  embedTwitter: {
122
122
  variable: false,
123
- quality: 1,
123
+ quality: 0,
124
124
  what: 'Element is a Twitter feed, so may add many items on scroll and thus be impractical to exit by keyboard [speculative]'
125
125
  },
126
126
  embedVideo: {
127
127
  variable: false,
128
- quality: 1,
128
+ quality: 0,
129
129
  what: 'Element is video, so may lack captions [speculative]'
130
130
  },
131
131
  embedVisualization: {
132
132
  variable: false,
133
- quality: 1,
133
+ quality: 0,
134
134
  what: 'Element is a visualization, so may lack a nonvisual equivalent [speculative]'
135
135
  }
136
136
  },
@@ -164,29 +164,34 @@ exports.issues = {
164
164
  },
165
165
  'QW-ACT-R64': {
166
166
  variable: false,
167
- quality: 1,
167
+ quality: 0,
168
168
  what: 'Document has no heading for non-repeated content'
169
169
  },
170
170
  'QW-ACT-R73': {
171
171
  variable: false,
172
- quality: 1,
172
+ quality: 0,
173
173
  what: 'Block of repeated content is not collapsible [invalid]'
174
174
  },
175
175
  'QW-ACT-R74': {
176
176
  variable: false,
177
- quality: 1,
177
+ quality: 0,
178
178
  what: 'Document has no instrument to move focus to non-repeated content [invalid]'
179
179
  },
180
180
  'QW-ACT-R75': {
181
181
  variable: false,
182
- quality: 1,
182
+ quality: 0,
183
183
  what: 'Blocks of repeated content cannot be bypassed [invalid]'
184
184
  },
185
185
  'QW-BP1': {
186
186
  variable: false,
187
- quality: 1,
187
+ quality: 0,
188
188
  what: 'h1-h6 not used to identify headings [invalid]'
189
189
  },
190
+ 'QW-BP29': {
191
+ variable: false,
192
+ quality: 0,
193
+ what: 'lang and xml:lang attribute of html element differ [invalid]'
194
+ },
190
195
  'QW-WCAG-T4': {
191
196
  variable: false,
192
197
  quality: 0,
@@ -209,7 +214,7 @@ exports.issues = {
209
214
  },
210
215
  'QW-WCAG-T23': {
211
216
  variable: false,
212
- quality: 1,
217
+ quality: 0,
213
218
  what: 'No link at the top of the page goes directly to the main content area [invalid]'
214
219
  }
215
220
  }
@@ -18,7 +18,7 @@
18
18
  <h1>Accessibility tracking report</h1>
19
19
  </header>
20
20
  <h2>Introduction</h2>
21
- <p>This is tracking report <code>__id__</code>.</p>
21
+ <p>This is tracking report <code>__id__</code>, for __what__.</p>
22
22
  <p>It tracks accessibility scores over time. A perfect score is 0. The tracking was performed by Testilo procedure <code>__tp__</code>.</p>
23
23
  <p>The results are presented first as a graph, and then as a table.</p>
24
24
  <h2>Results as a graph</h2>
@@ -67,7 +67,6 @@
67
67
  <tr>
68
68
  <th>Date and time</th>
69
69
  <th>Score</th>
70
- <th>Order</th>
71
70
  <th>Target</th>
72
71
  </tr>
73
72
  </thead>
@@ -21,9 +21,10 @@ const digestURL = process.env.DIGEST_URL;
21
21
  // FUNCTIONS
22
22
 
23
23
  // Adds parameters to a query for a tracking report.
24
- const populateQuery = async (id, summaryReport, query) => {
24
+ const populateQuery = async (id, what, summaryReport, query) => {
25
25
  // General parameters.
26
26
  query.id = id;
27
+ query.what = what;
27
28
  query.tp = trackerID;
28
29
  query.dateISO = getNowDate();
29
30
  query.dateSlash = getNowDateSlash();
@@ -41,12 +42,11 @@ const populateQuery = async (id, summaryReport, query) => {
41
42
  const timeCell = `<td>${result.endTime}</td>`;
42
43
  const digestLinkDestination = digestURL.replace('__id__', result.id);
43
44
  const scoreCell = `<td><a href=${digestLinkDestination}>${result.score}</a></td>`;
44
- const orderCell = `<td class="center">${result.order}</td>`;
45
45
  const {target} = result.sources;
46
46
  const targetID = alphaNumOf(targetWhats.indexOf(target.what));
47
47
  const targetLink = `<a href="${target.which}">${target.what}</a>`;
48
48
  const targetCell = `<td>${targetID}: ${targetLink}</td>`;
49
- const row = `<tr>${[timeCell, scoreCell, orderCell, targetCell].join('')}</tr>`;
49
+ const row = `<tr>${[timeCell, scoreCell, targetCell].join('')}</tr>`;
50
50
  // Add the row to the array of rows.
51
51
  rows.push(row);
52
52
  });
@@ -54,10 +54,10 @@ const populateQuery = async (id, summaryReport, query) => {
54
54
  query.scoreRows = rows.join(innerJoiner);
55
55
  };
56
56
  // Returns a tracking report.
57
- exports.tracker = async (id, summaryReport) => {
57
+ exports.tracker = async (id, what, summaryReport) => {
58
58
  // Create a query to replace placeholders.
59
59
  const query = {};
60
- await populateQuery(id, summaryReport, query);
60
+ await populateQuery(id, what, summaryReport, query);
61
61
  // Get the template.
62
62
  let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
63
63
  // Replace its placeholders.
package/track.js CHANGED
@@ -14,9 +14,9 @@ const {getFileID} = require('./procs/util');
14
14
  // ########## FUNCTIONS
15
15
 
16
16
  // Creates and returns a tracking report from a summary.
17
- exports.track = async (tracker, summaryReport) => {
17
+ exports.track = async (tracker, what, summaryReport) => {
18
18
  // Use the tracker to create a tracking report.
19
19
  const id = getFileID(2);
20
- const trackingReport = await tracker(id, summaryReport);
20
+ const trackingReport = await tracker(id, what, summaryReport);
21
21
  return [id, trackingReport];
22
22
  };