Skip to content

Commit

Permalink
de-flake deploy test
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Oct 1, 2024
1 parent 1b4608b commit 6ae870d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/e2e/app-dir/app-prefetch/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default function HomePage() {
<Link href="/static-page" id="to-static-page">
To Static Page
</Link>
<Link href="/dynamic-page" id="to-dynamic-page-no-params">
To Dynamic Page
</Link>
<Link href="/prefetch-auto/foobar" id="to-dynamic-page">
To Dynamic Slug Page
</Link>
Expand Down
25 changes: 24 additions & 1 deletion test/e2e/app-dir/app-prefetch/prefetching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ describe('app dir - prefetching', () => {
// we should be on the static page
await browser.waitForElementByCss('#static-page')

// We still shouldn't see any requests
await browser.waitForIdleNetwork()

// We still shouldn't see any requests since it respects the static staletime (default 5m)
await retry(async () => {
expect(rscRequests.filter((req) => req === '/static-page').length).toBe(
0
Expand Down Expand Up @@ -381,6 +383,27 @@ describe('app dir - prefetching', () => {
rscRequests.filter((req) => req === '/dynamic-page').length
).toBe(0)
})

// navigate to index
await browser.elementByCss('[href="/"]').click()

// we should be on the index page
await browser.waitForElementByCss('#to-dashboard')

// navigate to the dynamic page
await browser.elementByCss('[href="/dynamic-page"]').click()

// we should be on the dynamic page
await browser.waitForElementByCss('#dynamic-page')

await browser.waitForIdleNetwork()

// We should see a request for the dynamic page since it respects the dynamic staletime (default 0)
await retry(async () => {
expect(
rscRequests.filter((req) => req === '/dynamic-page').length
).toBe(1)
})
})
})

Expand Down

0 comments on commit 6ae870d

Please sign in to comment.