Skip to main content

Testing a Static Storybook Web App

To run Screener against a static Storybook build, instead of starting the Storybook Dev server, follow these setup instructions.

What You'll Need

Run a Static Storybook Build

  1. Open your Storybook config file (under ".storybook/preview.js") and add the following snippet at the end:
if (typeof window === 'object') {
window.__screener_storybook__ = require('@storybook/react').getStorybook
  1. Export your Storybook project into a static web app by running:
npm run build-storybook
  1. Open your "screener.config.js" file and add the storybookStaticBuildDir option with its value set to your own static Storybook folder:
module.exports = {
projectRepo: 'sb-6.1-test',
storybookConfigDir: '.storybook',
apiKey: process.env.SCREENER_API_KEY,
resolution: '1024x768',
storybookStaticBuildDir: 'storybook-static'
  1. Run your test:
npm run test-storybook

More Information