Giter Club home page Giter Club logo

remix-msw-node-with-playwright's Introduction

Demo: Using mswjs to create serverside & client side mocks + work on your app offline

Demo Video

msw-nodejs-example.mp4

demo video showcases:

  • making an API call to example.com, and MSW intercepting the request and returning a response.
  • running playwright test suite, it runs my app as a user would, fetches data, but recieved the mocked responses from MSW

Highlights

  • run your E2E/Integration test suite faster by using MSW inside of your node server
    • API responses are fast b/c data is local, no need to go to external machine etc
  • ability to share your handler code on the server or browser
    • MSW node initialization
      • in this app, all data fetching happens through the remix server, so this is why we initialize MSW there instead of our web browser
    • MSW browser initialization
      • you could use the same handlers in the browser & those would be useful if wanted to test a single component in isolation with data from an API (which MSW would return)
  • work entirely offline on your app with the help of MSW
    • Example: you're working with a 3rd party API & its down or you don't want to get rate limited, so you create an MSW handler to intercept requests to that particular URL
    • Example: you're going to travel & have no internet, so you create an MSW handler to prepare for offline coding

Questions ❓❔

Feel free to ask questions in the discussion thread here to help folks in the community: remix-run/remix#4982

Development

From your terminal:

npm run dev

This starts your app in development mode, rebuilding assets on file changes.

Integration/E2E tests

# if you want to view playwright visually
npm run playwright:visualize 

# if want to run playwright headlessly
npm run playwright 

Run the app in production mode:

npm start

remix-msw-node-with-playwright's People

Contributors

cliffordfajardo avatar

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.