Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Prerender Test Cases #10861

Merged
merged 2 commits into from Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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