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

Storyshots screenshot timing issue #3385

Closed
michaelgeorgeattard opened this issue Apr 9, 2018 · 3 comments
Closed

Storyshots screenshot timing issue #3385

michaelgeorgeattard opened this issue Apr 9, 2018 · 3 comments

Comments

@michaelgeorgeattard
Copy link

Problem: Storyshots screenshot is sometimes a white image.

The components being tested are Angular 5 components.

I am using latest version of storybook and addons.

I am initializing storyshots using the following:

initStoryshots({
   suite: "Image storyshots",
   test: imageSnapshot({
      storybookUrl: `file://${path.join(process.cwd(), "storybook-static")}`,
      getGotoOptions: ({ context, url }) => ({
         waitUntil: "domcontentloaded"
      })
   })
});

I tried all puppeteer waitUntil parameters from https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegotourl-options however nothing worked.

Puppeteer has an open issue to add a waitUntilTime api, however the issue is still open and unanswered: puppeteer/puppeteer#2238

In the meantime, could storyshots implement something similar to guarantee that a component is fully rendered before a screenshot is taken?

@Hypnosphi
Copy link
Member

You can use this approach: https://github.com/storybooks/storybook/tree/master/addons/storyshots#specifying-options-to-jest-image-snapshots

But maybe we could implement a more explicit API for delays, @thomasbertet WDYT?

@michaelgeorgeattard
Copy link
Author

@Hypnosphi I think beforeScreenshot is good enough till waitUntilTime or similar is implemented by Puppeteer.

Things are working correctly now, thanks!

@ngood97
Copy link

ngood97 commented Nov 30, 2020

You can use this approach: https://github.com/storybooks/storybook/tree/master/addons/storyshots#specifying-options-to-jest-image-snapshots

But maybe we could implement a more explicit API for delays, @thomasbertet WDYT?

This link doesn't exist and now is at https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-puppeteer#specifying-options-to-jest-image-snapshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants