testaro 55.5.11 → 55.5.13
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/package.json
CHANGED
package/testaro/linkAmb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
© 2023 CVS Health and/or one of its affiliates. All rights reserved.
|
|
2
|
+
© 2023–2025 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
3
|
|
|
4
4
|
MIT License
|
|
5
5
|
|
|
@@ -40,21 +40,29 @@ const {getLocatorData} = require('../procs/getLocatorData');
|
|
|
40
40
|
exports.reporter = async (page, withItems) => {
|
|
41
41
|
// Initialize the locators and result.
|
|
42
42
|
const all = await init(100, page, 'a[href]:visible');
|
|
43
|
-
const
|
|
43
|
+
const linksData = [];
|
|
44
44
|
// For each locator:
|
|
45
45
|
for (const loc of all.allLocs) {
|
|
46
46
|
// Get its text.
|
|
47
47
|
const elData = await getLocatorData(loc);
|
|
48
|
-
// If a previous link has the same text:
|
|
49
48
|
const linkText = elData.excerpt.toLowerCase();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
// Get its destination.
|
|
50
|
+
const linkTo = await loc.getAttribute('href');
|
|
51
|
+
// If the text and destination exist:
|
|
52
|
+
if (linkText && linkTo) {
|
|
53
|
+
// If a previous link has the same text but a different destination:
|
|
54
|
+
if (linksData.some(linkData => linkData.text === linkText && linkData.to !== linkTo)) {
|
|
55
|
+
// Add the locator to the array of violators.
|
|
56
|
+
all.locs.push(loc);
|
|
57
|
+
}
|
|
58
|
+
// Otherwise, i.e. if no previous link has the same taxt but a different destination:
|
|
59
|
+
else {
|
|
60
|
+
// Record its text and destination.
|
|
61
|
+
linksData.push({
|
|
62
|
+
text: linkText,
|
|
63
|
+
to: linkTo
|
|
64
|
+
});
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
// Populate and return the result.
|
|
@@ -2,16 +2,25 @@
|
|
|
2
2
|
"id": "linkAmb",
|
|
3
3
|
"what": "validation of linkAmb test",
|
|
4
4
|
"strict": true,
|
|
5
|
+
"standard": "only",
|
|
6
|
+
"observe": false,
|
|
7
|
+
"device": {
|
|
8
|
+
"id": "default"
|
|
9
|
+
},
|
|
10
|
+
"browserID": "webkit",
|
|
11
|
+
"creationTimeStamp": "240101T1500",
|
|
12
|
+
"executionTimeStamp": "240101T1200",
|
|
13
|
+
"target": {
|
|
14
|
+
"what": "page with unambiguous and ambiguous links",
|
|
15
|
+
"url": "file://validation/tests/targets/linkAmb/index.html"
|
|
16
|
+
},
|
|
17
|
+
"sources": {
|
|
18
|
+
},
|
|
5
19
|
"timeLimit": 20,
|
|
6
20
|
"acts": [
|
|
7
|
-
{
|
|
8
|
-
"type": "launch",
|
|
9
|
-
"which": "chromium",
|
|
10
|
-
"url": "file://validation/tests/targets/linkAmb/index.html",
|
|
11
|
-
"what": "page with unambiguous and ambiguous links"
|
|
12
|
-
},
|
|
13
21
|
{
|
|
14
22
|
"type": "test",
|
|
23
|
+
"launch": {},
|
|
15
24
|
"which": "testaro",
|
|
16
25
|
"withItems": true,
|
|
17
26
|
"stopOnFail": true,
|
|
@@ -84,6 +93,7 @@
|
|
|
84
93
|
},
|
|
85
94
|
{
|
|
86
95
|
"type": "test",
|
|
96
|
+
"launch": {},
|
|
87
97
|
"which": "testaro",
|
|
88
98
|
"withItems": false,
|
|
89
99
|
"stopOnFail": true,
|
|
@@ -124,11 +134,5 @@
|
|
|
124
134
|
"linkAmb"
|
|
125
135
|
]
|
|
126
136
|
}
|
|
127
|
-
]
|
|
128
|
-
"sources": {
|
|
129
|
-
},
|
|
130
|
-
"standard": "only",
|
|
131
|
-
"observe": false,
|
|
132
|
-
"timeStamp": "240101T1500",
|
|
133
|
-
"creationTimeStamp": "240101T1200"
|
|
137
|
+
]
|
|
134
138
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<!--
|
|
3
|
-
© 2023 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
© 2023–2025 CVS Health and/or one of its affiliates. All rights reserved.
|
|
4
4
|
|
|
5
5
|
MIT License
|
|
6
6
|
|
|
@@ -33,9 +33,14 @@
|
|
|
33
33
|
<main>
|
|
34
34
|
<h1>Page with unambiguous and ambiguous links</h1>
|
|
35
35
|
<p>This is a normal link to <a href="https://en.wikipedia.org">English information</a>.</p>
|
|
36
|
+
<p>The next two links, too, are unambiguous. Although they have the same name, they also have the same destination.</p>
|
|
37
|
+
<ul>
|
|
38
|
+
<li><a id="basqueInfoWP0" href="https://eus.wikipedia.org">Basque information</a></li>
|
|
39
|
+
<li><a id="basqueInfoWP1" href="https://eus.wikipedia.org">Basque information</a></li>
|
|
40
|
+
</ul>
|
|
36
41
|
<p>However, the next two links are ambiguous, because their names are the same and yet they have different destinations:</p>
|
|
37
42
|
<ul>
|
|
38
|
-
<li><a id="
|
|
43
|
+
<li><a id="basqueInfoWP2" href="https://eus.wikipedia.org">Basque information</a></li>
|
|
39
44
|
<li><a id="basqueInfoICB" href="https://www.eke.eus/en/kultura/basque-country">Basque information</a></li>
|
|
40
45
|
</ul>
|
|
41
46
|
</main>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
© 2022–
|
|
2
|
+
© 2022–2025 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
3
|
|
|
4
4
|
MIT License
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
// Module to process files.
|
|
33
33
|
const fs = require('fs').promises;
|
|
34
|
-
// Module to run Testaro
|
|
34
|
+
// Module to run Testaro jobs.
|
|
35
35
|
const {doJob} = require('../run');
|
|
36
36
|
|
|
37
37
|
// FUNCTIONS
|
|
@@ -42,7 +42,7 @@ exports.validateTest = async testID => {
|
|
|
42
42
|
const jobFileNames = await fs.readdir(`${__dirname}/tests/jobs`);
|
|
43
43
|
for (const jobFileName of jobFileNames.filter(fileName => fileName === `${testID}.json`)) {
|
|
44
44
|
const jobJSON = await fs.readFile(`${__dirname}/tests/jobs/${jobFileName}`, 'utf8');
|
|
45
|
-
|
|
45
|
+
let report = JSON.parse(jobJSON);
|
|
46
46
|
// Perform it.
|
|
47
47
|
report = await doJob(report);
|
|
48
48
|
// Report whether the end time was reported.
|