Cypress: Create ability to mock server requests

Created on 30 Jun 2019  路  3Comments  路  Source: cypress-io/cypress

Current behavior:

As described here, Cypress doesn't have the ability to get involved with the server process as it stands - it's just about the client. In a bid to ensure that my test environment is as identical as possible to my prod environment, I find the suggestion of rendering on the client just for the sake of tests to be less than ideal.

Desired behavior:

It'd be awesome if we were provided instructions on how to make our server make requests through the same network proxy layer that Cypress works or if Cypress could provide some kind of plugin to handle that.

Versions

All

proposal 馃挕 network feature

Most helpful comment

Users of Nuxt and Next - as well as any MVC framework - will heavily benefit from something like this.

All 3 comments

This one actually looks as a very good idea.
I got into the same problem when I need to mock some API for tests (they are not full e2e) and I also have server side rendering with Next.js
So it works beautiful without SSR and I'm a bit stuck in term of how to mock SSR requests as well.

Users of Nuxt and Next - as well as any MVC framework - will heavily benefit from something like this.

Is there any way to mount cypress/server as a piece of express middleware?

Was this page helpful?
0 / 5 - 0 ratings