MSW for storybook with unified mock API ICSHWI-9377
This merge requests:
- adds
storybook-addon-msw
to handle using MSW (which we were already using for Jest) in Storybook. - unifies the api mocking so that the same mocks can be used in Storybook, Cypress, and Jest.
- mockAPI defines the mock endpoint functions
- apiHandlers defines the url+method -> function mapping
- Cypress and MSW use the same mapping to register HTTP intercepts
- connect MSW to mockAPI
- connect Cypress to mockAPI
- demos that Storybook scenarios for components which make API calls can be loaded into Cypress tests and everything still works (DeploymentDetailsContainer.spec.js)
- fixes the only E2E Cypress test we have to still work
- adds a command
npm run startMock
to start up the UI with MSW API mocks enabled (no backend)
Please step through commits to follow along
Edited by John Sparger
Merge request reports
Activity
Please register or sign in to reply