testaro 28.2.5 → 29.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/README.md +1 -1
- package/data/template.js +1 -1
- package/package.json +1 -1
- package/procs/testaro.js +2 -6
- package/run.js +6 -4
- package/testaro/attVal.js +1 -1
- package/testaro/autocomplete.js +1 -1
- package/testaro/embAc.js +3 -1
- package/testaro/focInd.js +1 -1
- package/testaro/focOp.js +1 -1
- package/testaro/focVis.js +1 -1
- package/testaro/hover.js +3 -3
- package/testaro/labClash.js +1 -1
- package/testaro/lineHeight.js +1 -1
- package/testaro/linkAmb.js +1 -1
- package/testaro/miniText.js +1 -1
- package/testaro/opFoc.js +1 -1
- package/testaro/pseudoP.js +1 -1
- package/testaro/radioSet.js +1 -1
- package/testaro/targetSize.js +1 -1
- package/testaro/zIndex.js +1 -1
- package/tests/testaro.js +10 -8
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ Testaro helps overcome this format diversity by offering to represent the main f
|
|
|
221
221
|
|
|
222
222
|
In the conceptual scheme underlying the format standardization of Testaro, each tool has its own set of _rules_, where a rule is an algorithm for evaluating a target and determining whether instances of some kind of problem exist in it. With standardization, Testaro reports, in a uniform way, the outcomes from the application of rules by tools to a target.
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
Each job can specify how Testaro is to handle report standardization. A job can contain a `standard` property. If the value of that property is `'also'` or `'only'`, Testaro converts some data in each tool report to the standard format. That permits you to ignore the format idiosyncrasies of the tools. If `standard` has the value `'also'`, the job report includes both formats. If the value is `'only'`, the job report includes only the standard format. If the value is `'no'` (or anything else, or there is no `standard` property), the job report includes only the original format of each tool report.
|
|
225
225
|
|
|
226
226
|
The standard format of each tool report has these properties:
|
|
227
227
|
- `prevented`: `true` if the tool failed to run on the page, or otherwise omitted.
|
package/data/template.js
CHANGED
|
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
13
13
|
// Runs the test and returns the result.
|
|
14
14
|
exports.reporter = async (page, withItems) => {
|
|
15
15
|
// Initialize the locators and result.
|
|
16
|
-
const all = await init(page, 'body a');
|
|
16
|
+
const all = await init(100, page, 'body a');
|
|
17
17
|
// For each locator:
|
|
18
18
|
for (const loc of all.allLocs) {
|
|
19
19
|
// Get whether its element violates the rule.
|
package/package.json
CHANGED
package/procs/testaro.js
CHANGED
|
@@ -7,14 +7,10 @@ const {getSample} = require('../procs/sample');
|
|
|
7
7
|
// Module to get locator data.
|
|
8
8
|
const {getLocatorData} = require('../procs/getLocatorData');
|
|
9
9
|
|
|
10
|
-
// ########## CONSTANTS
|
|
11
|
-
|
|
12
|
-
const sampleMax = 100;
|
|
13
|
-
|
|
14
10
|
// ########## FUNCTIONS
|
|
15
11
|
|
|
16
12
|
// Initializes locators and a result.
|
|
17
|
-
const init = async (page, locAllSelector, options = {}) => {
|
|
13
|
+
const init = async (sampleMax, page, locAllSelector, options = {}) => {
|
|
18
14
|
// Get locators for the specified elements.
|
|
19
15
|
const locPop = page.locator(locAllSelector, options);
|
|
20
16
|
const locPops = await locPop.all();
|
|
@@ -98,7 +94,7 @@ const simplify = async (page, withItems, ruleData) => {
|
|
|
98
94
|
ruleID, selector, pruner, isDestructive, complaints, ordinalSeverity, summaryTagName
|
|
99
95
|
} = ruleData;
|
|
100
96
|
// Initialize the locators and result.
|
|
101
|
-
const all = await init(page, selector);
|
|
97
|
+
const all = await init(100, page, selector);
|
|
102
98
|
// For each locator:
|
|
103
99
|
for (const loc of all.allLocs) {
|
|
104
100
|
// Get whether its element violates the rule.
|
package/run.js
CHANGED
|
@@ -22,8 +22,6 @@ const {tellServer} = require('./procs/tellServer');
|
|
|
22
22
|
const debug = process.env.DEBUG === 'true';
|
|
23
23
|
// Set WAITS environment variable to a positive number to insert delays (in ms).
|
|
24
24
|
const waits = Number.parseInt(process.env.WAITS) || 0;
|
|
25
|
-
// Set STANDARD environment variable to also if not set.
|
|
26
|
-
process.env.STANDARD ??= 'also';
|
|
27
25
|
// CSS selectors for targets of moves.
|
|
28
26
|
const moves = {
|
|
29
27
|
button: 'button, [role=button], input[type=submit]',
|
|
@@ -732,7 +730,7 @@ const doActs = async (report, actIndex, page) => {
|
|
|
732
730
|
const resultCount = Object.keys(toolReport.result).length;
|
|
733
731
|
act.result = resultCount ? toolReport.result : {success: false};
|
|
734
732
|
// If a standard-format result is to be included in the report:
|
|
735
|
-
const standard =
|
|
733
|
+
const standard = report.standard || 'only';
|
|
736
734
|
if (['also', 'only'].includes(standard)) {
|
|
737
735
|
// Initialize it.
|
|
738
736
|
act.standardResult = {
|
|
@@ -743,7 +741,11 @@ const doActs = async (report, actIndex, page) => {
|
|
|
743
741
|
standardize(act);
|
|
744
742
|
// If the original-format result is not to be included in the report:
|
|
745
743
|
if (standard === 'only') {
|
|
746
|
-
// Remove it.
|
|
744
|
+
// Remove it, except any important property.
|
|
745
|
+
if (act.result.important) {
|
|
746
|
+
act.data = act.result.important;
|
|
747
|
+
console.log('>>>>>> Important result data protected from deletion');
|
|
748
|
+
}
|
|
747
749
|
delete act.result;
|
|
748
750
|
}
|
|
749
751
|
// If the test has expectations:
|
package/testaro/attVal.js
CHANGED
|
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
13
13
|
// Runs the test and returns the result.
|
|
14
14
|
exports.reporter = async (page, withItems, attributeName, areLicit, values) => {
|
|
15
15
|
// Initialize the locators and result.
|
|
16
|
-
const all = await init(page, `[${attributeName}]`);
|
|
16
|
+
const all = await init(100, page, `[${attributeName}]`);
|
|
17
17
|
// For each locator:
|
|
18
18
|
for (const loc of all.allLocs) {
|
|
19
19
|
// Get whether its element violates the rule.
|
package/testaro/autocomplete.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.reporter = async (
|
|
|
21
21
|
emailLabels = ['email']
|
|
22
22
|
) => {
|
|
23
23
|
// Initialize the locators and result.
|
|
24
|
-
const all = await init(page, 'input[type=text], input[type=email], input:not([type])');
|
|
24
|
+
const all = await init(100, page, 'input[type=text], input[type=email], input:not([type])');
|
|
25
25
|
// For each locator:
|
|
26
26
|
const autoValues = {
|
|
27
27
|
'given-name': givenLabels,
|
package/testaro/embAc.js
CHANGED
|
@@ -17,7 +17,9 @@ const {init, report} = require('../procs/testaro');
|
|
|
17
17
|
exports.reporter = async (page, withItems) => {
|
|
18
18
|
// Initialize the locators and result.
|
|
19
19
|
const all = await init(
|
|
20
|
-
|
|
20
|
+
100,
|
|
21
|
+
page,
|
|
22
|
+
'a a, a button, a input, a select, button a, button button, button input, button select'
|
|
21
23
|
);
|
|
22
24
|
// For each locator:
|
|
23
25
|
for (const loc of all.allLocs) {
|
package/testaro/focInd.js
CHANGED
|
@@ -27,7 +27,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
27
27
|
// Runs the test and returns the result.
|
|
28
28
|
exports.reporter = async (page, withItems) => {
|
|
29
29
|
// Initialize the locators and result.
|
|
30
|
-
const all = await init(page, 'body *:visible');
|
|
30
|
+
const all = await init(100, page, 'body *:visible');
|
|
31
31
|
all.result.data.focusableCount = 0;
|
|
32
32
|
// For each locator:
|
|
33
33
|
for (const loc of all.allLocs) {
|
package/testaro/focOp.js
CHANGED
|
@@ -22,7 +22,7 @@ const {isOperable} = require('../procs/operable');
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
23
|
exports.reporter = async (page, withItems) => {
|
|
24
24
|
// Initialize the locators and result.
|
|
25
|
-
const all = await init(page, 'body *');
|
|
25
|
+
const all = await init(100, page, 'body *');
|
|
26
26
|
all.result.data.focusableCount = 0;
|
|
27
27
|
// For each locator:
|
|
28
28
|
for (const loc of all.allLocs) {
|
package/testaro/focVis.js
CHANGED
|
@@ -14,7 +14,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
14
14
|
// Runs the test and returns the result.
|
|
15
15
|
exports.reporter = async (page, withItems) => {
|
|
16
16
|
// Initialize the locators and result.
|
|
17
|
-
const all = await init(page, 'a:visible');
|
|
17
|
+
const all = await init(100, page, 'a:visible');
|
|
18
18
|
// For each locator:
|
|
19
19
|
for (const loc of all.allLocs) {
|
|
20
20
|
// Get how its element violates the rule, if it does.
|
package/testaro/hover.js
CHANGED
|
@@ -19,9 +19,10 @@ const {init, report} = require('../procs/testaro');
|
|
|
19
19
|
exports.reporter = async (page, withItems) => {
|
|
20
20
|
// Initialize the locators and result.
|
|
21
21
|
const allTrigger = await init(
|
|
22
|
-
page, '[aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover]'
|
|
22
|
+
20, page, '[aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover]'
|
|
23
23
|
);
|
|
24
24
|
const allNonTrigger = await init(
|
|
25
|
+
30 - allTrigger.result.data.sampleSize,
|
|
25
26
|
page,
|
|
26
27
|
'body *:not([aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover])'
|
|
27
28
|
);
|
|
@@ -64,8 +65,7 @@ exports.reporter = async (page, withItems) => {
|
|
|
64
65
|
all.locs.push([loc, impact]);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
catch(error) {
|
|
68
|
-
}
|
|
68
|
+
catch(error) {}
|
|
69
69
|
}
|
|
70
70
|
// Populate and return the result.
|
|
71
71
|
const whats = [
|
package/testaro/labClash.js
CHANGED
|
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
13
13
|
// Runs the test and returns the result.
|
|
14
14
|
exports.reporter = async (page, withItems) => {
|
|
15
15
|
// Initialize the locators and result.
|
|
16
|
-
const all = await init(page, 'button, input:not([type=hidden]), select, textarea');
|
|
16
|
+
const all = await init(100, page, 'button, input:not([type=hidden]), select, textarea');
|
|
17
17
|
// For each locator:
|
|
18
18
|
for (const loc of all.allLocs) {
|
|
19
19
|
// Get the label types of its element.
|
package/testaro/lineHeight.js
CHANGED
|
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
15
15
|
// Runs the test and returns the result.
|
|
16
16
|
exports.reporter = async (page, withItems) => {
|
|
17
17
|
// Initialize the locators and result.
|
|
18
|
-
const all = await init(page, 'body *', {hasText: /[^\s]/});
|
|
18
|
+
const all = await init(100, page, 'body *', {hasText: /[^\s]/});
|
|
19
19
|
// For each locator:
|
|
20
20
|
for (const loc of all.allLocs) {
|
|
21
21
|
// Get whether its element violates the rule.
|
package/testaro/linkAmb.js
CHANGED
|
@@ -15,7 +15,7 @@ const {getLocatorData} = require('../procs/getLocatorData');
|
|
|
15
15
|
// Runs the test and returns the result.
|
|
16
16
|
exports.reporter = async (page, withItems) => {
|
|
17
17
|
// Initialize the locators and result.
|
|
18
|
-
const all = await init(page, 'a[href]:visible');
|
|
18
|
+
const all = await init(100, page, 'a[href]:visible');
|
|
19
19
|
const linkTexts = new Set();
|
|
20
20
|
// For each locator:
|
|
21
21
|
for (const loc of all.allLocs) {
|
package/testaro/miniText.js
CHANGED
|
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
13
13
|
// Runs the test and returns the result.
|
|
14
14
|
exports.reporter = async (page, withItems) => {
|
|
15
15
|
// Initialize the locators and result.
|
|
16
|
-
const all = await init(page, 'body *:not(script, style):visible', {hasText: /[^\s]+/});
|
|
16
|
+
const all = await init(100, page, 'body *:not(script, style):visible', {hasText: /[^\s]+/});
|
|
17
17
|
// For each locator:
|
|
18
18
|
for (const loc of all.allLocs) {
|
|
19
19
|
// Get the font size of its element if less than 11 pixels.
|
package/testaro/opFoc.js
CHANGED
|
@@ -22,7 +22,7 @@ const {isOperable} = require('../procs/operable');
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
23
|
exports.reporter = async (page, withItems) => {
|
|
24
24
|
// Initialize the locators and result.
|
|
25
|
-
const all = await init(page, 'body *');
|
|
25
|
+
const all = await init(100, page, 'body *');
|
|
26
26
|
all.result.data.operableCount = 0;
|
|
27
27
|
// For each locator:
|
|
28
28
|
for (const loc of all.allLocs) {
|
package/testaro/pseudoP.js
CHANGED
|
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
15
15
|
// Runs the test and returns the result.
|
|
16
16
|
exports.reporter = async (page, withItems) => {
|
|
17
17
|
// Initialize the locators and result.
|
|
18
|
-
const all = await init(page, 'body br + br');
|
|
18
|
+
const all = await init(100, page, 'body br + br');
|
|
19
19
|
// For each locator:
|
|
20
20
|
for (const loc of all.allLocs) {
|
|
21
21
|
// Return whether the second br element violates the rule.
|
package/testaro/radioSet.js
CHANGED
|
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
15
15
|
// Runs the test and returns the result.
|
|
16
16
|
exports.reporter = async (page, withItems) => {
|
|
17
17
|
// Initialize the locators and result.
|
|
18
|
-
const all = await init(page, 'input[type=radio]');
|
|
18
|
+
const all = await init(100, page, 'input[type=radio]');
|
|
19
19
|
const params = {
|
|
20
20
|
nameLeak: 'shares a name with others outside its field set',
|
|
21
21
|
fsMixed: 'shares a field set with others having different names',
|
package/testaro/targetSize.js
CHANGED
|
@@ -16,7 +16,7 @@ const {isInlineLink} = require('../procs/isInlineLink');
|
|
|
16
16
|
// Runs the test and returns the result.
|
|
17
17
|
exports.reporter = async (page, withItems) => {
|
|
18
18
|
// Initialize the locators and result.
|
|
19
|
-
const all = await init(page, 'a, button, input');
|
|
19
|
+
const all = await init(100, page, 'a, button, input');
|
|
20
20
|
// For each locator:
|
|
21
21
|
for (const loc of all.allLocs) {
|
|
22
22
|
// Get the size of its element, if small.
|
package/testaro/zIndex.js
CHANGED
|
@@ -18,7 +18,7 @@ const {init, report} = require('../procs/testaro');
|
|
|
18
18
|
// Runs the test and returns the result.
|
|
19
19
|
exports.reporter = async (page, withItems) => {
|
|
20
20
|
// Initialize the locators and result.
|
|
21
|
-
const all = await init(page, 'body *');
|
|
21
|
+
const all = await init(100, page, 'body *');
|
|
22
22
|
// For each locator:
|
|
23
23
|
for (const loc of all.allLocs) {
|
|
24
24
|
// Get whether its element violates the rule.
|
package/tests/testaro.js
CHANGED
|
@@ -88,7 +88,7 @@ const jsonTest = async (ruleID, ruleArgs) => {
|
|
|
88
88
|
const ruleJSON = await fs.readFile(`${__dirname}/../testaro/${ruleID}.json`, 'utf8');
|
|
89
89
|
const ruleObj = JSON.parse(ruleJSON);
|
|
90
90
|
// Initialize the locators and result.
|
|
91
|
-
const all = await init(page, ruleObj.selector);
|
|
91
|
+
const all = await init(100, page, ruleObj.selector);
|
|
92
92
|
all.locs = all.allLocs;
|
|
93
93
|
// Populate and return the result.
|
|
94
94
|
const whats = [
|
|
@@ -107,9 +107,11 @@ exports.reporter = async (page, options) => {
|
|
|
107
107
|
// Initialize the data.
|
|
108
108
|
const data = {
|
|
109
109
|
rules: {},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
important: {
|
|
111
|
+
preventions: [],
|
|
112
|
+
invalid: [],
|
|
113
|
+
testTimes: {}
|
|
114
|
+
}
|
|
113
115
|
};
|
|
114
116
|
// If the rule specification is valid:
|
|
115
117
|
if (
|
|
@@ -163,7 +165,7 @@ exports.reporter = async (page, options) => {
|
|
|
163
165
|
});
|
|
164
166
|
data.rules[rule].totals = data.rules[rule].totals.map(total => Math.round(total));
|
|
165
167
|
if (ruleReport.prevented) {
|
|
166
|
-
data.preventions.push(rule);
|
|
168
|
+
data.important.preventions.push(rule);
|
|
167
169
|
}
|
|
168
170
|
// If testing is to stop after a failure and the page failed the test:
|
|
169
171
|
if (stopOnFail && ruleReport.totals.some(total => total)) {
|
|
@@ -174,19 +176,19 @@ exports.reporter = async (page, options) => {
|
|
|
174
176
|
// If an error is thrown by the test:
|
|
175
177
|
catch(error) {
|
|
176
178
|
// Report this.
|
|
177
|
-
data.preventions.push(rule);
|
|
179
|
+
data.important.preventions.push(rule);
|
|
178
180
|
console.log(`ERROR: Test of testaro rule ${rule} prevented (${error.message})`);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
// Otherwise, i.e. if the rule is undefined or doubly defined:
|
|
182
184
|
else {
|
|
183
185
|
// Report this.
|
|
184
|
-
data.invalid.push(rule);
|
|
186
|
+
data.important.invalid.push(rule);
|
|
185
187
|
console.log(`ERROR: Rule ${rule} not validly defined`);
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
testTimes.sort((a, b) => b[1] - a[1]).forEach(pair => {
|
|
189
|
-
data.testTimes[pair[0]] = pair[1];
|
|
191
|
+
data.important.testTimes[pair[0]] = pair[1];
|
|
190
192
|
});
|
|
191
193
|
}
|
|
192
194
|
// Otherwise, i.e. if the rule specification is invalid:
|