diff --git a/src/tests/functional/form_submission_tests.ts b/src/tests/functional/form_submission_tests.ts index 613fb24a6..009a9098d 100644 --- a/src/tests/functional/form_submission_tests.ts +++ b/src/tests/functional/form_submission_tests.ts @@ -146,7 +146,6 @@ test("test standard POST form submission events", async ({ page }) => { await nextEventNamed(page, "turbo:before-visit") await nextEventNamed(page, "turbo:visit") - await nextEventNamed(page, "turbo:before-cache") await nextEventNamed(page, "turbo:before-render") await nextEventNamed(page, "turbo:render") await nextEventNamed(page, "turbo:load") diff --git a/src/tests/functional/navigation_tests.ts b/src/tests/functional/navigation_tests.ts index cc39c1a10..dc2927cff 100644 --- a/src/tests/functional/navigation_tests.ts +++ b/src/tests/functional/navigation_tests.ts @@ -136,6 +136,19 @@ test("test following a same-origin POST form button[data-turbo-action=replace]", assert.equal(await visitAction(page), "replace") }) +test("test following a POST form clears cache", async({ page }) => { + await page.evaluate(() => { + const cachedElement = document.createElement("some-cached-element") + document.body.appendChild(cachedElement) + }) + + page.click("#form-post-submit") + await nextBeat // 301 redirect response + await nextBeat // 200 response + await page.goBack() + assert.notOk(await hasSelector(page, "some-cached-element")) +}) + test("test following a same-origin data-turbo=false link", async ({ page }) => { page.click("#same-origin-false-link") await nextBody(page)