import { expect, test } from './fixtures'; // The "update required" overlay is raised in prod when the edge's client-version gate turns away a // too-old build (the update_required result_code on Execute, a Subscribe FailedPrecondition). The // mock transport never produces one, so — like the maintenance overlay — the e2e drives it through // the window.__update hook (gateway.ts, mock-only). It is app-global (mounted outside the route // blocks in App.svelte), so it shows without a session, and it is terminal (no self-clearing poll). test('update overlay covers the app when the client is too old', async ({ page }) => { await page.goto('/'); await expect(page.getByRole('alertdialog')).toHaveCount(0); await page.evaluate(() => (window as unknown as { __update: { on(): void } }).__update.on()); const overlay = page.getByRole('alertdialog'); await expect(overlay).toBeVisible(); // One action button (EN "Update" / RU "Обновить" depending on locale). await expect(overlay.getByRole('button', { name: /Update|Обновить/i })).toBeVisible(); }); test('the update action reloads the web client', async ({ page }) => { await page.goto('/'); await page.evaluate(() => (window as unknown as { __update: { on(): void } }).__update.on()); const overlay = page.getByRole('alertdialog'); await expect(overlay).toBeVisible(); // On the web the action reloads the page to fetch the current client (on a native build it opens // the store instead). The reload resets the terminal store, so the app re-bootstraps: the overlay // is gone and the login is back. await Promise.all([ page.waitForEvent('load'), overlay.getByRole('button', { name: /Update|Обновить/i }).click(), ]); await expect(page.getByRole('alertdialog')).toHaveCount(0); await expect(page.getByRole('button', { name: /guest/i })).toBeVisible(); });