test(post): DEL4 — a deleted entry stays gone after a page reload
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn
This commit is contained in:
@@ -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();
|
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 ──────────────────────────────────────────────
|
// ── DEL2: Cancel keeps the entry ──────────────────────────────────────────────
|
||||||
test('DEL2: cancelling the confirm step keeps the entry on the page and on disk', async ({ page }) => {
|
test('DEL2: cancelling the confirm step keeps the entry on the page and on disk', async ({ page }) => {
|
||||||
const tag = `del2-${Date.now()}`;
|
const tag = `del2-${Date.now()}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user