Skip to content

Commit

Permalink
Merge pull request #4045 from storybooks/storyshots-puppeteer-images-…
Browse files Browse the repository at this point in the history
…do-not-match

Storyshots puppeteer images do not match
  • Loading branch information
igor-dv committed Aug 20, 2018
2 parents 494bda5 + 9ca612f commit b7054f3
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit b7054f3

Please sign in to comment.