avyvar's picture
Add files using upload-large-folder tool
94786da verified
Raw
History Blame Contribute Delete
1.82 kB
diff --git a/test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts b/test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts
index 91254d0fccd3e1d6ada36b69e03974274950329e..be09ef69078ac2280973f0981ea7d750260c408e 100644
--- a/test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts
+++ b/test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts
@@ -1100,6 +1100,33 @@ describe('instant-navigation-testing-api', () => {
expect(await fetchedData.textContent()).toContain('api response')
})
+ if (isNextDev) {
+ it('lets dev-server requests through during instant scope', async () => {
+ const page = await openPage(next, '/')
+
+ await instant(page, async () => {
+ await page.click('#link-to-client-fetch')
+
+ // The out-of-band fetch to /api/data is blocked by the lock
+ const loading = page.locator('[data-testid="fetched-data-loading"]')
+ await loading.waitFor({ state: 'visible' })
+
+ // But dev-server requests (hot-reloader middleware endpoints like the
+ // error overlay and source maps) bypass the lock and resolve while the
+ // scope is still active. Without the bypass this evaluate would hang
+ // until the scope ends.
+ const status = await page.evaluate(() =>
+ fetch('/__nextjs_server_status').then((res) => res.status)
+ )
+ expect(status).toBe(200)
+
+ // The blocked fetch still hasn't resolved
+ const fetchedData = page.locator('[data-testid="fetched-data"]')
+ expect(await fetchedData.count()).toBe(0)
+ })
+ })
+ }
+
it('clears cookie even when callback throws', async () => {
const page = await openPage(next, '/')