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..1c5eabd2549fe1 100644 --- a/test/e2e/app-dir/app-prefetch/prefetching.test.ts +++ b/test/e2e/app-dir/app-prefetch/prefetching.test.ts @@ -344,7 +344,7 @@ describe('app dir - prefetching', () => { // we should be on the static page await browser.waitForElementByCss('#static-page') - // We still shouldn't see any requests + // 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 +381,25 @@ 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') + + // 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) + }) }) })