-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add migration guide from cypress fixtures to mirage #193
Comments
Hey @romansndlr thanks for this! Now that miragejs.com is launched I'd like to start getting more guides like this onto the website. This is much appreciated, especially since you have a lot of Cypress experience! I think there's a lot of power behind a guide that shows you how to move away from Cypress static fixtures and start using Mirage factories. I'm wondering if there are any Cypress tests you've written that have a lot of repetitive fixtures that are easier expressed as a factory? Also, Sam and I have been recommending folks not use @samselikoff Would like to get your thoughts here as well. |
If it’s an API that Cypress users expect to be able to use with the mocking layer we could document how to use it, as well as include our opinions on why not to use it.
– Sam
… On Jan 28, 2020, at 5:30 PM, Ryan T ***@***.***> wrote:
Hey @romansndlr thanks for this!
Now that miragejs.com is launched I'd like to start getting more guides like this onto the website. This is much appreciated, especially since you have a lot of Cypress experience!
I think there's a lot of power behind a guide that shows you how to move away from Cypress static fixtures and start using Mirage factories. I'm wondering if there are any Cypress tests you've written that have a lot of repetitive fixtures that are easier expressed as a factory?
Also, Sam and I have been recommending folks not use @alias's with Mirage requests because it feels like testing implementation details. Sam wrote about this here. Do you think it's ok to cut the ***@***.***') from the example?
@samselikoff Would like to get your thoughts here as well.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hey, @ryanto @samselikoff! It is my pleasure to contribute to this wonderful tool! About the waiting for the HTTP request, we might have a disagreement about this issue for these reasons:
So let me know what you guys think and then I can try and make a new draft of something more robust. maybe we can make a multistep guide that shows different levels of migration, meaning you show the smallest change you have to do and also how to take it a step forward and make a bigger change. Thanks again for the opportunity! still waiting on that invite to the podcast though 😜 |
Hey all!
Why?
Because this is a very big issue for cypress developers...
When using cypress fixtures you are required to write out static JSON files in order to have mocked out responses.
I think this could be a huge selling point for mirage because you could swap using these static very limited in power JSON files to use the full power of a browser database with really minimal work.
How
So generally in order to mock out an HTTP request with cypress you would do something like this:
The problem here is that if we ever change John Doe to be Jane Doe, this test would fail because the fixture JSON file doesn't change.
Luckily, not much is required to change this test to use mirage instead:
So basiclly all we had to do to make the transition to mirage is define the route handler (which you need to do regradless) and remove one line from our test file.
The text was updated successfully, but these errors were encountered: