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 puppeteer images do not match #4037

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions addons/storyshots/storyshots-puppeteer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,21 @@ export const imageSnapshot = (customConfig = {}) => {

expect.assertions(1);

let image;
try {
await customizePage(page);
await page.goto(url, getGotoOptions({ context, url }));
await beforeScreenshot(page, { context, url });
const image = await page.screenshot(getScreenshotOptions({ context, url }));

expect(image).toMatchImageSnapshot(getMatchOptions({ context, url }));
image = await page.screenshot(getScreenshotOptions({ context, url }));
} catch (e) {
logger.error(
`ERROR WHILE CONNECTING TO ${url}, did you start or build the storybook first ? A storybook instance should be running or a static version should be built when using image snapshot feature.`,
`Error when connecting to ${url}, did you start or build the storybook first? A storybook instance should be running or a static version should be built when using image snapshot feature.`,
e
);
throw e;
}

expect(image).toMatchImageSnapshot(getMatchOptions({ context, url }));
};

testFn.afterAll = () => browser.close();
Expand Down