test(pokedex): cover shared dex loading and preview badges

Adds loadSharedPokedex unit tests and a share preview case for every badge, restoring the branch coverage gate. Gives the offline sync BDD poll 30s so a full Living Dex snapshot can finish caching on CI.
This commit is contained in:
Josh Creek
2026-09-14 14:47:27 +01:00
parent 27274171fe
commit ca7f9c0e48
3 changed files with 122 additions and 11 deletions
+12 -9
View File
@@ -67,16 +67,19 @@ When('I go offline and reload the sign-in page', async ({ page }) => {
Given('my offline copy is synchronized', async ({ page, state }) => {
await waitForServiceWorker(page);
// A full Living Dex snapshot plus its artwork can take longer than the default poll window on CI.
await expect
.poll(() =>
page.evaluate(async (userId) => {
const meta = await (
await caches.open('livingdex-offline-meta-v1')
).match('/__offline/current');
if (!meta) return false;
const value = await meta.json();
return value.userId === userId;
}, state.userId)
.poll(
() =>
page.evaluate(async (userId) => {
const meta = await (
await caches.open('livingdex-offline-meta-v1')
).match('/__offline/current');
if (!meta) return false;
const value = await meta.json();
return value.userId === userId;
}, state.userId),
{ timeout: 30_000 }
)
.toBe(true);
const serializedSnapshot = await page.evaluate(async () => {