File tree 1 file changed +8
-1
lines changed
packages/next/src/experimental/testmode/playwright
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import { defineConfig } from 'next/experimental/testmode/playwright'
35
35
36
36
export default defineConfig ({
37
37
webServer: {
38
- command: ' npm dev' ,
38
+ command: ' npm run dev' ,
39
39
url: ' http://localhost:3000' ,
40
40
},
41
41
})
@@ -44,9 +44,16 @@ export default defineConfig({
44
44
### Use the ` next/experimental/testmode/playwright ` to create tests
45
45
46
46
``` 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
+
47
50
import { test , expect } from ' next/experimental/testmode/playwright'
48
51
49
52
test (' /product/shoe' , async ({ page, next }) => {
53
+ // NOTE: `next.onFetch` only intercepts external `fetch` requests (for both client and server).
54
+ // For example, if you `fetch` a relative URL (e.g. `/api/hello`) from the client
55
+ // that's handled by a Next.js route handler (e.g. `app/api/hello/route.ts`),
56
+ // it won't be intercepted.
50
57
next .onFetch ((request ) => {
51
58
if (request .url === ' http://my-db/product/shoe' ) {
52
59
return new Response (
You can’t perform that action at this time.
0 commit comments