Skip to content

Commit

Permalink
doc: fix storyshots-puppeteer README, so of the examples were not a…
Browse files Browse the repository at this point in the history
…ligned with puppeteer attributes anymore
  • Loading branch information
gaetanmaisse committed Aug 8, 2019
1 parent 743596a commit c28cccb
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions addons/storyshots/storyshots-puppeteer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,16 @@ You might use `getScreenshotOptions` to specify options for screenshot. Will be
```js
import initStoryshots from '@storybook/addon-storyshots';
import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer';
const getScreenshotOptions = ({context, url}) => {
const getScreenshotOptions = ({ context, url }) => {
return {
fullPage: false // Do not take the full page screenshot. Default is 'true' in Storyshots.
}
}
initStoryshots({suite: 'Image storyshots', test: imageSnapshot({storybookUrl: 'http://localhost:6006', getScreenshotOptions})});
encoding: 'base64', // encoding: 'base64' is a property required by puppeteer
fullPage: false, // Do not take the full page screenshot. Default is 'true' in Storyshots.,
};
};
initStoryshots({
suite: 'Image storyshots',
test: imageSnapshot({ storybookUrl: 'http://localhost:6006', getScreenshotOptions }),
});
```

`getScreenshotOptions` receives an object `{ context: {kind, story}, url}`. _kind_ is the kind of the story and the _story_ its name. _url_ is the URL the browser will use to screenshot.
Expand Down Expand Up @@ -156,17 +160,16 @@ import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer';
import puppeteer from 'puppeteer';

(async function() {
initStoryshots({
suite: 'Image storyshots',
test: imageSnapshot({
storybookUrl: 'http://localhost:6006',
getCustomBrowser: async () => puppeteer.connect('ws://yourUrl')
}),
});
initStoryshots({
suite: 'Image storyshots',
test: imageSnapshot({
storybookUrl: 'http://localhost:6006',
getCustomBrowser: async () => puppeteer.connect({ browserWSEndpoint: 'ws://yourUrl' }),
}),
});
})();
```


### Customizing a `page` instance

Sometimes, there is a need to customize a page before it calls the `goto` api.
Expand Down

0 comments on commit c28cccb

Please sign in to comment.