testilo 12.2.1 → 12.3.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 +6 -4
- package/package.json +1 -1
- package/procs/score/tic27.js +4 -64
- package/script.js +60 -47
package/call.js
CHANGED
|
@@ -55,9 +55,11 @@ const callBatch = async (listID, what) => {
|
|
|
55
55
|
console.log(`Target list ${listID} converted to a batch and saved in ${specDir}/batches`);
|
|
56
56
|
};
|
|
57
57
|
// Fulfills a script-creation request.
|
|
58
|
-
const callScript = async (scriptID, classificationID, ... issueIDs) => {
|
|
59
|
-
// Get
|
|
60
|
-
const
|
|
58
|
+
const callScript = async (scriptID, classificationID = null, ... issueIDs) => {
|
|
59
|
+
// Get any issue classification.
|
|
60
|
+
const issueClasses = classificationID
|
|
61
|
+
? require(`${functionDir}/score/${classificationID}`)
|
|
62
|
+
: null;
|
|
61
63
|
// Create a script.
|
|
62
64
|
const scriptObj = script(scriptID, issueClasses, ... issueIDs);
|
|
63
65
|
// Save the script.
|
|
@@ -176,7 +178,7 @@ else if (fn === 'batch' && fnArgs.length === 2) {
|
|
|
176
178
|
console.log('Execution completed');
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
|
-
else if (fn === 'script' && fnArgs.length
|
|
181
|
+
else if (fn === 'script' && fnArgs.length) {
|
|
180
182
|
callScript(... fnArgs)
|
|
181
183
|
.then(() => {
|
|
182
184
|
console.log('Execution completed');
|
package/package.json
CHANGED
package/procs/score/tic27.js
CHANGED
|
@@ -2258,13 +2258,6 @@ exports.issueClasses = {
|
|
|
2258
2258
|
wcag: '1.3.1',
|
|
2259
2259
|
weight: 4,
|
|
2260
2260
|
tools: {
|
|
2261
|
-
nuVal: {
|
|
2262
|
-
'Element title not allowed as child of element body in this context. (Suppressing further errors from this subtree.)': {
|
|
2263
|
-
variable: false,
|
|
2264
|
-
quality: 1,
|
|
2265
|
-
what: 'title element is a child of the body element'
|
|
2266
|
-
}
|
|
2267
|
-
},
|
|
2268
2261
|
testaro: {
|
|
2269
2262
|
titledEl: {
|
|
2270
2263
|
variable: false,
|
|
@@ -4123,13 +4116,6 @@ exports.issueClasses = {
|
|
|
4123
4116
|
quality: 1,
|
|
4124
4117
|
what: 'list item has no ul, ol, or list-role parent or owner'
|
|
4125
4118
|
}
|
|
4126
|
-
},
|
|
4127
|
-
nuVal: {
|
|
4128
|
-
'Element li not allowed as child of element div in this context. (Suppressing further errors from this subtree.)': {
|
|
4129
|
-
variable: false,
|
|
4130
|
-
quality: 1,
|
|
4131
|
-
what: 'li element is a child of a div element'
|
|
4132
|
-
}
|
|
4133
4119
|
}
|
|
4134
4120
|
}
|
|
4135
4121
|
},
|
|
@@ -6021,56 +6007,15 @@ exports.issueClasses = {
|
|
|
6021
6007
|
}
|
|
6022
6008
|
}
|
|
6023
6009
|
},
|
|
6024
|
-
|
|
6025
|
-
wcag: '1.3.1',
|
|
6026
|
-
weight: 4,
|
|
6027
|
-
tools: {
|
|
6028
|
-
nuVal: {
|
|
6029
|
-
'Element div not allowed as child of element button in this context. (Suppressing further errors from this subtree.)': {
|
|
6030
|
-
variable: false,
|
|
6031
|
-
quality: 1,
|
|
6032
|
-
what: 'div element has a button element as its parent'
|
|
6033
|
-
}
|
|
6034
|
-
}
|
|
6035
|
-
}
|
|
6036
|
-
},
|
|
6037
|
-
pParentBad: {
|
|
6038
|
-
wcag: '1.3.1',
|
|
6039
|
-
weight: 4,
|
|
6040
|
-
tools: {
|
|
6041
|
-
nuVal: {
|
|
6042
|
-
'Element p not allowed as child of element strong in this context. (Suppressing further errors from this subtree.)': {
|
|
6043
|
-
variable: false,
|
|
6044
|
-
quality: 1,
|
|
6045
|
-
what: 'p element has a strong element as its parent'
|
|
6046
|
-
}
|
|
6047
|
-
}
|
|
6048
|
-
}
|
|
6049
|
-
},
|
|
6050
|
-
styleParentBad: {
|
|
6010
|
+
parentBad: {
|
|
6051
6011
|
wcag: '1.3.1',
|
|
6052
6012
|
weight: 4,
|
|
6053
6013
|
tools: {
|
|
6054
6014
|
nuVal: {
|
|
6055
|
-
'Element
|
|
6056
|
-
variable:
|
|
6057
|
-
quality: 1,
|
|
6058
|
-
what: 'style element not allowed as a child of the body element'
|
|
6059
|
-
},
|
|
6060
|
-
'Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)': {
|
|
6061
|
-
variable: false,
|
|
6062
|
-
quality: 1,
|
|
6063
|
-
what: 'style element not allowed as a child of this div element'
|
|
6064
|
-
},
|
|
6065
|
-
'Element style not allowed as child of element main in this context. (Suppressing further errors from this subtree.)': {
|
|
6066
|
-
variable: false,
|
|
6067
|
-
quality: 1,
|
|
6068
|
-
what: 'style element not allowed as a child of this main element'
|
|
6069
|
-
},
|
|
6070
|
-
'Element style not allowed as child of element footer in this context. (Suppressing further errors from this subtree.)': {
|
|
6071
|
-
variable: false,
|
|
6015
|
+
'^Element .+ not allowed as child of element .+ in this context.*$': {
|
|
6016
|
+
variable: true,
|
|
6072
6017
|
quality: 1,
|
|
6073
|
-
what: '
|
|
6018
|
+
what: 'Element has an invalid parent'
|
|
6074
6019
|
}
|
|
6075
6020
|
}
|
|
6076
6021
|
}
|
|
@@ -6915,11 +6860,6 @@ exports.issueClasses = {
|
|
|
6915
6860
|
quality: 1,
|
|
6916
6861
|
what: 'Element is missing a required child'
|
|
6917
6862
|
},
|
|
6918
|
-
'^Element .+ not allowed as child of element .+ in this context.*$': {
|
|
6919
|
-
variable: true,
|
|
6920
|
-
quality: 1,
|
|
6921
|
-
what: 'Element not allowed as a child of its parent here'
|
|
6922
|
-
},
|
|
6923
6863
|
'Saw <!-- within a comment. Probable cause: Nested comment (not allowed).': {
|
|
6924
6864
|
variable: false,
|
|
6925
6865
|
quality: 1,
|
package/script.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
script.js
|
|
3
|
-
Creates and returns a script
|
|
3
|
+
Creates and returns a script.
|
|
4
4
|
Arguments:
|
|
5
5
|
0. issue classification
|
|
6
6
|
1. issue IDs
|
|
@@ -11,57 +11,66 @@
|
|
|
11
11
|
// Module to keep secrets.
|
|
12
12
|
require('dotenv').config();
|
|
13
13
|
|
|
14
|
+
// ########## VARIABLES
|
|
15
|
+
|
|
16
|
+
let toolIDs = [
|
|
17
|
+
'alfa', 'axe', 'continuum', 'htmlcs', 'ibm', 'nuVal', 'qualWeb', 'tenon', 'testaro', 'wave'
|
|
18
|
+
];
|
|
19
|
+
|
|
14
20
|
// ########## FUNCTIONS
|
|
15
21
|
|
|
16
22
|
// Creates and returns a script.
|
|
17
|
-
exports.script = (id, issueClasses, ... issueIDs) => {
|
|
18
|
-
// Initialize data on the
|
|
23
|
+
exports.script = (id, issueClasses = null, ... issueIDs) => {
|
|
24
|
+
// Initialize data on the tools and rules for the specified issues.
|
|
19
25
|
const neededTools = {};
|
|
20
|
-
//
|
|
21
|
-
issueIDs.
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
// If an issue classification and any issues were specified:
|
|
27
|
+
if (issueClasses && issueIDs.length) {
|
|
28
|
+
// For each specified issue:
|
|
29
|
+
issueIDs.forEach(issueID => {
|
|
30
|
+
// If it exists in the classification:
|
|
31
|
+
const issueData = issueClasses[issueID];
|
|
32
|
+
if (issueData) {
|
|
33
|
+
// For each tool that tests for the issue:
|
|
34
|
+
const issueToolIDs = Object.keys(issueData.tools);
|
|
35
|
+
issueToolIDs.forEach(issueToolID => {
|
|
36
|
+
// For each of the rules of the tool for the issue:
|
|
37
|
+
if (! neededTools[issueToolID]) {
|
|
38
|
+
neededTools[issueToolID] = [];
|
|
39
|
+
}
|
|
40
|
+
Object.keys(issueData.tools[issueToolID]).forEach(ruleID => {
|
|
41
|
+
// Add data on the rule.
|
|
42
|
+
const ruleData = issueData.tools[issueToolID][ruleID];
|
|
43
|
+
if (issueToolID === 'nuVal') {
|
|
44
|
+
if (ruleData.variable) {
|
|
45
|
+
neededTools[issueToolID].push(`~${ruleID}`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
neededTools[issueToolID].push(`=${ruleID}`);
|
|
49
|
+
}
|
|
38
50
|
}
|
|
39
51
|
else {
|
|
40
|
-
neededTools[issueToolID].push(
|
|
52
|
+
neededTools[issueToolID].push(ruleID);
|
|
41
53
|
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
neededTools[issueToolID].push(ruleID);
|
|
45
|
-
}
|
|
54
|
+
});
|
|
46
55
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
toolIDs = Object.keys(neededTools);
|
|
57
|
+
}
|
|
58
|
+
// Otherwise, i.e. if it does not exist in the classification:
|
|
59
|
+
else {
|
|
60
|
+
// Report this.
|
|
61
|
+
console.log(`ERROR: Issue ${issueID} not in issue classification`);
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// If any rules have been identified:
|
|
58
67
|
if (toolIDs.length) {
|
|
59
68
|
// Initialize a script.
|
|
60
69
|
const scriptObj = {
|
|
61
70
|
id,
|
|
62
71
|
what: `accessibility tests`,
|
|
63
72
|
strict: true,
|
|
64
|
-
timeLimit: 30 +
|
|
73
|
+
timeLimit: 30 + (10 * issueIDs.length || 30 * toolIDs.length),
|
|
65
74
|
acts: [
|
|
66
75
|
{
|
|
67
76
|
"type": "placeholder",
|
|
@@ -77,7 +86,7 @@ exports.script = (id, issueClasses, ... issueIDs) => {
|
|
|
77
86
|
type: 'tenonRequest',
|
|
78
87
|
id: 'a',
|
|
79
88
|
withNewContent: false,
|
|
80
|
-
what: 'Tenon API version 2 test request, with
|
|
89
|
+
what: 'Tenon API version 2 test request, with page content'
|
|
81
90
|
});
|
|
82
91
|
}
|
|
83
92
|
// For each identified tool:
|
|
@@ -85,13 +94,17 @@ exports.script = (id, issueClasses, ... issueIDs) => {
|
|
|
85
94
|
// Initialize a test act for it.
|
|
86
95
|
const toolAct = {
|
|
87
96
|
type: 'test',
|
|
88
|
-
which: toolID
|
|
89
|
-
rules: neededTools[toolID]
|
|
97
|
+
which: toolID
|
|
90
98
|
};
|
|
91
|
-
// If
|
|
92
|
-
if (
|
|
93
|
-
//
|
|
94
|
-
toolAct.rules
|
|
99
|
+
// If rules were specified:
|
|
100
|
+
if (issueClasses && issueIDs.length) {
|
|
101
|
+
// Add a rules property to the act.
|
|
102
|
+
toolAct.rules = neededTools[toolID];
|
|
103
|
+
// If the tool is Testaro:
|
|
104
|
+
if (toolID === 'testaro') {
|
|
105
|
+
// Prepend the inclusion option to the rule array.
|
|
106
|
+
toolAct.rules.unshift('y');
|
|
107
|
+
}
|
|
95
108
|
}
|
|
96
109
|
// Add option specifications if necessary.
|
|
97
110
|
if (toolID === 'axe') {
|
|
@@ -119,10 +132,10 @@ exports.script = (id, issueClasses, ... issueIDs) => {
|
|
|
119
132
|
// Return the script.
|
|
120
133
|
return scriptObj;
|
|
121
134
|
}
|
|
122
|
-
// Otherwise, i.e. if no
|
|
135
|
+
// Otherwise, i.e. if no rules have been identified:
|
|
123
136
|
else {
|
|
124
137
|
// Report this.
|
|
125
|
-
console.log(`ERROR: No
|
|
138
|
+
console.log(`ERROR: No rules for the specified issues found`);
|
|
126
139
|
return {};
|
|
127
140
|
}
|
|
128
141
|
};
|