Skip to content

Commit

Permalink
Fix Prerender Test Cases (#10861)
Browse files Browse the repository at this point in the history
* Fix Prerender Test Cases

* fix test
  • Loading branch information
Timer committed Mar 6, 2020
1 parent 49369d7 commit 1a9b49b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/integration/prerender/pages/index.js
Expand Up @@ -33,7 +33,7 @@ const Page = ({ world, time }) => {
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
</Link>
<Link href="/blog/[post]" as="/blog/post-999">
<Link href="/blog/[post]" as="/blog/post-999" prefetch={false}>
<a id="broken-at-first-post">to broken at first</a>
</Link>
<br />
Expand Down
8 changes: 4 additions & 4 deletions test/integration/prerender/test/index.test.js
Expand Up @@ -377,21 +377,21 @@ const runTests = (dev = false, looseMode = false) => {

it('should reload page on failed data request', async () => {
const browser = await webdriver(appPort, '/')
await browser.eval('window.beforeClick = true')
await browser.eval('window.beforeClick = "abc"')
await browser.elementByCss('#broken-post').click()
await waitFor(1000)
expect(await browser.eval('window.beforeClick')).not.toBe('true')
expect(await browser.eval('window.beforeClick')).not.toBe('abc')
})

// TODO: dev currently renders this page as blocking, meaning it shows the
// server error instead of continously retrying. Do we want to change this?
if (!dev) {
it('should reload page on failed data request, and retry', async () => {
const browser = await webdriver(appPort, '/')
await browser.eval('window.beforeClick = true')
await browser.eval('window.beforeClick = "abc"')
await browser.elementByCss('#broken-at-first-post').click()
await waitFor(3000)
expect(await browser.eval('window.beforeClick')).not.toBe('true')
expect(await browser.eval('window.beforeClick')).not.toBe('abc')

const text = await browser.elementByCss('#params').text()
expect(text).toMatch(/post.*?post-999/)
Expand Down

0 comments on commit 1a9b49b

Please sign in to comment.