2020-04-02 13:41:06 +00:00
|
|
|
/** @format */
|
2021-11-23 17:55:42 +00:00
|
|
|
/**
|
|
|
|
* For a detailed explanation of configuration properties, visit:
|
|
|
|
* https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
|
|
|
|
*/
|
2020-04-02 13:41:06 +00:00
|
|
|
|
2021-11-23 17:55:42 +00:00
|
|
|
const { CI, E2E_DEBUG, PUPPETEER_SLOWMO, E2E_EXE_PATH } = process.env;
|
|
|
|
let executablePath = '';
|
|
|
|
let dumpio = false;
|
2020-05-04 17:37:25 +00:00
|
|
|
let puppeteerConfig;
|
|
|
|
|
2021-11-23 17:55:42 +00:00
|
|
|
|
|
|
|
if ( ! CI && E2E_EXE_PATH !== '' ) {
|
|
|
|
executablePath = E2E_EXE_PATH;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( E2E_DEBUG ) {
|
|
|
|
dumpio = true;
|
|
|
|
}
|
|
|
|
const jestPuppeteerLaunch = {
|
|
|
|
// Required for the logged out and logged in tests so they don't share app state/token.
|
|
|
|
browserContext: 'incognito',
|
|
|
|
defaultViewport: {
|
|
|
|
width: 1280,
|
|
|
|
height: 800,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-05-04 17:37:25 +00:00
|
|
|
if ( 'no' == global.process.env.node_config_dev ) {
|
2020-07-29 21:57:59 +00:00
|
|
|
puppeteerConfig = {
|
2021-11-23 17:55:42 +00:00
|
|
|
launch: jestPuppeteerLaunch,
|
2020-07-29 21:57:59 +00:00
|
|
|
};
|
2020-05-04 17:37:25 +00:00
|
|
|
} else {
|
|
|
|
puppeteerConfig = {
|
|
|
|
launch: {
|
2021-11-23 17:55:42 +00:00
|
|
|
...jestPuppeteerLaunch,
|
|
|
|
executablePath,
|
|
|
|
dumpio,
|
|
|
|
slowMo: PUPPETEER_SLOWMO ? PUPPETEER_SLOWMO : 50,
|
2020-09-20 19:34:47 +00:00
|
|
|
headless: false,
|
2020-05-04 17:37:25 +00:00
|
|
|
ignoreHTTPSErrors: true,
|
|
|
|
args: [ '--window-size=1920,1080', '--user-agent=chrome' ],
|
|
|
|
devtools: true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = puppeteerConfig;
|