Replies: 1 comment
-
I have prepared a React + Vite boilerplate which includes integration of MSW with Vitest and Cypress. This allows to easily test an application with mocked responses. What's included ? Repo Please give it a ⭐️ if it helped. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all thank you for this great tool for creating e2e tests!!!
My setup is the following:
What i want is to be able to initialise, update or reset the mock factory from within the cypress tests. So for example to test this use case:
User navigates to a list, then adds an item to that list, afterwards the list should contain that item. After the test i want to reset the mock factory to have a clean state for the next test.
The problem is that
msw
andmswjs/data
run in a different process thancypress
, so i can't use the factory methods. I tried to runmsw
withincypress
but get an error that it can't be executed within a browser environment. As i need to mockremix
server code withmsw
i need to usemsw
'ssetupServer
instead ofsetupWorker
(for the browser api mocking).Any ideas how i can get this to work? Any tip would be awesome as i'm really stuck right now.
Thanks in advance!!!
Beta Was this translation helpful? Give feedback.
All reactions