@@ -13,7 +13,7 @@ await page.evaluate(() => {
1313 // functions from the `msw` package you want to use since
1414 // you cannot reference them in `page.evaluate` directly.
1515 const { worker, http, graphql } = window .msw
16- worker .use (... )
16+ worker .use (... overrides )
1717})
1818```
1919
@@ -30,16 +30,16 @@ npm i msw @msw/playwright
3030``` ts
3131// playwright.setup.ts
3232import { test as testBase } from ' @playwright/test'
33- import { createWorkerFixture , type WorkerFixture } from ' @msw/playwright'
33+ import { createNetworkFixture , type NetworkFixture } from ' @msw/playwright'
3434import { handlers } from ' ../mocks/handlers.js'
3535
3636interface Fixtures {
37- worker : WorkerFixture
37+ network : NetworkFixture
3838}
3939
4040export const test = testBase .extend <Fixtures >({
41- // Create your worker fixture to access in tests.
42- worker: createWorkerFixture ({
41+ // Create a fixture that will control the network in your tests.
42+ network: createNetworkFixture ({
4343 initialHandlers: handlers ,
4444 }),
4545})
@@ -49,10 +49,10 @@ export const test = testBase.extend<Fixtures>({
4949import { http , HttpResponse } from ' msw'
5050import { test } from ' ./playwright.setup.js'
5151
52- test (' displays the user dashboard' , async ({ worker , page }) => {
53- // Access and use the worker as you normally would!
52+ test (' displays the user dashboard' , async ({ network , page }) => {
53+ // Access the network fixture and use it as the `setupWorker()` API.
5454 // No more disrupted context between processes.
55- worker .use (
55+ network .use (
5656 http .get (' /user' , () => {
5757 return HttpResponse .json ({
5858 id: ' abc-123' ,
0 commit comments