(what, probe, attempts = 90)
| 224 | } |
| 225 | |
| 226 | async function waitFor(what, probe, attempts = 90) { |
| 227 | for (let i = 0; i < attempts; i++) { |
| 228 | try { |
| 229 | if (await probe()) return true; |
| 230 | } catch { |
| 231 | /* not up yet */ |
| 232 | } |
| 233 | await sleep(1000); |
| 234 | } |
| 235 | throw new Error(`timed out waiting for ${what}`); |
| 236 | } |
| 237 | |
| 238 | async function main() { |
| 239 | const browserPath = findBrowser(); |