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: add browserLaunchOptions to CommonConfig #18927

Merged
merged 4 commits into from
Sep 27, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
storyshots-puppeteer: add browserLaunchOptions to documentation
  • Loading branch information
evad1n committed Aug 12, 2022
commit f455ec17eb77dbadfc7719c3ec456384edd6b4a2
20 changes: 20 additions & 0 deletions code/addons/storyshots/storyshots-puppeteer/README.md
Original file line number Diff line number Diff line change
@@ -107,6 +107,26 @@ initStoryshots({
});
```

### Customizing browser launch options (Puppeteer API)

You might use the `browserLaunchOptions` to specify options for the default browser instance. Will be passed to [puppeteer.launch()](https://pptr.dev/api/puppeteer.puppeteernode.launch)

```js
import initStoryshots from '@storybook/addon-storyshots';
import { puppeteerTest } from '@storybook/addon-storyshots-puppeteer';

initStoryshots({
suite: 'Puppeteer storyshots',
test: puppeteerTest({
storybookUrl: 'https://some-local-ssl-url:7777',
browserLaunchOptions: {
// For ignoring self-signed certificates
ignoreHTTPSErrors: true,
},
}),
});
```

### Specifying custom Chrome executable path (Puppeteer API)

You might use `chromeExecutablePath` to specify the path to a different version of Chrome, without downloading Chromium. Will be passed to [Runs a bundled version of Chromium](https://github.com/GoogleChrome/puppeteer#default-runtime-settings)
4 changes: 4 additions & 0 deletions code/addons/storyshots/storyshots-puppeteer/src/config.ts
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@ export interface CommonConfig {
getGotoOptions: (options: Options) => DirectNavigationOptions;
customizePage: (page: Page) => Promise<void>;
getCustomBrowser: () => Promise<Browser>;
/**
* Puppeteer browser launch options:
* {@link https://pptr.dev/api/puppeteer.puppeteernode.launch/ puppeteer.launch()}
*/
browserLaunchOptions: LaunchOptions;
setupTimeout: number;
testTimeout: number;