From 6ae870deb3088923430bda44ff026b7c769d6608 Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:08:36 -0700 Subject: [PATCH] de-flake deploy test --- test/e2e/app-dir/app-prefetch/app/page.js | 3 +++ .../app-dir/app-prefetch/prefetching.test.ts | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/test/e2e/app-dir/app-prefetch/app/page.js b/test/e2e/app-dir/app-prefetch/app/page.js index ccded0f324b50..1f152de4f44cc 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 8ce13e2fc4b8f..0a6952a174607 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) + }) }) })