File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
examples/overrides/memory-queue/e2e Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,25 @@ test.describe("memory-queue", () => {
66 await expect ( page . getByText ( "Hello from a Statically generated page" ) ) . toBeVisible ( ) ;
77 } ) ;
88
9- test ( "the index page should revalidate" , async ( { page } ) => {
9+ test ( "the index page should revalidate" , async ( { page, request } ) => {
10+ // We need to make sure the page is loaded and is a HIT
11+ // If it is STALE, the next hit may have an updated date and thus fail the test
12+ let cacheHeaders = "" ;
13+ do {
14+ const req = await request . get ( "/" ) ;
15+ cacheHeaders = req . headers ( ) [ "x-nextjs-cache" ] ;
16+ await page . waitForTimeout ( 500 ) ;
17+ } while ( cacheHeaders !== "HIT" ) ;
18+
1019 await page . goto ( "/" ) ;
1120 const firstDate = await page . getByTestId ( "date-local" ) . textContent ( ) ;
12- await page . waitForTimeout ( 5000 ) ;
13- await page . reload ( ) ;
1421
22+ await page . reload ( ) ;
1523 let newDate = await page . getByTestId ( "date-local" ) . textContent ( ) ;
1624 expect ( newDate ) . toBe ( firstDate ) ;
1725
26+ await page . waitForTimeout ( 5000 ) ;
27+
1828 do {
1929 await page . reload ( ) ;
2030 newDate = await page . getByTestId ( "date-local" ) . textContent ( ) ;
You can’t perform that action at this time.
0 commit comments