From b4995df5854942c704f2d5eda12df0d27cce5bb4 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Fri, 20 Sep 2024 20:32:32 +0530 Subject: [PATCH] assert history length before redirect --- test/e2e/app-dir/actions/app-action.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/app-dir/actions/app-action.test.ts b/test/e2e/app-dir/actions/app-action.test.ts index 8153a8258ea38..58d1c2dcf363b 100644 --- a/test/e2e/app-dir/actions/app-action.test.ts +++ b/test/e2e/app-dir/actions/app-action.test.ts @@ -185,13 +185,17 @@ describe('app-dir action handling', () => { it('should replace current route when redirecting with type set to replace', async () => { const browser = await next.browser('/header') + let historyLen = await browser.eval('window.history.length') + // chromium's about:blank page is the first item in history + expect(historyLen).toBe(2) + await browser.elementByCss('#setCookieAndRedirectReplace').click() await check(async () => { return (await browser.elementByCss('#redirected').text()) || '' }, 'redirected') // Ensure we cannot navigate back - const historyLen = await browser.eval('window.history.length') + historyLen = await browser.eval('window.history.length') // chromium's about:blank page is the first item in history expect(historyLen).toBe(2) })