Commit fafb4664 authored by JJ Kasper's avatar JJ Kasper Committed by Tim Neutkens

Test failed SSG data request (#9738)

parent a12030b2
...@@ -29,6 +29,9 @@ const Page = ({ world, time }) => { ...@@ -29,6 +29,9 @@ const Page = ({ world, time }) => {
<Link href="/blog/[post]" as="/blog/post-1"> <Link href="/blog/[post]" as="/blog/post-1">
<a id="post-1">to dynamic</a> <a id="post-1">to dynamic</a>
</Link> </Link>
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
</Link>
<br /> <br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1"> <Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a> <a id="comment-1">to another dynamic</a>
......
...@@ -261,6 +261,15 @@ const runTests = (dev = false) => { ...@@ -261,6 +261,15 @@ const runTests = (dev = false) => {
expect(text).toMatch(/post.*?post-1/) expect(text).toMatch(/post.*?post-1/)
}) })
it('should reload page on failed data request', async () => {
const browser = await webdriver(appPort, '/')
await waitFor(500)
await browser.eval('window.beforeClick = true')
await browser.click('#broken-post')
await waitFor(1000)
expect(await browser.eval('window.beforeClick')).not.toBe('true')
})
if (dev) { if (dev) {
it('should always call getStaticProps without caching in dev', async () => { it('should always call getStaticProps without caching in dev', async () => {
const initialRes = await fetchViaHTTP(appPort, '/something') const initialRes = await fetchViaHTTP(appPort, '/something')
......
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