I've already created one play function for one of the stories, here's the relevant snipped from a recent commit:
|
CurrencyFormatter.play = async ({ canvasElement }) => { |
|
const canvas = within(canvasElement); |
|
|
|
await expect(canvas.getByText("$20,000.00")).toBeInTheDocument(); |
|
|
|
await userEvent.click(canvas.getByTestId("first-button")); |
|
|
|
await expect(canvas.getByText("$20,001.00")).toBeInTheDocument(); |
|
}; |
I've also validated that we can run it locally (with npm run test-storybook) and in CI (which uses Chromatic to run the interaction tests).
Let's look into doing a few things:
- Move all relevant tests out of standalone Jest and into Storybook play functions. This gives us the ability to rely on the existing stories that have been written to set up test cases, and also could (if we move all tests) allow us to simply drop all the testing dependencies.
- Collect coverage stats and forward them on to Codecov.
I've already created one play function for one of the stories, here's the relevant snipped from a recent commit:
react-value-flash/stories/Flash.stories.tsx
Lines 105 to 113 in 5a32b0f
I've also validated that we can run it locally (with
npm run test-storybook) and in CI (which uses Chromatic to run the interaction tests).Let's look into doing a few things: