Giter VIP home page Giter VIP logo

Comments (3)

ryanto avatar ryanto commented on August 15, 2024

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 cy.wait('@createUser') from the example?

@samselikoff Would like to get your thoughts here as well.

from site.

samselikoff avatar samselikoff commented on August 15, 2024

from site.

romansndlr avatar romansndlr commented on August 15, 2024

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:

  • This is typically the types of assertions that cypress users have because this is encouraged by the cypress docs, so if we want to provide the easiest "least resistance" path to migrate a test file from fixtures to mirage, I do think we should keep it just to show you don't have to remove it.
  • From my experience, most of the time you are not 100% covered by just asserting against the rendered output of a successful HTTP request... sometimes you need to create a user and then you are redirected to the users' list that doesn't display all the properties you passed in the request, or you need to notify the server to send out an email and you need to make sure the right data is sent.
  • If we are recommending against this approach, I think we should find an alternative way to make sure the right data is sent to the server when you need it. do you guys still recommend asserting against mirage's database?
  • Another thing to keep in mind is that users might want to change a test from being an integration test to an e2e test so any guide we provide should also take this into consideration.

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 😜

from site.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.