Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Storyshots don't respect viewport's width

I'm using Jest + Storyshots to test my (React) webapp, but the components are always rendered in a 1024px-wide viewport, even if I specify a different viewport in the story. Am I using Storybook the wrong way or is it a (known) bug ? Currently I can't test responsive components properly.

The code for a story:

const Template: Story<MyComponentProps> = (args) => (
    <MyComponent{...args} />
);

export const Mobile = Template.bind({});
Mobile.parameters = {
    viewport: {
        viewports: mobileViewports,
        defaultViewport: 'iPhone5',
    },
};

An example of viewport:

export const iPhone5 = {
    name: 'iPhone 5/SE',
    styles: {
        width: '320px',
        height: '568px',
    },
    type: 'mobile',
};

My storyshot config:

initStoryshots({
    test: multiSnapshotWithOptions({
        createNodeMock: (element: unknown) => element,
    }),
    stories2snapsConverter: new Stories2SnapsConverter({
        snapshotsDirName: './__snapshots__',
    }),
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!