import { expect, test } from './fixtures'; // The maintenance overlay is raised in prod by the edge 503 marker (X-Scrabble-Maintenance); // the mock transport never produces one, so — like the offline indicator — the e2e drives it // through the window.__maint hook (gateway.ts, mock-only). It is app-global (mounted outside // the route blocks in App.svelte), so it shows without a session. test('maintenance overlay covers the app and lifts on recovery', async ({ page }) => { await page.goto('/'); await expect(page.getByRole('alertdialog')).toHaveCount(0); // A planned deploy window begins: a non-dismissable dimmed overlay covers the app. await page.evaluate(() => (window as unknown as { __maint: { on(): void } }).__maint.on()); const overlay = page.getByRole('alertdialog'); await expect(overlay).toBeVisible(); // The retry button is present (EN "Try again" / RU "Повторить" depending on locale). await expect(overlay.getByRole('button', { name: /again|Повторить/i })).toBeVisible(); // The window ends — in prod the store's poll lifts it on the first successful read; the mock // has no probe, so it clears explicitly. The overlay disappears with no page reload. await page.evaluate(() => (window as unknown as { __maint: { off(): void } }).__maint.off()); await expect(page.getByRole('alertdialog')).toHaveCount(0); });