testdriverai 7.3.20 → 7.3.22
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/sdk.js +44 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [7.3.22](https://github.com/testdriverai/testdriverai/compare/v7.3.21...v7.3.22) (2026-02-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [7.3.21](https://github.com/testdriverai/testdriverai/compare/v7.3.20...v7.3.21) (2026-02-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
## [7.3.20](https://github.com/testdriverai/testdriverai/compare/v7.3.19...v7.3.20) (2026-02-19)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
package/sdk.js
CHANGED
|
@@ -1712,38 +1712,52 @@ class TestDriverSDK {
|
|
|
1712
1712
|
*/
|
|
1713
1713
|
async _waitForChromeDebuggerReady(timeoutMs = 60000) {
|
|
1714
1714
|
const shell = this.os === "windows" ? "pwsh" : "sh";
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1715
|
+
const portCheckCmd = this.os === "windows"
|
|
1716
|
+
? `$tcp = New-Object System.Net.Sockets.TcpClient; $tcp.Connect('127.0.0.1', 9222); $tcp.Close(); echo 'open'`
|
|
1717
|
+
: `curl -s -o /dev/null --connect-timeout 2 http://localhost:9222 2>/dev/null && echo 'open' || echo 'closed'`;
|
|
1718
|
+
const pageCheckCmd = this.os === "windows"
|
|
1719
|
+
? `(Invoke-RestMethod -Uri 'http://localhost:9222/json' -TimeoutSec 2) | Where-Object { $_.type -eq 'page' } | Select-Object -First 1 | ConvertTo-Json`
|
|
1720
|
+
: `curl -s http://localhost:9222/json 2>/dev/null | grep '"type": "page"'`;
|
|
1721
|
+
|
|
1722
|
+
const deadline = Date.now() + timeoutMs;
|
|
1723
|
+
|
|
1724
|
+
// Wait for port 9222 to be listening
|
|
1725
|
+
let portReady = false;
|
|
1726
|
+
while (Date.now() < deadline) {
|
|
1727
|
+
try {
|
|
1728
|
+
const result = await this.exec(shell, portCheckCmd, 5000, true);
|
|
1729
|
+
if (result && result.includes("open")) {
|
|
1730
|
+
portReady = true;
|
|
1731
|
+
break;
|
|
1732
|
+
}
|
|
1733
|
+
} catch (_) {
|
|
1734
|
+
// Port not ready yet
|
|
1735
|
+
}
|
|
1736
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
1737
|
+
}
|
|
1738
|
+
if (!portReady) {
|
|
1739
|
+
throw new Error(
|
|
1740
|
+
`Chrome debugger port 9222 did not become available within ${timeoutMs}ms`,
|
|
1739
1741
|
);
|
|
1742
|
+
}
|
|
1740
1743
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1744
|
+
// Wait for a page target to appear via CDP
|
|
1745
|
+
let pageReady = false;
|
|
1746
|
+
while (Date.now() < deadline) {
|
|
1747
|
+
try {
|
|
1748
|
+
const result = await this.exec(shell, pageCheckCmd, 5000, true);
|
|
1749
|
+
if (result && result.trim().length > 0) {
|
|
1750
|
+
pageReady = true;
|
|
1751
|
+
break;
|
|
1752
|
+
}
|
|
1753
|
+
} catch (_) {
|
|
1754
|
+
// No page target yet
|
|
1755
|
+
}
|
|
1756
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
1757
|
+
}
|
|
1758
|
+
if (!pageReady) {
|
|
1759
|
+
throw new Error(
|
|
1760
|
+
`Chrome page target did not become available within ${timeoutMs}ms`,
|
|
1747
1761
|
);
|
|
1748
1762
|
}
|
|
1749
1763
|
}
|