(vm: VmHandle, url: string, attempts = 60)
| 15 | * owned by root (launchctl asuser), whose listening socket an unprivileged lsof |
| 16 | * can't see — a loopback HTTP probe works regardless of owner. */ |
| 17 | export const waitGuestHttp = async (vm: VmHandle, url: string, attempts = 60): Promise<boolean> => { |
| 18 | for (let i = 0; i < attempts; i++) { |
| 19 | const r = await vm.ssh( |
| 20 | `curl -s -o /dev/null -w '%{http_code}' --max-time 5 ${url} 2>/dev/null || echo 000`, |
| 21 | ); |
| 22 | const code = r.stdout.trim().slice(-3); |
| 23 | if (code !== "000" && code !== "") return true; |
| 24 | await sleep(2000); |
| 25 | } |
| 26 | return false; |
| 27 | }; |
| 28 | |
| 29 | /** Poll until CDP advertises a real PAGE target — i.e. the app's window/renderer |
| 30 | * is up, not just the browser endpoint. On a cold guest the page appears a good |
no test coverage detected