You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to add tests for the static Storybook build (as after running the yarn build-storybook command). We will take the static build, open it locally (via Puppeteer since we're already using it in the example), and test two scenarios:
Our current component only features the useFetch hooks that calls fetch underneath. We'd have to create another component that does a request via XMLHttpRequest, create a story for it, and cover it with tests.
Steps
Create a new React component the same as the current GitHubUser component. In the new component, use XMLHttpRequest to make a request, remove the useFetch hook, and the logic around it.
Create a new story for the newly created React component. Put it in the stories/[ComponentName].stories.js.
Create a new E2E test in the e2e/[ComponentName].e2e.test.js. In this test use Puppeteer to load the locally build Storybook project, navigate to the story, and assert that it renders the elements based on the mocked data.
The text was updated successfully, but these errors were encountered:
Context
In our current Storybook integration example we feature in-browser tests against the running Storybook.
What
We need to add tests for the static Storybook build (as after running the
yarn build-storybook
command). We will take the static build, open it locally (via Puppeteer since we're already using it in the example), and test two scenarios:Our current component only features the
useFetch
hooks that callsfetch
underneath. We'd have to create another component that does a request via XMLHttpRequest, create a story for it, and cover it with tests.Steps
XMLHttpRequest
to make a request, remove theuseFetch
hook, and the logic around it.stories/[ComponentName].stories.js
.e2e/[ComponentName].e2e.test.js
. In this test use Puppeteer to load the locally build Storybook project, navigate to the story, and assert that it renders the elements based on the mocked data.The text was updated successfully, but these errors were encountered: