Closed jolientb closed 3 months ago
Hi, @jolientb.
Your MSW setup seems good to me. The root cause of your issue is that Cypress doesn't seem to wait for your application to render. You may want to explicitly instruct Cypress to wait until a certain HTML element is visible on the page before running the test suite.
This is not an MSW issue.
Prerequisites
Environment check
msw
versionBrowsers
No response
Reproduction repository
https://github.com/jolientb/msw-cypress.git
Reproduction steps
Current behavior
Cypress test fails in Electron browser When you run the cypress e2e test in the Electron browser for the first time the test fails, because msw is only enabled after the test has finished. When running the test again in the same session, msw is enabled on time and the test does succeed.
Ps. When running the test in the chrome browser or in Electron 118 (headless) msw is enabled on time, and the test succeeds. And I tried adding an await before worker.start(), but this doesn't solve the problem.
Expected behavior
Electron browser: MSW should be enabled before test is completed When you run the cypress e2e test in the Electron browser for the first time, msw should be enabled before the test finishes and the test should succeed (just like in the Chrome browser).