Unverified Commit 20e9148f authored by JJ Kasper's avatar JJ Kasper Committed by GitHub
parent a2df1785
......@@ -659,8 +659,10 @@ describe('basePath', () => {
},
})
const html = await browser.eval('document.documentElement.innerHTML')
expect(html).toContain('This page could not be found')
await check(
() => browser.eval('document.documentElement.innerHTML'),
/This page could not be found/
)
})
it('should 404 when manually adding basePath with router.push', async () => {
......
......@@ -243,7 +243,11 @@ describe('Middleware Runtime', () => {
})
it('should have correct dynamic route params on client-transition to dynamic route', async () => {
const browser = await webdriver(next.url, '/')
const browser = await webdriver(next.url, '/404')
await check(
() => browser.eval('next.router.isReady ? "yes" : "nope"'),
'yes'
)
await browser.eval('window.beforeNav = 1')
await browser.eval('window.next.router.push("/blog/first")')
await browser.waitForElementByCss('#blog')
......@@ -357,7 +361,11 @@ describe('Middleware Runtime', () => {
})
it('should have correct route params for rewrite from config non-dynamic route', async () => {
const browser = await webdriver(next.url, '/')
const browser = await webdriver(next.url, '/404')
await check(
() => browser.eval('next.router.isReady ? "yes" : "nope"'),
'yes'
)
await browser.eval('window.beforeNav = 1')
await browser.eval('window.next.router.push("/rewrite-1")')
......@@ -393,7 +401,11 @@ describe('Middleware Runtime', () => {
expect(res.status).toBe(200)
expect(await res.text()).toContain('Hello World')
const browser = await webdriver(next.url, `/`)
const browser = await webdriver(next.url, `/404`)
await check(
() => browser.eval('next.router.isReady ? "yes" : "nope"'),
'yes'
)
await browser.eval('window.beforeNav = 1')
await browser.eval(`next.router.push('/rewrite-1')`)
await check(async () => {
......
......@@ -133,7 +133,7 @@ describe('Middleware Runtime trailing slash', () => {
})
it('should have correct dynamic route params on client-transition to dynamic route', async () => {
const browser = await webdriver(next.url, '/')
const browser = await webdriver(next.url, '/404')
await check(
() => browser.eval('next.router.isReady ? "yes" : "no"'),
'yes'
......@@ -257,7 +257,7 @@ describe('Middleware Runtime trailing slash', () => {
})
it('should have correct route params for rewrite from config non-dynamic route', async () => {
const browser = await webdriver(next.url, '/')
const browser = await webdriver(next.url, '/404')
await browser.eval('window.beforeNav = 1')
await browser.eval('window.next.router.push("/rewrite-1")')
......@@ -293,7 +293,11 @@ describe('Middleware Runtime trailing slash', () => {
expect(res.status).toBe(200)
expect(await res.text()).toContain('Hello World')
const browser = await webdriver(next.url, `/`)
const browser = await webdriver(next.url, `/404`)
await check(
() => browser.eval('next.router.isReady ? "yes" : "nope"'),
'yes'
)
await browser.eval('window.beforeNav = 1')
await browser.eval(`next.router.push('/rewrite-1')`)
await check(async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment