testilo 3.4.0 → 3.6.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/README.md +18 -47
- package/package.json +1 -1
- package/procs/digest/dp11a/index.html +76 -0
- package/procs/digest/dp11a/index.js +127 -0
- package/procs/score/sp11a.js +1968 -0
- package/procs/score/sp12a.js +2103 -0
- package/score.js +14 -8
- package/scoring/procs/tempgroup.js +96 -0
package/score.js
CHANGED
|
@@ -15,23 +15,29 @@ const fs = require('fs/promises');
|
|
|
15
15
|
|
|
16
16
|
const reportDirRaw = process.env.REPORTDIR_RAW || 'reports/raw';
|
|
17
17
|
const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
|
|
18
|
-
const
|
|
19
|
-
const
|
|
18
|
+
const scoreProcID = process.argv[2];
|
|
19
|
+
const reportIDStart = process.argv[3];
|
|
20
20
|
|
|
21
21
|
// ########## FUNCTIONS
|
|
22
22
|
|
|
23
|
+
// Score the specified reports.
|
|
23
24
|
const score = async () => {
|
|
25
|
+
// Identify the reports to be scored.
|
|
24
26
|
const reportDirRawAbs = `${__dirname}/${reportDirRaw}`;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
let reportFileNames = await fs.readdir(reportDirRawAbs);
|
|
28
|
+
reportFileNames = reportFileNames.filter(fileName => fileName.endsWith('.json'));
|
|
29
|
+
if (reportIDStart) {
|
|
30
|
+
reportFileNames = reportFileNames.filter(fileName => fileName.startsWith(reportIDStart));
|
|
31
|
+
}
|
|
32
|
+
// For each of them:
|
|
28
33
|
const {scorer} = require(`./procs/score/${scoreProcID}`);
|
|
29
|
-
for (const fileName of
|
|
30
|
-
|
|
31
|
-
.readFile(`${reportDirRawAbs}/${fileName}`, 'utf8');
|
|
34
|
+
for (const fileName of reportFileNames) {
|
|
35
|
+
// Score it.
|
|
36
|
+
const reportJSON = await fs.readFile(`${reportDirRawAbs}/${fileName}`, 'utf8');
|
|
32
37
|
const report = JSON.parse(reportJSON);
|
|
33
38
|
await scorer(report);
|
|
34
39
|
report.score.scoreProcID = scoreProcID;
|
|
40
|
+
// Write it to a file.
|
|
35
41
|
const scoredReportJSON = JSON.stringify(report, null, 2);
|
|
36
42
|
await fs.writeFile(`${__dirname}/${reportDirScored}/${fileName}`, `${scoredReportJSON}\n`);
|
|
37
43
|
console.log(`Report ${fileName.slice(0, -5)} scored and saved`);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
tempgroup
|
|
3
|
+
Converts groups.json for inclusion in score procs.
|
|
4
|
+
*/
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
// Initialize the data.
|
|
7
|
+
const groupWeights = {
|
|
8
|
+
accessKeyDuplicate: 3,
|
|
9
|
+
activeEmbedding: 2,
|
|
10
|
+
allCaps: 1,
|
|
11
|
+
ariaReferenceBad: 4,
|
|
12
|
+
autocompleteBad: 2,
|
|
13
|
+
buttonNoText: 4,
|
|
14
|
+
childMissing: 3,
|
|
15
|
+
contrastAA: 3,
|
|
16
|
+
contrastAAA: 1,
|
|
17
|
+
duplicateID: 2,
|
|
18
|
+
eventKeyboard: 3,
|
|
19
|
+
fieldSetMissing: 2,
|
|
20
|
+
focusableOperable: 3,
|
|
21
|
+
focusIndication: 3,
|
|
22
|
+
h1Missing: 1,
|
|
23
|
+
headingEmpty: 2,
|
|
24
|
+
headingStructure: 2,
|
|
25
|
+
hoverSurprise: 1,
|
|
26
|
+
iframeNoText: 3,
|
|
27
|
+
imageInputNoText: 4,
|
|
28
|
+
imageMapAreaNoText: 3,
|
|
29
|
+
imageNoText: 4,
|
|
30
|
+
imageTextRedundant: 1,
|
|
31
|
+
inconsistentStyles: 1,
|
|
32
|
+
contrastRisk: 1,
|
|
33
|
+
labelClash: 2,
|
|
34
|
+
labelForBadID: 4,
|
|
35
|
+
languageChange: 2,
|
|
36
|
+
leadingClipsText: 3,
|
|
37
|
+
leadingFrozen: 3,
|
|
38
|
+
linkForcesNewWindow: 2,
|
|
39
|
+
linkNoText: 4,
|
|
40
|
+
linkPair: 1,
|
|
41
|
+
linkTextsSame: 2,
|
|
42
|
+
linkTitleRedundant: 1,
|
|
43
|
+
linkUnderlines: 2,
|
|
44
|
+
menuNavigation: 2,
|
|
45
|
+
metaBansZoom: 3,
|
|
46
|
+
nameValue: 3,
|
|
47
|
+
noLeading: 2,
|
|
48
|
+
objectNoText: 2,
|
|
49
|
+
pageLanguage: 3,
|
|
50
|
+
pageLanguageBad: 3,
|
|
51
|
+
pageTitle: 3,
|
|
52
|
+
parentMissing: 3,
|
|
53
|
+
pseudoHeadingRisk: 1,
|
|
54
|
+
pseudoLinkRisk: 2,
|
|
55
|
+
pseudoListRisk: 1,
|
|
56
|
+
roleBad: 3,
|
|
57
|
+
roleBadAttribute: 3,
|
|
58
|
+
roleMissingAttribute: 3,
|
|
59
|
+
selectFlatRisk: 1,
|
|
60
|
+
selectNoText: 3,
|
|
61
|
+
spontaneousMotion: 2,
|
|
62
|
+
svgImageNoText: 4,
|
|
63
|
+
tabFocusability: 3,
|
|
64
|
+
tabNavigation: 2,
|
|
65
|
+
targetSize: 2,
|
|
66
|
+
textBeyondLandmarks: 1,
|
|
67
|
+
visibleBulk: 1,
|
|
68
|
+
zIndexNotZero: 1
|
|
69
|
+
};
|
|
70
|
+
const groups = {};
|
|
71
|
+
const compile = () => {
|
|
72
|
+
const oldGroupsJSON = fs.readFileSync(`${__dirname}/../data/groups.json`, 'utf8');
|
|
73
|
+
const oldGroups = JSON.parse(oldGroupsJSON);
|
|
74
|
+
const groupIDs = Object.keys(oldGroups);
|
|
75
|
+
groupIDs.forEach(groupID => {
|
|
76
|
+
groups[groupID] = {
|
|
77
|
+
weight: groupWeights[groupID] || 0,
|
|
78
|
+
packages: {}
|
|
79
|
+
};
|
|
80
|
+
const packageIDs = Object.keys(oldGroups[groupID]);
|
|
81
|
+
packageIDs.forEach(packageID => {
|
|
82
|
+
groups[groupID].packages[packageID] = {};
|
|
83
|
+
const testStrings = oldGroups[groupID][packageID];
|
|
84
|
+
testStrings.forEach(testString => {
|
|
85
|
+
const testID = testString.replace(/ .+/, '');
|
|
86
|
+
const testWhat = testString.replace(/^[^ ]+ /, '');
|
|
87
|
+
groups[groupID].packages[packageID][testID] = {
|
|
88
|
+
weight: 0,
|
|
89
|
+
what: testWhat
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
console.log(JSON.stringify(groups, null, 2));
|
|
95
|
+
};
|
|
96
|
+
compile();
|