From 2e96106c840efbecfbaa209f8beee68877e771bd Mon Sep 17 00:00:00 2001 From: Mischa Date: Wed, 8 Jul 2026 10:29:21 +0200 Subject: [PATCH] =?UTF-8?q?test(post):=20DEL4=20=E2=80=94=20a=20deleted=20?= =?UTF-8?q?entry=20stays=20gone=20after=20a=20page=20reload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guards the page-tree-index staleness fix. DEL1 only checked optimistic DOM removal + disk; DEL4 reloads and asserts the server no longer renders the card. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn --- tests/ui/post/delete-flow.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/ui/post/delete-flow.spec.js b/tests/ui/post/delete-flow.spec.js index b71b4d2..45c15ac 100644 --- a/tests/ui/post/delete-flow.spec.js +++ b/tests/ui/post/delete-flow.spec.js @@ -33,6 +33,31 @@ test('DEL1: owner deletes an entry — the card disappears and the folder is rem await expect.poll(() => findEntry(tag), { timeout: 15_000 }).toBeNull(); }); +// ── DEL4: a deleted entry stays gone after a full page reload ───────────────── +// Regression for the page-tree-index staleness bug: deleteEntry did +// cache.deleteAll() but not Cache::invalidateCache(), so with +// cache.check.method: folder the deleted child lingered in the pages index and +// the SERVER re-rendered the (now image-less) card on the next load — even +// though its folder was gone from disk. DEL1 only checks the optimistic DOM +// removal + disk, so it missed this. Here we reload and assert the server no +// longer emits the card. +test('DEL4: a deleted entry is absent from the feed after a fresh page load', async ({ page }) => { + const tag = `del4-${Date.now()}`; + await createPhotoEntry(page, tag, { created, content: `Delete-flow fixture ${tag}. Safe to delete.` }); + + await page.goto(ACTIVE_TRIP_URL); + const card = page.locator('.journal-post', { hasText: tag }); + await expect(card).toHaveCount(1); + await card.locator('[data-delete-start]').click(); + await card.locator('[data-delete-confirm]').click(); + await expect(page.locator('.journal-post', { hasText: tag })).toHaveCount(0, { timeout: 15_000 }); + await expect.poll(() => findEntry(tag), { timeout: 15_000 }).toBeNull(); + + // The real test: a fresh server render must not resurrect the entry. + await page.goto(ACTIVE_TRIP_URL); + await expect(page.locator('.journal-post', { hasText: tag })).toHaveCount(0); +}); + // ── DEL2: Cancel keeps the entry ────────────────────────────────────────────── test('DEL2: cancelling the confirm step keeps the entry on the page and on disk', async ({ page }) => { const tag = `del2-${Date.now()}`;