Skip to content

Commit

Permalink
Merge pull request #3027 from storybooks/intagration-wait-stories
Browse files Browse the repository at this point in the history
Integration tests: wait until stories appear
  • Loading branch information
Hypnosphi authored Feb 19, 2018
2 parents 0f5adb3 + 0e063f5 commit 7e026e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion integration/examples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ const examples = [
{
name: 'cra-kitchen-sink',
storybookUrl: pathToCraKitchenSink,
storySelector: '#root *',
},
{
name: 'vue-kitchen-sink',
storybookUrl: pathToVueKitchenSink,
storySelector: '#root *',
},
{
name: 'angular-cli',
storybookUrl: pathToAngularKitchenSink,
storySelector: 'storybook-dynamic-app-root *',
},
];

examples.forEach(({ name, storybookUrl }) => {
examples.forEach(({ name, storybookUrl, storySelector }) => {
let browser = puppeteer.launch();
let page;

Expand All @@ -50,6 +53,8 @@ examples.forEach(({ name, storybookUrl }) => {

it(`Take screenshots for '${name}'`, async () => {
await page.goto(`file://${storybookUrl}`);
const iframe = page.mainFrame().childFrames()[0];
await iframe.waitFor(storySelector);
const screenshot = await page.screenshot({ fullPage: true });
expect(screenshot).toMatchImageSnapshot({
failureThreshold: 0.04, // 4% threshold,
Expand Down

0 comments on commit 7e026e3

Please sign in to comment.