-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve experimental test proxy (#63567)
Followup on #52520 and #54014 **Enhancements** - Removes `--experimental-test-proxy` CLI argument from `next dev` and `next start` - Adds a new experimental config option `testProxy?: boolean` - Instead of throwing an error, return the `originalFetch` response if the current request context does not contain the `Next-Test-*` HTTP headers **Why?** These changes allow us to write mixed Integration + E2E tests within the same Playwright process. ```ts // some-page.spec.ts test.describe('/some-page', () => { test('some integration test', async ({ page, next }) => { // by using the `next` fixture, playwright will send the `Next-Test-*` HTTP headers for // every request in this test's context. next.onFetch(...); await page.goto(...); await expect(...).toBe('some-mocked-value'); }); test('some e2e test', async ({ page }) => { // by NOT using the `next` fixture, playwright does not send the `Next-Test-*` HTTP headers await page.goto(...); await expect(...).toBe('some-real-value'); }); }) ``` Now I can run `next dev` and locally develop my App Router pages AND run my Playwright tests against instead of having to, - run `next dev` to locally develop my change - ctrl+c to kill server - run `next dev --experimental-test-proxy` to locally run my integration tests --------- Co-authored-by: Sam Ko <sam@vercel.com>
- Loading branch information
Showing
13 changed files
with
45 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters