testilo 16.0.6 → 16.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.
package/call.js CHANGED
@@ -70,7 +70,7 @@ const callScript = async (scriptID, classificationID = null, ... issueIDs) => {
70
70
  console.log(`Script ${scriptID} created and saved in ${specDir}/scripts`);
71
71
  };
72
72
  // Fulfills a merging request.
73
- const callMerge = async (scriptID, batchID, requester, withIsolation, todo = true) => {
73
+ const callMerge = async (scriptID, batchID, requester, withIsolation, todo) => {
74
74
  // Get the script and the batch.
75
75
  const scriptJSON = await fs.readFile(`${specDir}/scripts/${scriptID}.json`, 'utf8');
76
76
  const script = JSON.parse(scriptJSON);
@@ -79,9 +79,9 @@ const callMerge = async (scriptID, batchID, requester, withIsolation, todo = tru
79
79
  // Merge them into an array of jobs.
80
80
  const jobs = merge(script, batch, requester, withIsolation);
81
81
  // Save the jobs.
82
+ const destination = todo === 'true' ? 'todo' : 'pending';
82
83
  for (const job of jobs) {
83
84
  const jobJSON = JSON.stringify(job, null, 2);
84
- const destination = todo ? 'todo' : 'pending';
85
85
  await fs.writeFile(`${jobDir}/${destination}/${job.id}.json`, jobJSON);
86
86
  }
87
87
  const {timeStamp} = jobs[0];
@@ -235,7 +235,7 @@ else if (fn === 'script' && fnArgs.length) {
235
235
  console.log('Execution completed');
236
236
  });
237
237
  }
238
- else if (fn === 'merge' && fnArgs.length > 2 && fnArgs.length < 5) {
238
+ else if (fn === 'merge' && fnArgs.length === 5) {
239
239
  callMerge(... fnArgs)
240
240
  .then(() => {
241
241
  console.log('Execution completed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "16.0.6",
3
+ "version": "16.1.0",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "aim.js",
6
6
  "scripts": {
@@ -152,6 +152,20 @@ exports.issues = {
152
152
  }
153
153
  }
154
154
  },
155
+ roleNoText: {
156
+ why: 'User cannot get help understanding an item',
157
+ wcag: '4.1.2',
158
+ weight: 4,
159
+ tools: {
160
+ ibm: {
161
+ aria_accessiblename_exists: {
162
+ variable: false,
163
+ quality: 1,
164
+ what: 'Element has no accessible name, although its role requires one'
165
+ }
166
+ }
167
+ }
168
+ },
155
169
  componentNoText: {
156
170
  why: 'User cannot get help understanding a custom item',
157
171
  wcag: '4.1.2',
@@ -5493,6 +5507,13 @@ exports.issues = {
5493
5507
  quality: 1,
5494
5508
  what: 'Page includes more than 1 visible main element'
5495
5509
  }
5510
+ },
5511
+ qualWeb: {
5512
+ 'QW-BP22': {
5513
+ variable: false,
5514
+ quality: 1,
5515
+ what: 'Document has more than 1 element with a main role'
5516
+ }
5496
5517
  }
5497
5518
  }
5498
5519
  },
@@ -6625,7 +6646,7 @@ exports.issues = {
6625
6646
  weight: 1,
6626
6647
  tools: {
6627
6648
  wave: {
6628
- 'html5_video_audio': {
6649
+ html5_video_audio: {
6629
6650
  variable: false,
6630
6651
  quality: 1,
6631
6652
  what: 'video or audio element may have no or incorrect captions, transcript, or audio description'
@@ -30,18 +30,25 @@ const latencyWeight = 1;
30
30
  const normalLatency = 9;
31
31
  // How much each prevention adds to the score.
32
32
  const preventionWeight = 300;
33
- // Indexes of issues.
33
+ // Initialize a table of tool rules.
34
34
  const issueIndex = {};
35
+ // Initialize an array of variably named tool rules.
35
36
  const issueMatcher = [];
37
+ // For each issue:
36
38
  Object.keys(issues).forEach(issueName => {
39
+ // For each tool with rules belonging to that issue:
37
40
  Object.keys(issues[issueName].tools).forEach(toolName => {
38
- Object.keys(issues[issueName].tools[toolName]).forEach(issueID => {
41
+ // For each of those rules:
42
+ Object.keys(issues[issueName].tools[toolName]).forEach(ruleID => {
43
+ // Add it to the table of tool rules.
39
44
  if (! issueIndex[toolName]) {
40
45
  issueIndex[toolName] = {};
41
46
  }
42
- issueIndex[toolName][issueID] = issueName;
43
- if (issues[issueName].tools[toolName][issueID].variable) {
44
- issueMatcher.push(issueID);
47
+ issueIndex[toolName][ruleID] = issueName;
48
+ // If it is variably named:
49
+ if (issues[issueName].tools[toolName][ruleID].variable) {
50
+ // Add it to the array of variably named tool rules.
51
+ issueMatcher.push(ruleID);
45
52
  }
46
53
  })
47
54
  });
@@ -63,6 +70,7 @@ exports.scorer = report => {
63
70
  summary: {
64
71
  total: 0,
65
72
  issue: 0,
73
+ solo: 0,
66
74
  tool: 0,
67
75
  prevention: 0,
68
76
  log: 0,
@@ -74,7 +82,8 @@ exports.scorer = report => {
74
82
  byTool: {}
75
83
  },
76
84
  prevention: {},
77
- issue: {}
85
+ issue: {},
86
+ solo: {}
78
87
  }
79
88
  };
80
89
  const {summary, details} = score;
@@ -96,31 +105,38 @@ exports.scorer = report => {
96
105
  // Add the severity totals of the tool to the score.
97
106
  const {totals} = standardResult;
98
107
  details.severity.byTool[which] = totals;
99
- // Add the instance data of the tool to the score.
108
+ // For each instance of the tool:
100
109
  standardResult.instances.forEach(instance => {
101
- let {ruleID} = instance;
110
+ // Get the rule ID.
111
+ const {ruleID, ordinalSeverity, count} = instance;
112
+ // If it is not in the table of tool rules:
113
+ let canonicalRuleID = ruleID;
102
114
  if (! issueIndex[which][ruleID]) {
103
- ruleID = issueMatcher.find(pattern => {
115
+ // Convert it to the variably named tool rule that it matches, if any.
116
+ canonicalRuleID = issueMatcher.find(pattern => {
104
117
  const patternRE = new RegExp(pattern);
105
118
  return patternRE.test(instance.ruleID);
106
119
  });
107
120
  }
108
- if (ruleID) {
109
- const issueID = issueIndex[which][ruleID];
110
- if (! details.issue[issueID]) {
111
- details.issue[issueID] = {
121
+ // If the rule ID belongs to an issue:
122
+ if (canonicalRuleID) {
123
+ // Get the issue.
124
+ const issueName = issueIndex[which][canonicalRuleID];
125
+ // Add the instance to the issue details of the score data.
126
+ if (! details.issue[issueName]) {
127
+ details.issue[issueName] = {
112
128
  score: 0,
113
129
  maxCount: 0,
114
- weight: issues[issueID].weight,
130
+ weight: issues[issueName].weight,
115
131
  tools: {}
116
132
  };
117
133
  }
118
- if (! details.issue[issueID].tools[which]) {
119
- details.issue[issueID].tools[which] = {};
134
+ if (! details.issue[issueName].tools[which]) {
135
+ details.issue[issueName].tools[which] = {};
120
136
  }
121
- if (! details.issue[issueID].tools[which][ruleID]) {
122
- const ruleData = issues[issueID].tools[which][ruleID];
123
- details.issue[issueID].tools[which][ruleID] = {
137
+ if (! details.issue[issueName].tools[which][canonicalRuleID]) {
138
+ const ruleData = issues[issueName].tools[which][canonicalRuleID];
139
+ details.issue[issueName].tools[which][canonicalRuleID] = {
124
140
  quality: ruleData.quality,
125
141
  what: ruleData.what,
126
142
  complaints: {
@@ -130,22 +146,37 @@ exports.scorer = report => {
130
146
  };
131
147
  }
132
148
  details
133
- .issue[issueID]
134
- .tools[which][ruleID]
149
+ .issue[issueName]
150
+ .tools[which][canonicalRuleID]
135
151
  .complaints
136
152
  .countTotal += instance.count || 1;
137
153
  if (
138
154
  ! details
139
- .issue[issueID]
140
- .tools[which][ruleID]
155
+ .issue[issueName]
156
+ .tools[which][canonicalRuleID]
141
157
  .complaints
142
158
  .texts
143
159
  .includes(instance.what)
144
160
  ) {
145
- details.issue[issueID].tools[which][ruleID].complaints.texts.push(instance.what);
161
+ details
162
+ .issue[issueName]
163
+ .tools[which][canonicalRuleID]
164
+ .complaints
165
+ .texts
166
+ .push(instance.what);
146
167
  }
147
168
  }
169
+ // Otherwise, i.e. if the rule ID belongs to no issue:
148
170
  else {
171
+ // Add the instance to the solo details of the score data.
172
+ if (! details.solo[which]) {
173
+ details.solo[which] = {};
174
+ }
175
+ if (! details.solo[which][ruleID]) {
176
+ details.solo[which][ruleID] = 0;
177
+ }
178
+ details.solo[which][ruleID] += (count || 1) * (ordinalSeverity + 1);
179
+ // Report this.
149
180
  console.log(`ERROR: ${instance.ruleID} of ${which} not found in issues`);
150
181
  }
151
182
  });
@@ -157,8 +188,8 @@ exports.scorer = report => {
157
188
  }
158
189
  });
159
190
  // For each issue with any complaints:
160
- Object.keys(details.issue).forEach(issueID => {
161
- const issueData = details.issue[issueID];
191
+ Object.keys(details.issue).forEach(issueName => {
192
+ const issueData = details.issue[issueName];
162
193
  // For each tool with any complaints for the issue:
163
194
  Object.keys(issueData.tools).forEach(toolID => {
164
195
  // Get the sum of the weighted counts of its issue rules.
@@ -186,6 +217,12 @@ exports.scorer = report => {
186
217
  summary.issue = Object
187
218
  .values(details.issue)
188
219
  .reduce((total, current) => total + current.score, 0);
220
+ // Add the summary solo total to the score.
221
+ Object.keys(details.solo).forEach(tool => {
222
+ summary.solo += Object
223
+ .values(details.solo[tool])
224
+ .reduce((total, current) => total + current);
225
+ });
189
226
  // Add the summary tool total to the score.
190
227
  summary.tool = toolWeight * details.severity.total.reduce(
191
228
  (total, current, index) => total + severityWeights[index] * current, 0
@@ -219,6 +256,7 @@ exports.scorer = report => {
219
256
  });
220
257
  // Add the summary total score to the score.
221
258
  summary.total = summary.issue
259
+ + summary.solo
222
260
  + summary.tool
223
261
  + summary.prevention
224
262
  + summary.log
@@ -0,0 +1,56 @@
1
+ {
2
+ "id": "ts33",
3
+ "what": "comprehensive accessibility tests",
4
+ "strict": true,
5
+ "timeLimit": 330,
6
+ "acts": [
7
+ {
8
+ "type": "placeholder",
9
+ "which": "main",
10
+ "launch": "chromium"
11
+ },
12
+ {
13
+ "type": "test",
14
+ "which": "alfa"
15
+ },
16
+ {
17
+ "type": "test",
18
+ "which": "axe",
19
+ "detailLevel": 2
20
+ },
21
+ {
22
+ "type": "test",
23
+ "which": "continuum"
24
+ },
25
+ {
26
+ "type": "test",
27
+ "which": "htmlcs"
28
+ },
29
+ {
30
+ "type": "test",
31
+ "which": "ibm",
32
+ "withItems": true,
33
+ "withNewContent": false
34
+ },
35
+ {
36
+ "type": "test",
37
+ "which": "nuVal"
38
+ },
39
+ {
40
+ "type": "test",
41
+ "which": "qualWeb",
42
+ "withNewContent": false
43
+ },
44
+ {
45
+ "type": "test",
46
+ "which": "testaro",
47
+ "withItems": true,
48
+ "stopOnFail": false
49
+ },
50
+ {
51
+ "type": "test",
52
+ "which": "wave",
53
+ "reportType": 4
54
+ }
55
+ ]
56
+ }