woocommerce/packages/js/e2e-environment/config/jest-puppeteer.config.js

49 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

/** @format */
/**
* For a detailed explanation of configuration properties, visit:
* https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
*/
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;
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 ) {
puppeteerConfig = {
launch: jestPuppeteerLaunch,
};
2020-05-04 17:37:25 +00:00
} else {
puppeteerConfig = {
launch: {
...jestPuppeteerLaunch,
executablePath,
dumpio,
slowMo: PUPPETEER_SLOWMO ? PUPPETEER_SLOWMO : 50,
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;