Skip to content

Commit

Permalink
assert history length before redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi12299 committed Sep 20, 2024
1 parent 9e75a30 commit b4995df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit b4995df

Please sign in to comment.