testaro 60.10.1 → 60.10.2
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 +1 -1
- package/procs/identify.js +4 -3
package/package.json
CHANGED
package/procs/identify.js
CHANGED
|
@@ -85,15 +85,16 @@ const addIDs = async (locator, recipient) => {
|
|
|
85
85
|
const timer = new Promise(resolve => {
|
|
86
86
|
timeout = setTimeout(() => {
|
|
87
87
|
resolve({timedOut: true})
|
|
88
|
-
clearTimeout(timeout);
|
|
89
88
|
}, 500);
|
|
90
89
|
});
|
|
91
90
|
// Use Playwright to get the XPath.
|
|
92
91
|
const pathIDPromise = xPath(locator);
|
|
93
92
|
const pathID = await Promise.race([pathIDPromise, timer]);
|
|
94
|
-
// If the XPath was computed:
|
|
93
|
+
// If the XPath was computed before being timed out:
|
|
95
94
|
if (typeof pathID === 'string') {
|
|
96
|
-
//
|
|
95
|
+
// Prevent the timeout from resolving.
|
|
96
|
+
clearTimeout(timeout);
|
|
97
|
+
// Add the XPath to the result.
|
|
97
98
|
recipient.pathID = pathID;
|
|
98
99
|
}
|
|
99
100
|
}
|