Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking getInitialProps Responses #116

Open
mattfwood opened this issue Nov 11, 2020 · 2 comments
Open

Mocking getInitialProps Responses #116

mattfwood opened this issue Nov 11, 2020 · 2 comments

Comments

@mattfwood
Copy link

Is it possible to mock / stub requests sent from getInitialProps or getServerSideProps? I've tried using cy.route and cy.route2 but I don't think it works since it's expecting to mock through the network layer in the browser.

Not sure if there's a way to do this or if there's a recommended practice? If there is one, I'd be glad to add it as an example in this repo.

Thanks!

@kylemh
Copy link

kylemh commented Jan 12, 2021

cypress-io/cypress#4614

I have a workaround for you.

@fibonacid
Copy link

Apparently you can run next as a cypress plugin to mock server side network calls
https://glebbahmutov.com/blog/mock-network-from-server/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants