testaro 62.0.4 → 63.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/aceconfig.js +1 -0
- package/package.json +1 -1
- package/testaro/hovInd.js +2 -2
- package/testaro/hover.js +13 -4
- package/tests/qualWeb.js +41 -19
package/aceconfig.js
CHANGED
package/package.json
CHANGED
package/testaro/hovInd.js
CHANGED
|
@@ -123,7 +123,7 @@ exports.reporter = async (page, withItems, sampleSize = 20) => {
|
|
|
123
123
|
// Get a sample of the triggers.
|
|
124
124
|
const sampleIndexes = getSample(locsAll, sampleSize);
|
|
125
125
|
const sample = locsAll.filter((loc, index) => sampleIndexes.includes(index));
|
|
126
|
-
// For each trigger
|
|
126
|
+
// For each trigger:
|
|
127
127
|
for (const loc of sample) {
|
|
128
128
|
try {
|
|
129
129
|
// Get its style properties.
|
|
@@ -135,7 +135,7 @@ exports.reporter = async (page, withItems, sampleSize = 20) => {
|
|
|
135
135
|
// Blur it.
|
|
136
136
|
await loc.blur({timeout: 500});
|
|
137
137
|
// If blurring succeeds, try to hover over it.
|
|
138
|
-
await loc.hover({timeout:
|
|
138
|
+
await loc.hover({timeout: 600});
|
|
139
139
|
// If hovering succeeds, get its style properties.
|
|
140
140
|
const hovStyles = await getHoverStyles(loc);
|
|
141
141
|
// If all 3 style declarations belong to the same element:
|
package/testaro/hover.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
// Module to perform common operations.
|
|
19
19
|
const {getBasicResult, getVisibleCountChange} = require('../procs/testaro');
|
|
20
|
+
// Module to perform Playwright operations.
|
|
21
|
+
const playwright = require('playwright');
|
|
20
22
|
|
|
21
23
|
// FUNCTIONS
|
|
22
24
|
|
|
@@ -47,7 +49,9 @@ exports.reporter = async (page, withItems) => {
|
|
|
47
49
|
].join(', '));
|
|
48
50
|
const allLocs = await candidateLocs.all();
|
|
49
51
|
const violations = [];
|
|
50
|
-
const data = {
|
|
52
|
+
const data = {
|
|
53
|
+
hoverableCount: allLocs.length
|
|
54
|
+
};
|
|
51
55
|
// For each locator:
|
|
52
56
|
for (const loc of allLocs) {
|
|
53
57
|
// Get the XPath of the element referenced by the locator.
|
|
@@ -63,7 +67,7 @@ exports.reporter = async (page, withItems) => {
|
|
|
63
67
|
// Get a locator for the observation root.
|
|
64
68
|
const rootLoc = page.locator(`xpath=${xPath}`);
|
|
65
69
|
const loc0 = await rootLoc.locator('*:visible');
|
|
66
|
-
// Get a count of the visible elements in the observation tree.
|
|
70
|
+
// Get a pre-hover count of the visible elements in the observation tree.
|
|
67
71
|
const elementCount0 = await loc0.count();
|
|
68
72
|
try {
|
|
69
73
|
// Hover over the element.
|
|
@@ -86,9 +90,14 @@ exports.reporter = async (page, withItems) => {
|
|
|
86
90
|
}
|
|
87
91
|
// If hovering throws an error:
|
|
88
92
|
catch(error) {
|
|
89
|
-
//
|
|
93
|
+
// If the error is a timeout:
|
|
94
|
+
if (error instanceof playwright.errors.TimeoutError) {
|
|
95
|
+
// Skip the locator.
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
// Otherwise, i.e. if the error is not a timeout, report this and quit.
|
|
90
99
|
data.prevented = true;
|
|
91
|
-
data.error = `ERROR hovering over an element (${error.message})`;
|
|
100
|
+
data.error = `ERROR hovering over an element (${error.message.slice(0, 200)})`;
|
|
92
101
|
break;
|
|
93
102
|
}
|
|
94
103
|
}
|
package/tests/qualWeb.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
© 2023–2024 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
© 2025 Jonathan Robert Pool.
|
|
3
4
|
|
|
4
5
|
Licensed under the MIT License. See LICENSE file at the project root or
|
|
5
6
|
https://opensource.org/license/mit/ for details.
|
|
@@ -42,9 +43,23 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
42
43
|
timeout: timeLimit * 1000,
|
|
43
44
|
monitor: false
|
|
44
45
|
};
|
|
46
|
+
try {
|
|
45
47
|
// Start the QualWeb core engine.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
await qualWeb.start(clusterOptions, {
|
|
49
|
+
headless: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// If the start fails:
|
|
53
|
+
catch(error) {
|
|
54
|
+
return {
|
|
55
|
+
data: {
|
|
56
|
+
prevented: true,
|
|
57
|
+
error: `Core engine start failed (${error.message})`
|
|
58
|
+
},
|
|
59
|
+
result
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Otherwise, i.e. if the start succeeds, specify the invariant test options.
|
|
48
63
|
const qualWebOptions = {
|
|
49
64
|
log: {
|
|
50
65
|
console: false,
|
|
@@ -128,9 +143,22 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
128
143
|
qualWebOptions.modules.push(bpModule);
|
|
129
144
|
qualWebOptions.execute.bp = true;
|
|
130
145
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
let qwReport;
|
|
147
|
+
try {
|
|
148
|
+
// Get the report.
|
|
149
|
+
qwReport = await qualWeb.evaluate(qualWebOptions);
|
|
150
|
+
}
|
|
151
|
+
catch(error) {
|
|
152
|
+
return {
|
|
153
|
+
data: {
|
|
154
|
+
prevented: true,
|
|
155
|
+
error: `qualWeb evaluation failed (${error.message})`
|
|
156
|
+
},
|
|
157
|
+
result
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Otherwise, i.e. if the evaluation succeeded, get the report.
|
|
161
|
+
result = qwReport[withNewContent ? qualWebOptions.url : 'customHtml'];
|
|
134
162
|
// If it contains a copy of the DOM:
|
|
135
163
|
if (result && result.system && result.system.page && result.system.page.dom) {
|
|
136
164
|
// Delete the copy.
|
|
@@ -184,24 +212,24 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
184
212
|
}
|
|
185
213
|
else {
|
|
186
214
|
data.prevented = true;
|
|
187
|
-
data.error = '
|
|
215
|
+
data.error = 'No assertions';
|
|
188
216
|
}
|
|
189
217
|
}
|
|
190
218
|
else {
|
|
191
219
|
data.prevented = true;
|
|
192
|
-
data.error = `
|
|
220
|
+
data.error = `No ${section} section`;
|
|
193
221
|
}
|
|
194
222
|
}
|
|
195
223
|
}
|
|
196
224
|
}
|
|
197
225
|
else {
|
|
198
226
|
data.prevented = true;
|
|
199
|
-
data.error = '
|
|
227
|
+
data.error = 'No modules';
|
|
200
228
|
}
|
|
201
229
|
}
|
|
202
230
|
else {
|
|
203
231
|
data.prevented = true;
|
|
204
|
-
data.error = '
|
|
232
|
+
data.error = 'No DOM';
|
|
205
233
|
}
|
|
206
234
|
// Stop the QualWeb core engine.
|
|
207
235
|
await qualWeb.stop();
|
|
@@ -210,20 +238,14 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
210
238
|
JSON.stringify(result);
|
|
211
239
|
}
|
|
212
240
|
catch(error) {
|
|
213
|
-
const message = `ERROR: qualWeb result cannot be made JSON (${error.message})`;
|
|
214
241
|
data.prevented = true;
|
|
215
|
-
data.error = message
|
|
216
|
-
}
|
|
242
|
+
data.error = `qualWeb result cannot be made JSON (${error.message})`;
|
|
243
|
+
}
|
|
217
244
|
}
|
|
218
245
|
catch(error) {
|
|
219
|
-
const message = error.message.slice(0, 200);
|
|
220
246
|
data.prevented = true;
|
|
221
|
-
data.error = message
|
|
222
|
-
|
|
223
|
-
prevented: true,
|
|
224
|
-
error: message
|
|
225
|
-
};
|
|
226
|
-
};
|
|
247
|
+
data.error = `qualWeb evaluation failed (${error.message})`;
|
|
248
|
+
}
|
|
227
249
|
return {
|
|
228
250
|
data,
|
|
229
251
|
result
|