Skip to content

Commit 5ed70a2

Browse files
committed
docs: add comparison with playwright-msw
1 parent 5d29031 commit 5ed70a2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,17 @@ test('displays the user dashboard', async ({ network, page }) => {
6565
await page.goto('/dashboard')
6666
})
6767
```
68+
69+
## Comparison
70+
71+
### `playwright-msw`
72+
73+
[`playwright-msw`](https://github.com/valendres/playwright-msw) is a community package that, just like `@msw/playwright`, aims to provide a better experience when mocking APIs in your Playwright tests.
74+
75+
> While `playwright-msw` is a fantastic tool and a huge inspiration for this package to exist, I believe it approaches the idea at a rather complex angle. That introduces a layer of abstraction that is subjected to the "left behind" problem as it needs to map to any MSW changes explicitly.
76+
77+
| | `playwright-msw` | `@msw/playwright` |
78+
| -------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
79+
| Initialization | `createWorkerFixture()` is used as a _part_ of your custom fixture. | `createNetworkFixture()` creates _the entire_ fixture for you, pre-configured. |
80+
| Implementation | Uses a custom router to match handlers and a custom wrapper around `SetupWorker` API. | Uses MSW directly. Uses `page.route()` as the source of the network to route through the handlers. |
81+
| Feature set | Supports `http` and `graphql` namespaces. | Supports all namespaces (`http`, `graphql`, `ws`, any other APIs exposed by MSW in the future). |

0 commit comments

Comments
 (0)