Can't implement pure SSR rendering in Cypress, tests pollute each other
Closed this issue · 2 comments
See cypress/support/commands/ssr.ts
. This command is based on @bahmutov recipe.
However it seems to work only with one test. cy.state
is probably doing some weird asynchronous stuffs, and is not yet documented.
Issue for cy.state
documentation: cypress-io/cypress-documentation#108
To repro:
git checkout bugfix/40-cypress-ssr-visit
yarn run dev
yarn run cypress:open
- Run
i18n
tests. The fr test will pass, but the document is not correctly rewritten for the en test.
Code is incypress/integration/vns/i18n.spec.ts
andcypress/support/commands/ssr.ts
I've tried to clone document, no success.
Will be partly solved by #71
We now consider data fetching SSR as the most advanced way of rendering, and it should be used only by advanced users with a very clear idea of what they are doing.
Thus, we expect them to be able to spawn an intermediate test server or to be able to run tests against their production architecture efficiently like they would do in any micro-service architecture.
In Vulcan, we won't consider this use case and suppose that all requests are happening in the browser now.
Closing as nowadays MSW (Mock Service Worker) is the recommended way to mock server calls, and works also for SSR. See #125