(name, url, timeoutMs)
| 3 | const COMPOSE_FILE = 'tests/docker-compose-playwright.yml'; |
| 4 | |
| 5 | async function waitForReady(name, url, timeoutMs) { |
| 6 | const start = Date.now(); |
| 7 | while (Date.now() - start < timeoutMs) { |
| 8 | try { |
| 9 | const response = await fetch(url, { redirect: 'manual' }); |
| 10 | if (response.ok) { |
| 11 | return; |
| 12 | } |
| 13 | } catch { |
| 14 | // Retry until timeout. |
| 15 | } |
| 16 | await new Promise((resolve) => setTimeout(resolve, 1000)); |
| 17 | } |
| 18 | throw new Error(`Timed out waiting for ${name} at ${url}`); |
| 19 | } |
| 20 | |
| 21 | module.exports = async () => { |
| 22 | try { |