ohos-playwright 0.2.1 → 0.2.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/dist/setup.mjs +3 -10
- package/package.json +1 -1
package/dist/setup.mjs
CHANGED
|
@@ -186,7 +186,6 @@ export default async function globalSetup() {
|
|
|
186
186
|
await ensureDeviceConnected();
|
|
187
187
|
console.log(`[ohos-playwright] locating ${BUNDLE}...`);
|
|
188
188
|
// Batch ps + /proc/net/unix into a single hdc call.
|
|
189
|
-
let deviceState = fetchDeviceState();
|
|
190
189
|
let pid = findBrowserPid();
|
|
191
190
|
if (!pid) {
|
|
192
191
|
console.log('[ohos-playwright] browser not running, launching...');
|
|
@@ -195,15 +194,9 @@ export default async function globalSetup() {
|
|
|
195
194
|
pid = await retry(findBrowserPid, { max: 20, interval: 1000, label: `Failed to launch ${BUNDLE}` });
|
|
196
195
|
}
|
|
197
196
|
console.log(`[ohos-playwright] browser pid=${pid}`);
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
if (!unixCache) {
|
|
202
|
-
// Re-fetch device state to get fresh /proc/net/unix after browser launch
|
|
203
|
-
deviceState = fetchDeviceState();
|
|
204
|
-
unixCache = deviceState.unix;
|
|
205
|
-
}
|
|
206
|
-
const socket = await retry(() => findDevToolsSocket(pid, unixCache), { max: 10, interval: 500, label: `DevTools socket not found for pid ${pid}` });
|
|
197
|
+
// Wait for the DevTools socket to appear — each retry fetches fresh
|
|
198
|
+
// /proc/net/unix since the socket appears asynchronously after launch.
|
|
199
|
+
const socket = await retry(() => findDevToolsSocket(pid), { max: 10, interval: 500, label: `DevTools socket not found for pid ${pid}` });
|
|
207
200
|
console.log(`[ohos-playwright] socket=${socket}`);
|
|
208
201
|
const port = await pickFreePort();
|
|
209
202
|
setupForward(port, socket);
|