test(e2e): reconcile shell and smoke consumers with approved lifetime and locale contracts

This commit is contained in:
cesnimda
2026-10-21 12:48:44 +02:00
parent 32e464f612
commit 508d68e16d
5 changed files with 316 additions and 12 deletions
+6 -11
View File
@@ -323,33 +323,28 @@ for (const mode of ["light", "dark"] as const) for (const language of ["en", "nb
}
};
await choose(t.settingsTabBackup);
// Complete the real export after navigating back to the bottom action.
// Otherwise clicking General correctly dismisses the toast via click-away.
let release!: () => void;
const held = new Promise<void>(resolve => { release = resolve; });
await page.route(`${apiUrl}/export/account`, async route => {
// One native ZIP, replayed for viewport checks to respect the 2/minute owner limit.
exported ??= await route.fetch();
expect(exported.status()).toBe(200);
await held;
await route.fulfill({ response: exported });
}, { times: 1 });
const download = page.waitForEvent("download");
await main.getByRole("button", { name: t.accountExportDownload, exact: true }).click();
await choose(t.settingsTabGeneral);
const manage = main.getByRole("button", { name: t.settingsManageConnectedAccounts, exact: true });
await manage.focus();
release();
expect((await download).suggestedFilename()).toMatch(/\.zip$/);
// Keep the private-export owner mounted; leaving Backup intentionally disposes late downloads.
const encrypted = main.getByRole("button", { name: t.backupDownload, exact: true });
await expect(encrypted).toBeEnabled();
await encrypted.focus();
const toast = page.getByRole("alert").filter({ hasText: t.accountExportDownloaded });
await expect(toast).toBeVisible();
// Deliberately align at the viewport end: reserved page space alone does
// not stop native scrolling from placing an action underneath the toast.
await manage.evaluate(node => node.scrollIntoView({ block: "end" }));
await encrypted.evaluate(node => node.scrollIntoView({ block: "end" }));
// Hover uses Snackbar's normal pause behavior; timing is not shortened or mocked.
await toast.hover();
await toast.getByRole("button").focus();
await exposed(manage);
await exposed(encrypted);
await capture(page, info, `open-toast-${width}-${suffix}`);
await expect(toast).toBeVisible();
await exposed(toast.getByRole("button"));