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

[Feature proposal] Provide a way of taking multiple screenshots of the same component(eg on various devices) #5

Closed
gcazaciuc opened this issue Sep 4, 2017 · 5 comments

Comments

@gcazaciuc
Copy link

gcazaciuc commented Sep 4, 2017

storybook-chrome-screenshot allows in a very nice manner to specificy the device and viewports for the screenshots. Currently, there isn't a way to screenshot a component on multiple devices and resolutions without creating additional stories for each device and resolution(which doesn't help since most probably the component should be tested in React storybook full screen mode and using Chrome device emulator).

One limitation that prevents us from using it to screenshot components across all devices that we support is that there isn't really a way for a story to be screen-shoted across multiple configurations. Eg, given a story like

 .add('Basic Sticky Button', withScreenshot()(() => (
        <StickyButton label={label} disabled={false} onClick={action(`click`)} />)))

In the example above StickyButton is a responsive component. We need to support and have different layouts on Mobile, Table and Desktop devices in normal and landscape mode.

It would be really cool to have the same story screenshoted in all 3 configurations by specifying them as an array of options:

setScreenshotOptions {
  delay: 0,               
  viewport: [
{                           // Desktop view configuration
    width: 1024,
    height: 768,
    deviceScaleFactor: 1,
    isMobile: false,
    hasTouch: false,
    isLandscape: false,
  },
 {              
    width: 300,  // Mobile configuration
    height: 420,
    deviceScaleFactor: 1,
    isMobile: true,
    hasTouch: true,
    isLandscape: false,
  },
  {              
    width: 768,  // Tablet configuration
    height: 800,
    deviceScaleFactor: 1,
    isMobile: true,
    hasTouch: true,
    isLandscape: false,
  }
],
}

In the example above for each component 3 screenshots would be taken according to the specified viewport settings.

@gcazaciuc gcazaciuc changed the title [Feature proposal] Provide a way o taking screenshots of responsive components [Feature proposal] Provide a way of taking multiple screenshots of the same component(eg on various devices) Sep 4, 2017
@wadackel
Copy link
Collaborator

wadackel commented Sep 4, 2017

Hi @gcazaciuc, Thank you for a wonderful proposal !
The proposed function is simple and powerful to test components 👍
I would like to implement it in the next release.

wadackel pushed a commit that referenced this issue Sep 6, 2017
@wadackel
Copy link
Collaborator

wadackel commented Sep 6, 2017

@gcazaciuc. Released as 0.5.0-alpha.1 👍

If there is no problem with the behavior, I'd like to release the version which removed alpha.
Please check when you have time.

@gcazaciuc
Copy link
Author

Hello. It works awesome, many thanks!

@wadackel
Copy link
Collaborator

wadackel commented Sep 8, 2017

@gcazaciuc Thanks for confirmation!
Are other features working as well?

@wadackel
Copy link
Collaborator

Release as 0.5.0 🎉

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

2 participants