testilo 13.10.4 → 14.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/merge.js +3 -8
- package/package.json +1 -1
- package/procs/compare/{tcp27 → tcp31}/index.html +1 -1
- package/procs/compare/{tcp28 → tcp31}/index.js +1 -1
- package/procs/digest/{tdp27 → tdp31}/index.html +1 -1
- package/procs/score/{tic30.js → tic31.js} +52 -244
- package/procs/score/{tsp28.js → tsp31.js} +13 -13
- package/procs/score/tspA11yMessage.js +1 -1
- package/script.js +2 -14
- package/scripts/{ts27.json → ts31.json} +2 -25
- package/procs/compare/cp20sqrt/index.html +0 -48
- package/procs/compare/cp20sqrt/index.js +0 -66
- package/procs/compare/tcp24/index.html +0 -47
- package/procs/compare/tcp24/index.js +0 -64
- package/procs/compare/tcp27/index.js +0 -83
- package/procs/compare/tcp28/index.html +0 -47
- package/procs/digest/tdp24/index.html +0 -54
- package/procs/digest/tdp24/index.js +0 -117
- package/procs/digest/tdp27/index.js +0 -105
- package/procs/digest/tdp28/index.html +0 -72
- package/procs/score/tic25.js +0 -6966
- package/procs/score/tic27.js +0 -7404
- package/procs/score/tic28.js +0 -7472
- package/procs/score/tic29.js +0 -7430
- package/procs/score/tsp26.js +0 -111
- package/procs/score/tsp27.js +0 -241
- package/scripts/ts26.json +0 -97
- /package/procs/digest/{tdp28 → tdp31}/index.js +0 -0
package/procs/score/tsp26.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
tsp26
|
|
3
|
-
Testilo score proc 26
|
|
4
|
-
|
|
5
|
-
Totals the standardized tool totals from a ts26 report and adds them to the report. This proc
|
|
6
|
-
does not compensate for inter-tool duplicativity, treats tool totals as equivalent, and
|
|
7
|
-
weighs ordinal severities linearly from 1 to 4.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// CONSTANTS
|
|
11
|
-
|
|
12
|
-
// ID of this proc.
|
|
13
|
-
const scoreProcID = 'tsp26';
|
|
14
|
-
// Configuration disclosures.
|
|
15
|
-
const severityWeights = [1, 2, 3, 4];
|
|
16
|
-
const logWeights = {
|
|
17
|
-
logCount: 0.5,
|
|
18
|
-
logSize: 0.01,
|
|
19
|
-
errorLogCount: 1,
|
|
20
|
-
errorLogSize: 0.02,
|
|
21
|
-
prohibitedCount: 15,
|
|
22
|
-
visitRejectionCount: 10
|
|
23
|
-
};
|
|
24
|
-
const latencyWeight = 1;
|
|
25
|
-
// Normal latency (1.5 second per visit).
|
|
26
|
-
const normalLatency = 20;
|
|
27
|
-
// How much each prevention adds to the score.
|
|
28
|
-
const preventionWeight = 100;
|
|
29
|
-
|
|
30
|
-
// FUNCTIONS
|
|
31
|
-
|
|
32
|
-
// Scores a report.
|
|
33
|
-
exports.scorer = report => {
|
|
34
|
-
// If there are any acts in the report:
|
|
35
|
-
const {acts} = report;
|
|
36
|
-
if (Array.isArray(acts) && acts.length) {
|
|
37
|
-
// If any of them are test acts:
|
|
38
|
-
const testActs = acts.filter(act => act.type === 'test');
|
|
39
|
-
if (testActs.length) {
|
|
40
|
-
// Initialize the score data.
|
|
41
|
-
const score = {
|
|
42
|
-
scoreProcID,
|
|
43
|
-
summary: {
|
|
44
|
-
total: 0,
|
|
45
|
-
tools: 0,
|
|
46
|
-
preventions: 0,
|
|
47
|
-
log: 0,
|
|
48
|
-
latency: 0
|
|
49
|
-
},
|
|
50
|
-
toolTotals: [0, 0, 0, 0],
|
|
51
|
-
tools: {},
|
|
52
|
-
preventions: {}
|
|
53
|
-
};
|
|
54
|
-
const {summary} = score;
|
|
55
|
-
// For each test act:
|
|
56
|
-
testActs.forEach(act => {
|
|
57
|
-
// If a standard result with valid totals exists:
|
|
58
|
-
const {which} = act;
|
|
59
|
-
if (
|
|
60
|
-
act.standardResult && act.standardResult.totals && act.standardResult.totals.length === 4
|
|
61
|
-
) {
|
|
62
|
-
// Add the tool totals to the score.
|
|
63
|
-
const {totals} = act.standardResult;
|
|
64
|
-
score.tools[which] = totals;
|
|
65
|
-
score.toolTotals.forEach((total, index) => {
|
|
66
|
-
score.toolTotals[index] += totals[index];
|
|
67
|
-
summary.tools += totals[index] * severityWeights[index];
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
// Otherwise, i.e. if no result with totals exists:
|
|
71
|
-
else {
|
|
72
|
-
// Add a prevented result to the act if not already there.
|
|
73
|
-
if (! act.result) {
|
|
74
|
-
act.result = {};
|
|
75
|
-
}
|
|
76
|
-
if (! act.result.prevented) {
|
|
77
|
-
act.result.prevented = true;
|
|
78
|
-
};
|
|
79
|
-
// Add the tool and the prevention score to the score.
|
|
80
|
-
score.preventions[which] = preventionWeight;
|
|
81
|
-
summary.preventions += preventionWeight;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// Add the log score to the score.
|
|
85
|
-
const {jobData} = report;
|
|
86
|
-
summary.log = Math.max(0, Math.round(
|
|
87
|
-
logWeights.logCount * jobData.logCount
|
|
88
|
-
+ logWeights.logSize * jobData.logSize +
|
|
89
|
-
+ logWeights.errorLogCount * jobData.errorLogCount
|
|
90
|
-
+ logWeights.errorLogSize * jobData.errorLogSize
|
|
91
|
-
+ logWeights.prohibitedCount * jobData.prohibitedCount +
|
|
92
|
-
+ logWeights.visitRejectionCount * jobData.visitRejectionCount
|
|
93
|
-
));
|
|
94
|
-
summary.latency = Math.round(latencyWeight * (jobData.visitLatency - normalLatency));
|
|
95
|
-
// Add the total score to the score.
|
|
96
|
-
summary.total = summary.tools + summary.preventions + summary.log + summary.latency;
|
|
97
|
-
// Add the score to the report.
|
|
98
|
-
report.score = score;
|
|
99
|
-
}
|
|
100
|
-
// Otherwise, i.e. if none of them is a test act:
|
|
101
|
-
else {
|
|
102
|
-
// Report this.
|
|
103
|
-
console.log('ERROR: No test acts');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Otherwise, i.e. if there are no acts in the report:
|
|
107
|
-
else {
|
|
108
|
-
// Report this.
|
|
109
|
-
console.log('ERROR: No acts');
|
|
110
|
-
}
|
|
111
|
-
};
|
package/procs/score/tsp27.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
tsp27
|
|
3
|
-
Testilo score proc 27
|
|
4
|
-
|
|
5
|
-
Computes target score data and adds them to a ts26 report.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// IMPORTS
|
|
9
|
-
|
|
10
|
-
const {issueClasses} = require('./tic27');
|
|
11
|
-
|
|
12
|
-
// CONSTANTS
|
|
13
|
-
|
|
14
|
-
// ID of this proc.
|
|
15
|
-
const scoreProcID = 'tsp27';
|
|
16
|
-
// Configuration disclosures.
|
|
17
|
-
const severityWeights = [1, 2, 3, 4];
|
|
18
|
-
const toolWeight = 0.1;
|
|
19
|
-
const logWeights = {
|
|
20
|
-
logCount: 0.1,
|
|
21
|
-
logSize: 0.002,
|
|
22
|
-
errorLogCount: 0.2,
|
|
23
|
-
errorLogSize: 0.004,
|
|
24
|
-
prohibitedCount: 3,
|
|
25
|
-
visitRejectionCount: 2
|
|
26
|
-
};
|
|
27
|
-
// How much each second of excess latency adds to the score.
|
|
28
|
-
const latencyWeight = 1;
|
|
29
|
-
// Normal latency (1.5 second per visit).
|
|
30
|
-
const normalLatency = 20;
|
|
31
|
-
// How much each prevention adds to the score.
|
|
32
|
-
const preventionWeight = 300;
|
|
33
|
-
// Indexes of issues.
|
|
34
|
-
const issueIndex = {};
|
|
35
|
-
const issueMatcher = [];
|
|
36
|
-
Object.keys(issueClasses).forEach(issueClassName => {
|
|
37
|
-
Object.keys(issueClasses[issueClassName].tools).forEach(toolName => {
|
|
38
|
-
Object.keys(issueClasses[issueClassName].tools[toolName]).forEach(issueID => {
|
|
39
|
-
if (! issueIndex[toolName]) {
|
|
40
|
-
issueIndex[toolName] = {};
|
|
41
|
-
}
|
|
42
|
-
issueIndex[toolName][issueID] = issueClassName;
|
|
43
|
-
if (issueClasses[issueClassName].tools[toolName][issueID].variable) {
|
|
44
|
-
issueMatcher.push(issueID);
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// FUNCTIONS
|
|
51
|
-
|
|
52
|
-
// Scores a report.
|
|
53
|
-
exports.scorer = report => {
|
|
54
|
-
console.log(`Scoring report ${report.id}`);
|
|
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 the score data.
|
|
62
|
-
const score = {
|
|
63
|
-
scoreProcID,
|
|
64
|
-
summary: {
|
|
65
|
-
total: 0,
|
|
66
|
-
issue: 0,
|
|
67
|
-
tool: 0,
|
|
68
|
-
prevention: 0,
|
|
69
|
-
log: 0,
|
|
70
|
-
latency: 0
|
|
71
|
-
},
|
|
72
|
-
details: {
|
|
73
|
-
severity: {
|
|
74
|
-
total: [0, 0, 0, 0],
|
|
75
|
-
byTool: {}
|
|
76
|
-
},
|
|
77
|
-
prevention: {},
|
|
78
|
-
issue: {}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const {summary, details} = score;
|
|
82
|
-
// For each test act:
|
|
83
|
-
testActs.forEach(act => {
|
|
84
|
-
// If the page prevented the tool from operating:
|
|
85
|
-
const {which, standardResult} = act;
|
|
86
|
-
if (! standardResult || standardResult.prevented) {
|
|
87
|
-
// Add this to the score.
|
|
88
|
-
details.prevention[which] = preventionWeight;
|
|
89
|
-
}
|
|
90
|
-
// Otherwise, if a successful standard result exists:
|
|
91
|
-
else if (
|
|
92
|
-
standardResult
|
|
93
|
-
&& standardResult.totals
|
|
94
|
-
&& standardResult.totals.length === 4
|
|
95
|
-
&& standardResult.instances
|
|
96
|
-
) {
|
|
97
|
-
// Add the severity totals of the tool to the score.
|
|
98
|
-
const {totals} = standardResult;
|
|
99
|
-
details.severity.byTool[which] = totals;
|
|
100
|
-
// Add the instance data of the tool to the score.
|
|
101
|
-
standardResult.instances.forEach(instance => {
|
|
102
|
-
let {ruleID} = instance;
|
|
103
|
-
if (! issueIndex[which][ruleID]) {
|
|
104
|
-
ruleID = issueMatcher.find(pattern => {
|
|
105
|
-
const patternRE = new RegExp(pattern);
|
|
106
|
-
return patternRE.test(instance.ruleID);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
if (ruleID) {
|
|
110
|
-
const issueID = issueIndex[which][ruleID];
|
|
111
|
-
if (! details.issue[issueID]) {
|
|
112
|
-
details.issue[issueID] = {
|
|
113
|
-
score: 0,
|
|
114
|
-
maxCount: 0,
|
|
115
|
-
weight: issueClasses[issueID].weight,
|
|
116
|
-
tools: {}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (! details.issue[issueID].tools[which]) {
|
|
120
|
-
details.issue[issueID].tools[which] = {};
|
|
121
|
-
}
|
|
122
|
-
if (! details.issue[issueID].tools[which][ruleID]) {
|
|
123
|
-
const ruleData = issueClasses[issueID].tools[which][ruleID];
|
|
124
|
-
details.issue[issueID].tools[which][ruleID] = {
|
|
125
|
-
quality: ruleData.quality,
|
|
126
|
-
what: ruleData.what,
|
|
127
|
-
complaints: {
|
|
128
|
-
countTotal: 0,
|
|
129
|
-
texts: []
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
details
|
|
134
|
-
.issue[issueID]
|
|
135
|
-
.tools[which][ruleID]
|
|
136
|
-
.complaints
|
|
137
|
-
.countTotal += instance.count || 1;
|
|
138
|
-
if (
|
|
139
|
-
! details
|
|
140
|
-
.issue[issueID]
|
|
141
|
-
.tools[which][ruleID]
|
|
142
|
-
.complaints
|
|
143
|
-
.texts
|
|
144
|
-
.includes(instance.what)
|
|
145
|
-
) {
|
|
146
|
-
details.issue[issueID].tools[which][ruleID].complaints.texts.push(instance.what);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
console.log(`ERROR: ${instance.ruleID} of ${which} not found in issueClasses`);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
// Otherwise, i.e. if a failed standard result exists:
|
|
155
|
-
else {
|
|
156
|
-
// Add an inferred prevention to the score.
|
|
157
|
-
details.prevention[which] = preventionWeight;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
// For each issue with any complaints:
|
|
161
|
-
Object.keys(details.issue).forEach(issueID => {
|
|
162
|
-
const issueData = details.issue[issueID];
|
|
163
|
-
// For each tool with any complaints for the issue:
|
|
164
|
-
Object.keys(issueData.tools).forEach(toolID => {
|
|
165
|
-
// Get the sum of the weighted counts of its issue rules.
|
|
166
|
-
let weightedCount = 0;
|
|
167
|
-
Object.values(issueData.tools[toolID]).forEach(ruleData => {
|
|
168
|
-
weightedCount += ruleData.quality * ruleData.complaints.countTotal;
|
|
169
|
-
});
|
|
170
|
-
// If the sum exceeds the existing maximum weighted count for the issue:
|
|
171
|
-
if (weightedCount > issueData.maxCount) {
|
|
172
|
-
// Change the maximum count for the issue to the sum.
|
|
173
|
-
issueData.maxCount = weightedCount;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
// Get the score for the issue.
|
|
177
|
-
issueData.score = Math.round(issueData.weight * issueData.maxCount);
|
|
178
|
-
});
|
|
179
|
-
// Add the severity detail totals to the score.
|
|
180
|
-
details.severity.total = Object.keys(details.severity.byTool).reduce((severityTotals, toolID) => {
|
|
181
|
-
details.severity.byTool[toolID].forEach((severityScore, index) => {
|
|
182
|
-
severityTotals[index] += severityScore;
|
|
183
|
-
});
|
|
184
|
-
return severityTotals;
|
|
185
|
-
}, details.severity.total);
|
|
186
|
-
// Add the summary issue total to the score.
|
|
187
|
-
summary.issue = Object
|
|
188
|
-
.values(details.issue)
|
|
189
|
-
.reduce((total, current) => total + current.score, 0);
|
|
190
|
-
// Add the summary tool total to the score.
|
|
191
|
-
summary.tool = toolWeight * details.severity.total.reduce(
|
|
192
|
-
(total, current, index) => total + severityWeights[index] * current, 0
|
|
193
|
-
);
|
|
194
|
-
// Add the summary prevention total to the score.
|
|
195
|
-
summary.prevention = Object.values(details.prevention).reduce(
|
|
196
|
-
(total, current) => total + current, 0
|
|
197
|
-
);
|
|
198
|
-
// Add the summary log score to the score.
|
|
199
|
-
const {jobData} = report;
|
|
200
|
-
if (jobData) {
|
|
201
|
-
summary.log = Math.max(0, Math.round(
|
|
202
|
-
logWeights.logCount * jobData.logCount
|
|
203
|
-
+ logWeights.logSize * jobData.logSize +
|
|
204
|
-
+ logWeights.errorLogCount * jobData.errorLogCount
|
|
205
|
-
+ logWeights.errorLogSize * jobData.errorLogSize
|
|
206
|
-
+ logWeights.prohibitedCount * jobData.prohibitedCount +
|
|
207
|
-
+ logWeights.visitRejectionCount * jobData.visitRejectionCount
|
|
208
|
-
));
|
|
209
|
-
// Add the summary latency score to the score.
|
|
210
|
-
summary.latency = Math.round(
|
|
211
|
-
latencyWeight * (Math.max(0, jobData.visitLatency - normalLatency))
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
// Round the unrounded scores.
|
|
215
|
-
Object.keys(summary).forEach(summaryTypeName => {
|
|
216
|
-
summary[summaryTypeName] = Math.round(summary[summaryTypeName]);
|
|
217
|
-
});
|
|
218
|
-
details.severity.total.forEach((severityTotal, index) => {
|
|
219
|
-
details.severity.total[index] = Math.round(severityTotal);
|
|
220
|
-
});
|
|
221
|
-
// Add the summary total score to the score.
|
|
222
|
-
summary.total = summary.issue
|
|
223
|
-
+ summary.tool
|
|
224
|
-
+ summary.prevention
|
|
225
|
-
+ summary.log
|
|
226
|
-
+ summary.latency;
|
|
227
|
-
// Add the score to the report.
|
|
228
|
-
report.score = score;
|
|
229
|
-
}
|
|
230
|
-
// Otherwise, i.e. if none of them is a test act:
|
|
231
|
-
else {
|
|
232
|
-
// Report this.
|
|
233
|
-
console.log('ERROR: No test acts');
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// Otherwise, i.e. if there are no acts in the report:
|
|
237
|
-
else {
|
|
238
|
-
// Report this.
|
|
239
|
-
console.log('ERROR: No acts');
|
|
240
|
-
}
|
|
241
|
-
};
|
package/scripts/ts26.json
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "ts26",
|
|
3
|
-
"what": "tests of 10 tools",
|
|
4
|
-
"strict": true,
|
|
5
|
-
"timeLimit": 600,
|
|
6
|
-
"acts": [
|
|
7
|
-
{
|
|
8
|
-
"type": "placeholder",
|
|
9
|
-
"which": "main",
|
|
10
|
-
"launch": "webkit"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"type": "tenonRequest",
|
|
14
|
-
"id": "a",
|
|
15
|
-
"withNewContent": true,
|
|
16
|
-
"what": "Tenon API version 2 test request, with URL"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"type": "test",
|
|
20
|
-
"which": "testaro",
|
|
21
|
-
"what": "Testaro motion test requiring webkit",
|
|
22
|
-
"withItems": true,
|
|
23
|
-
"rules": ["y", "motion"],
|
|
24
|
-
"args": {
|
|
25
|
-
"motion": [2500, 2500, 5]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"type": "placeholder",
|
|
30
|
-
"which": "main",
|
|
31
|
-
"launch": "chromium"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "test",
|
|
35
|
-
"which": "testaro",
|
|
36
|
-
"what": "Testaro rules except motion",
|
|
37
|
-
"withItems": true,
|
|
38
|
-
"rules": ["n", "motion"],
|
|
39
|
-
"args": {
|
|
40
|
-
"focInd": [false, 250],
|
|
41
|
-
"hover": [20]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"type": "test",
|
|
46
|
-
"which": "alfa",
|
|
47
|
-
"what": "Siteimprove alfa"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"type": "test",
|
|
51
|
-
"which": "axe",
|
|
52
|
-
"detailLevel": 2,
|
|
53
|
-
"rules": [],
|
|
54
|
-
"what": "Axe core, all rules"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"type": "test",
|
|
58
|
-
"which": "continuum",
|
|
59
|
-
"what": "Continuum Community Edition"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"type": "test",
|
|
63
|
-
"which": "htmlcs",
|
|
64
|
-
"what": "HTML CodeSniffer"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "test",
|
|
68
|
-
"which": "ibm",
|
|
69
|
-
"withNewContent": false,
|
|
70
|
-
"withItems": true,
|
|
71
|
-
"what": "IBM Accessibility Checker"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"type": "test",
|
|
75
|
-
"which": "nuVal",
|
|
76
|
-
"what": "Nu Html Checker"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"type": "test",
|
|
80
|
-
"which": "qualWeb",
|
|
81
|
-
"withNewContent": false,
|
|
82
|
-
"what": "QualWeb"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"type": "test",
|
|
86
|
-
"which": "wave",
|
|
87
|
-
"reportType": 4,
|
|
88
|
-
"what": "WAVE, report type 4"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"type": "test",
|
|
92
|
-
"which": "tenon",
|
|
93
|
-
"id": "a",
|
|
94
|
-
"what": "Tenon API version 2 result retrieval"
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
}
|
|
File without changes
|