testaro 74.2.3 → 75.0.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/LICENSE +2 -0
- package/README.md +52 -59
- package/actSpecs-doc.md +25 -1
- package/actSpecs.js +6 -4
- package/package.json +1 -1
- package/procs/catalog.js +0 -1
- package/procs/dateTime.js +4 -2
- package/procs/doActs.js +15 -8
- package/procs/launch.js +0 -1
- package/procs/shoot.js +48 -43
- package/testaro/adbID.js +2 -2
- package/testaro/allCapStyle.js +2 -2
- package/testaro/allCaps.js +3 -3
- package/testaro/allHidden.js +2 -2
- package/testaro/allSlanted.js +2 -2
- package/testaro/altScheme.js +2 -2
- package/testaro/attVal.js +2 -2
- package/testaro/autocomplete.js +3 -2
- package/testaro/bulk.js +2 -2
- package/testaro/buttonMenu.js +3 -3
- package/testaro/captionLoc.js +2 -2
- package/testaro/datalistRef.js +2 -2
- package/testaro/distortion.js +2 -2
- package/testaro/docType.js +1 -1
- package/testaro/dupAtt.js +2 -2
- package/testaro/embAc.js +2 -2
- package/testaro/focAll.js +2 -2
- package/testaro/focAndOp.js +2 -2
- package/testaro/focInd.js +2 -2
- package/testaro/focVis.js +2 -2
- package/testaro/headEl.js +2 -2
- package/testaro/headingAmb.js +2 -2
- package/testaro/hovInd.js +2 -2
- package/testaro/hover.js +2 -2
- package/testaro/hr.js +2 -2
- package/testaro/imageLink.js +2 -2
- package/testaro/labClash.js +2 -2
- package/testaro/legendLoc.js +2 -2
- package/testaro/lineHeight.js +2 -2
- package/testaro/linkAmb.js +2 -2
- package/testaro/linkExt.js +2 -2
- package/testaro/linkOldAtt.js +2 -2
- package/testaro/linkTo.js +2 -2
- package/testaro/linkUl.js +2 -2
- package/testaro/miniText.js +2 -2
- package/testaro/motion.js +6 -6
- package/testaro/nonTable.js +2 -2
- package/testaro/optRoleSel.js +2 -2
- package/testaro/phOnly.js +2 -2
- package/testaro/pseudoP.js +2 -2
- package/testaro/radioSet.js +2 -2
- package/testaro/role.js +2 -2
- package/testaro/secHeading.js +2 -2
- package/testaro/shoot0.js +11 -2
- package/testaro/shoot1.js +12 -4
- package/testaro/styleDiff.js +2 -2
- package/testaro/tabNav.js +2 -2
- package/testaro/targetsNear.js +2 -2
- package/testaro/textNodes.js +1 -1
- package/testaro/textSem.js +2 -2
- package/testaro/titledEl.js +2 -2
- package/testaro/zIndex.js +2 -2
- package/tests/testaro.js +2 -10
package/testaro/optRoleSel.js
CHANGED
|
@@ -22,7 +22,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
22
22
|
// FUNCTIONS
|
|
23
23
|
|
|
24
24
|
// Runs the test and returns the result.
|
|
25
|
-
exports.reporter = async (page,
|
|
25
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
26
26
|
const getBadWhat = element => {
|
|
27
27
|
// If the element has no aria-selected attribute:
|
|
28
28
|
if (! element.hasAttribute('aria-selected')) {
|
|
@@ -32,6 +32,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
32
32
|
};
|
|
33
33
|
const whats = 'Elements with role=option have no aria-selected attributes';
|
|
34
34
|
return await doTest(
|
|
35
|
-
page, catalog, withItems, 'optRoleSel', 'body [role="option"]', whats, 1, getBadWhat.toString()
|
|
35
|
+
page, report.catalog, withItems, 'optRoleSel', 'body [role="option"]', whats, 1, getBadWhat.toString()
|
|
36
36
|
);
|
|
37
37
|
};
|
package/testaro/phOnly.js
CHANGED
|
@@ -22,7 +22,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
22
22
|
// FUNCTIONS
|
|
23
23
|
|
|
24
24
|
// Runs the test and returns the result.
|
|
25
|
-
exports.reporter = async (page,
|
|
25
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
26
26
|
const getBadWhat = element => {
|
|
27
27
|
// Get the accessible name of the element.
|
|
28
28
|
const accessibleName = window.getAccessibleName(element);
|
|
@@ -34,6 +34,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
34
34
|
};
|
|
35
35
|
const whats = 'input elements have placeholders but no accessible names';
|
|
36
36
|
return await doTest(
|
|
37
|
-
page, catalog, withItems, 'phOnly', 'body input[placeholder]', whats, 2, getBadWhat.toString()
|
|
37
|
+
page, report.catalog, withItems, 'phOnly', 'body input[placeholder]', whats, 2, getBadWhat.toString()
|
|
38
38
|
);
|
|
39
39
|
};
|
package/testaro/pseudoP.js
CHANGED
|
@@ -18,7 +18,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
18
18
|
// FUNCTIONS
|
|
19
19
|
|
|
20
20
|
// Runs the test and returns the result.
|
|
21
|
-
exports.reporter = async (page,
|
|
21
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
22
22
|
const getBadWhat = element => {
|
|
23
23
|
// Get the node before the element node.
|
|
24
24
|
const previousNode = element.previousSibling;
|
|
@@ -49,6 +49,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
49
49
|
};
|
|
50
50
|
const whats = 'br elements follow other br elements, possibly constituting pseudo-paragraphs';
|
|
51
51
|
return await doTest(
|
|
52
|
-
page, catalog, withItems, 'pseudoP', 'body br', whats, 0, getBadWhat.toString()
|
|
52
|
+
page, report.catalog, withItems, 'pseudoP', 'body br', whats, 0, getBadWhat.toString()
|
|
53
53
|
);
|
|
54
54
|
};
|
package/testaro/radioSet.js
CHANGED
|
@@ -19,7 +19,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
19
19
|
// FUNCTIONS
|
|
20
20
|
|
|
21
21
|
// Runs the test and returns the result.
|
|
22
|
-
exports.reporter = async (page,
|
|
22
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
23
23
|
const getBadWhat = element => {
|
|
24
24
|
// Get the name of the element.
|
|
25
25
|
const elName = element.name;
|
|
@@ -69,6 +69,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
69
69
|
};
|
|
70
70
|
const whats = 'Radio buttons are not validly grouped in fieldsets with legends';
|
|
71
71
|
return await doTest(
|
|
72
|
-
page, catalog, withItems, 'radioSet', 'body input[type=radio]', whats, 2, getBadWhat.toString()
|
|
72
|
+
page, report.catalog, withItems, 'radioSet', 'body input[type=radio]', whats, 2, getBadWhat.toString()
|
|
73
73
|
);
|
|
74
74
|
};
|
package/testaro/role.js
CHANGED
|
@@ -25,7 +25,7 @@ const implicitRoles = new Set(Array.from(elementRoles.values()).flat());
|
|
|
25
25
|
// FUNCTIONS
|
|
26
26
|
|
|
27
27
|
// Runs the test and returns the result.
|
|
28
|
-
exports.reporter = async (page,
|
|
28
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
29
29
|
// Get locators for the elements with explicit roles.
|
|
30
30
|
const loc = page.locator('[role]');
|
|
31
31
|
const locs = await loc.all();
|
|
@@ -44,5 +44,5 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
44
44
|
}
|
|
45
45
|
// Get and return a result.
|
|
46
46
|
const whats = 'Elements have roles assigned that are also implicit HTML element roles';
|
|
47
|
-
return await getBasicResult(catalog, withItems, 'role', 0, whats, {}, violations);
|
|
47
|
+
return await getBasicResult(report.catalog, withItems, 'role', 0, whats, {}, violations);
|
|
48
48
|
};
|
package/testaro/secHeading.js
CHANGED
|
@@ -20,7 +20,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
20
20
|
// FUNCTIONS
|
|
21
21
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
|
-
exports.reporter = async (page,
|
|
23
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
24
24
|
const getBadWhat = element => {
|
|
25
25
|
// Get the children of the element.
|
|
26
26
|
const children = Array.from(element.children);
|
|
@@ -44,6 +44,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
44
44
|
const selector = 'body section, body article, body nav, body aside, body main';
|
|
45
45
|
const whats = 'First child headings of sectioning containers are deeper than others';
|
|
46
46
|
return await doTest(
|
|
47
|
-
page, catalog, withItems, 'secHeading', selector, whats, 0, getBadWhat.toString()
|
|
47
|
+
page, report.catalog, withItems, 'secHeading', selector, whats, 0, getBadWhat.toString()
|
|
48
48
|
);
|
|
49
49
|
};
|
package/testaro/shoot0.js
CHANGED
|
@@ -15,9 +15,18 @@ const {shoot} = require('../procs/shoot');
|
|
|
15
15
|
// FUNCTIONS
|
|
16
16
|
|
|
17
17
|
// Makes and saves the first screenshot.
|
|
18
|
-
exports.reporter = async (page,
|
|
18
|
+
exports.reporter = async (page, report) => {
|
|
19
19
|
// Make and save the screenshot.
|
|
20
|
-
const pngPath = await shoot(page,
|
|
20
|
+
const pngPath = await shoot(page, report, {
|
|
21
|
+
exclusionSelector: '',
|
|
22
|
+
colorType: 0,
|
|
23
|
+
action: 'file'
|
|
24
|
+
});
|
|
25
|
+
// If this succeeded:
|
|
26
|
+
if (pngPath) {
|
|
27
|
+
// Add the file path to the report.
|
|
28
|
+
report.jobData.testaroShoot0 = pngPath;
|
|
29
|
+
}
|
|
21
30
|
// Return whether the screenshot was prevented.
|
|
22
31
|
return {
|
|
23
32
|
data: {
|
package/testaro/shoot1.js
CHANGED
|
@@ -16,13 +16,21 @@ const {shoot} = require('../procs/shoot');
|
|
|
16
16
|
// FUNCTIONS
|
|
17
17
|
|
|
18
18
|
// Make and save the second screenshot.
|
|
19
|
-
exports.reporter = async (page,
|
|
20
|
-
const tempFileNames = await fs.readdir(tmpDir);
|
|
19
|
+
exports.reporter = async (page, report) => {
|
|
21
20
|
let pngPath = '';
|
|
22
21
|
// If there is a shoot0 file:
|
|
23
|
-
if (
|
|
22
|
+
if (report.jobData.testaroShoot0) {
|
|
24
23
|
// Make and save the screenshot.
|
|
25
|
-
pngPath = await shoot(page,
|
|
24
|
+
pngPath = await shoot(page, report, {
|
|
25
|
+
exclusionSelector: null,
|
|
26
|
+
colorType: 0,
|
|
27
|
+
action: 'file'
|
|
28
|
+
});
|
|
29
|
+
// If this succeeded:
|
|
30
|
+
if (pngPath) {
|
|
31
|
+
// Add the file path to the report.
|
|
32
|
+
report.jobData.testaroShoot1 = pngPath;
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
// Return whether the screenshot was prevented.
|
|
28
36
|
return {
|
package/testaro/styleDiff.js
CHANGED
|
@@ -81,10 +81,10 @@ const linksByType = async page => await page.evaluateHandle(() => {
|
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
83
|
// Runs the test and returns the result.
|
|
84
|
-
exports.reporter = async (page,
|
|
84
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
85
85
|
// Get an object with arrays of list links and adjacent links as properties.
|
|
86
86
|
const linkTypes = await linksByType(page);
|
|
87
|
-
const catalogIndex = getXPathCatalogIndex(catalog, '/html/body');
|
|
87
|
+
const catalogIndex = getXPathCatalogIndex(report.catalog, '/html/body');
|
|
88
88
|
return await page.evaluate(args => {
|
|
89
89
|
const [linkTypes, withItems, catalogIndex] = args;
|
|
90
90
|
const {body} = document;
|
package/testaro/tabNav.js
CHANGED
|
@@ -286,7 +286,7 @@ const testTabLists = async (tabLists, withItems, page) => {
|
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
288
|
// Runs the test and returns the result.
|
|
289
|
-
exports.reporter = async (page,
|
|
289
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
290
290
|
// Initialize the results.
|
|
291
291
|
data.totals = {
|
|
292
292
|
navigations: {
|
|
@@ -374,7 +374,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
374
374
|
what: `Tab responds nonstandardly to ${item.navigationErrors.join(', ')}`,
|
|
375
375
|
ordinalSeverity: 1,
|
|
376
376
|
count: 1,
|
|
377
|
-
catalogIndex: getXPathCatalogIndex(catalog, item.xPath)
|
|
377
|
+
catalogIndex: getXPathCatalogIndex(report.catalog, item.xPath)
|
|
378
378
|
});
|
|
379
379
|
});
|
|
380
380
|
}
|
package/testaro/targetsNear.js
CHANGED
|
@@ -20,7 +20,7 @@ const {getXPathCatalogIndex} = require('../procs/xPath');
|
|
|
20
20
|
// FUNCTIONS
|
|
21
21
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
|
-
exports.reporter = async (page,
|
|
23
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
24
24
|
// Return totals and standard instances for the rule.
|
|
25
25
|
const protoResult = await page.evaluate(withItems => {
|
|
26
26
|
// Get all pointer targets.
|
|
@@ -142,7 +142,7 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
142
142
|
}, withItems);
|
|
143
143
|
// Convert the XPaths of the proto-instances to catalog indexes.
|
|
144
144
|
protoResult.standardInstances = protoResult.standardInstances.map(instance => {
|
|
145
|
-
instance.catalogIndex = getXPathCatalogIndex(catalog, instance.xPath);
|
|
145
|
+
instance.catalogIndex = getXPathCatalogIndex(report.catalog, instance.xPath);
|
|
146
146
|
delete instance.xPath;
|
|
147
147
|
return instance;
|
|
148
148
|
});
|
package/testaro/textNodes.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// FUNCTIONS
|
|
19
19
|
|
|
20
20
|
// Runs the test and returns the result.
|
|
21
|
-
exports.reporter = async (page,
|
|
21
|
+
exports.reporter = async (page, _0, _1, _2, detailLevel, text = '') => {
|
|
22
22
|
let data = {};
|
|
23
23
|
// Get the data on the text nodes.
|
|
24
24
|
try {
|
package/testaro/textSem.js
CHANGED
|
@@ -19,7 +19,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
19
19
|
// FUNCTIONS
|
|
20
20
|
|
|
21
21
|
// Runs the test and returns the result.
|
|
22
|
-
exports.reporter = async (page,
|
|
22
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
23
23
|
const getBadWhat = element => {
|
|
24
24
|
const isVisible = element.checkVisibility({
|
|
25
25
|
contentVisibilityAuto: true,
|
|
@@ -38,6 +38,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
38
38
|
const selector = 'body i, body b, body small';
|
|
39
39
|
const whats = 'Semantically vague elements i, b, and/or small are used';
|
|
40
40
|
return await doTest(
|
|
41
|
-
page, catalog, withItems, 'textSem', selector, whats, 0, getBadWhat.toString()
|
|
41
|
+
page, report.catalog, withItems, 'textSem', selector, whats, 0, getBadWhat.toString()
|
|
42
42
|
);
|
|
43
43
|
};
|
package/testaro/titledEl.js
CHANGED
|
@@ -20,7 +20,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
20
20
|
// FUNCTIONS
|
|
21
21
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
|
-
exports.reporter = async (page,
|
|
23
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
24
24
|
const getBadWhat = element => {
|
|
25
25
|
const elementType = element.tagName.toLowerCase();
|
|
26
26
|
// Return a violation description.
|
|
@@ -29,6 +29,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
29
29
|
const selector = 'body [title]:not(iframe, link, style)';
|
|
30
30
|
const whats = 'title attributes are used on elements they are likely ineffective on';
|
|
31
31
|
return await doTest(
|
|
32
|
-
page, catalog, withItems, 'titledEl', selector, whats, 0, getBadWhat.toString()
|
|
32
|
+
page, report.catalog, withItems, 'titledEl', selector, whats, 0, getBadWhat.toString()
|
|
33
33
|
);
|
|
34
34
|
};
|
package/testaro/zIndex.js
CHANGED
|
@@ -20,7 +20,7 @@ const {doTest} = require('../procs/testaro');
|
|
|
20
20
|
// FUNCTIONS
|
|
21
21
|
|
|
22
22
|
// Runs the test and returns the result.
|
|
23
|
-
exports.reporter = async (page,
|
|
23
|
+
exports.reporter = async (page, report, _, withItems) => {
|
|
24
24
|
const getBadWhat = element => {
|
|
25
25
|
// Get whether the element violates the rule.
|
|
26
26
|
const styleDec = window.getComputedStyle(element);
|
|
@@ -33,6 +33,6 @@ exports.reporter = async (page, catalog, withItems) => {
|
|
|
33
33
|
};
|
|
34
34
|
const whats = 'Elements have non-default Z indexes';
|
|
35
35
|
return await doTest(
|
|
36
|
-
page, catalog, withItems, 'zIndex', 'body, body *', whats, 0, getBadWhat.toString()
|
|
36
|
+
page, report.catalog, withItems, 'zIndex', 'body, body *', whats, 0, getBadWhat.toString()
|
|
37
37
|
);
|
|
38
38
|
};
|
package/tests/testaro.js
CHANGED
|
@@ -459,14 +459,6 @@ process.on('unhandledRejection', reason => {
|
|
|
459
459
|
|
|
460
460
|
// FUNCTIONS
|
|
461
461
|
|
|
462
|
-
// Waits.
|
|
463
|
-
const wait = ms => {
|
|
464
|
-
return new Promise(resolve => {
|
|
465
|
-
setTimeout(() => {
|
|
466
|
-
resolve('');
|
|
467
|
-
}, ms);
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
462
|
// Conducts and reports Testaro tests.
|
|
471
463
|
exports.reporter = async (page, report, actIndex) => {
|
|
472
464
|
const act = report.acts[actIndex];
|
|
@@ -578,13 +570,13 @@ exports.reporter = async (page, report, actIndex) => {
|
|
|
578
570
|
browser.on('disconnected', disconnectHandler);
|
|
579
571
|
}
|
|
580
572
|
// Initialize an argument array for the reporter.
|
|
581
|
-
const ruleArgs = [page, report
|
|
573
|
+
const ruleArgs = [page, report, actIndex, withItems];
|
|
582
574
|
// If the rule needs a temporary directory:
|
|
583
575
|
if (rule.needsTmpDir) {
|
|
584
576
|
// Add its path to the argument array.
|
|
585
577
|
ruleArgs.push(report.jobData.tmpDir);
|
|
586
578
|
}
|
|
587
|
-
// If the
|
|
579
|
+
// If the testaro test act specifies extra arguments for this rule:
|
|
588
580
|
if (argRules?.includes(ruleResult.id)) {
|
|
589
581
|
// Add them to the argument array.
|
|
590
582
|
ruleArgs.push(... args[ruleResult.id]);
|