diff --git a/test/e2e/app-dir/app-prefetch/app/page.js b/test/e2e/app-dir/app-prefetch/app/page.js index ccded0f324b50f..1f152de4f44ccc 100644 --- a/test/e2e/app-dir/app-prefetch/app/page.js +++ b/test/e2e/app-dir/app-prefetch/app/page.js @@ -8,6 +8,9 @@ export default function HomePage() { To Static Page + + To Dynamic Page + To Dynamic Slug Page diff --git a/test/e2e/app-dir/app-prefetch/prefetching.test.ts b/test/e2e/app-dir/app-prefetch/prefetching.test.ts index 8ce13e2fc4b8f8..0a6952a174607b 100644 --- a/test/e2e/app-dir/app-prefetch/prefetching.test.ts +++ b/test/e2e/app-dir/app-prefetch/prefetching.test.ts @@ -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 @@ -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) + }) }) })