This is a separate project to hold end-to-end tests for the design system.
What's special about this project is that it adds a new command (cy.renderFromStorybook
) to cypress, which allows you to render a component from NDS's component project.
e.g.
it("renders a react component", () => {
cy.renderFromStorybook("select--base");
});
cypress works by running against an existing server. Unlike application development, NDS doesn't have an app server to run. The second best thing it has is a storybook. The components-e2e project has tasks that will build/start storybook before running cypress tests.
Stories within any component folder can be tested and additional stories just for testing purposes can be found in components/src/StoriesForTests
.
To test in the cypress runner (to see the tests run):
yarn cypress:open
- Then run whichever file you want.
CLI:
yarn e2e:test
IN BROWSER:
yarn e2e:start