Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky screenshots with Storybook v7 in GitHub Actions #839

Open
davejsdev opened this issue Feb 27, 2024 · 0 comments
Open

Flaky screenshots with Storybook v7 in GitHub Actions #839

davejsdev opened this issue Feb 27, 2024 · 0 comments

Comments

@davejsdev
Copy link

Storybook v7 has been out for awhile but it seems that Storycap hasn't been updated to officially support it.

The main issue I'm currently facing is that Storycap output is being flaky when running in GitHub Actions. It works correctly when run locally though. Roughly half of the screenshot re showing the "No Preview" screen.

My guess is that since GitHub Actions is running with less CPU resources than I have locally, it's slow switching between stories and the screenshots are being captured before the story is able to render. I tried adding a --delay 1000 but that didn't help.

There are no errors or warnings output.

Deps:

Storybook config:

const config = {
  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
  addons: [
    '@storybook/addon-links',
    '@storybook/addon-essentials',
    '@storybook/preset-create-react-app',
    '@storybook/addon-onboarding',
    '@storybook/addon-interactions',
  ],
  framework: {
    name: '@storybook/react-vite',
    options: {},
  },
  docs: {
    autodocs: 'tag',
  },
  staticDirs: ['../public'],
};
export default config;

Github Actions steps:

- name: Build Storybook
  run: yarn exec -- storybook build --output-dir ./storybook-static
- name: Capture screenshots
  run: yarn exec -- storycap --serverCmd "npx http-server ./storybook-static --port 6008" http://127.0.0.1:6008/ --viewport 1024x768 --outDir ./screenshots

Screenshots Output for some stories

image

@davejsdev davejsdev changed the title Flaky screenshots with Storybook v7 Flaky screenshots with Storybook v7 in GitHub Actions Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant