Skip to content

Commit e18af11

Browse files
committed
Update docs for experimental testmode
1 parent ae5026a commit e18af11

File tree

1 file changed

+8
-1
lines changed
  • packages/next/src/experimental/testmode/playwright

1 file changed

+8
-1
lines changed

packages/next/src/experimental/testmode/playwright/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { defineConfig } from 'next/experimental/testmode/playwright'
3535

3636
export default defineConfig({
3737
webServer: {
38-
command: 'npm dev',
38+
command: 'npm run dev',
3939
url: 'http://localhost:3000',
4040
},
4141
})
@@ -44,10 +44,17 @@ export default defineConfig({
4444
### Use the `next/experimental/testmode/playwright` to create tests
4545

4646
```javascript
47+
// Place this file in the `app` directory and name it with `.spec.ts`.
48+
// To customize where to put tests, add `testMatch` to `playwright.config.ts`.
49+
4750
import { test, expect } from 'next/experimental/testmode/playwright'
4851

4952
test('/product/shoe', async ({ page, next }) => {
5053
next.onFetch((request) => {
54+
// `next.onFetch` only intercepts external fetch requests (for both client and server).
55+
// For example, if you `fetch` a relative URL (e.g. `/api/hello`) from the client
56+
// that's handled by a Next.js route handler (e.g. `app/api/hello/route.ts`),
57+
// it won't be intercepted.
5158
if (request.url === 'http://my-db/product/shoe') {
5259
return new Response(
5360
JSON.stringify({

0 commit comments

Comments
 (0)