combine puppeteer config files

This commit is contained in:
Ron Rennick 2020-05-04 14:37:25 -03:00
parent 4af4d29952
commit 97a6110ae4
3 changed files with 29 additions and 27 deletions

View File

@ -30,6 +30,7 @@ const testEnvVars = {
'../config/jest-puppeteer.config.js'
),
NODE_CONFIG_DIR: nodeConfigDirs.join( ':' ),
node_config_dev: program.dev ? 'yes' : 'no',
};
let jestCommand = 'jest';
@ -41,10 +42,6 @@ const jestArgs = [
];
if ( program.dev ) {
testEnvVars.JEST_PUPPETEER_CONFIG = path.resolve(
__dirname,
'../config/jest-puppeteer.dev.config.js'
);
jestCommand = 'npx';
jestArgs.unshift( 'ndb', 'jest' );
}

View File

@ -1,8 +1,30 @@
/** @format */
module.exports = {
launch: {
// Required for the logged out and logged in tests so they don't share app state/token.
browserContext: 'incognito',
},
};
let puppeteerConfig;
if ( 'no' == global.process.env.node_config_dev ) {
puppeteerConfig = {
launch: {
// Required for the logged out and logged in tests so they don't share app state/token.
browserContext: 'incognito',
},
};
} else {
puppeteerConfig = {
launch: {
slowMo: process.env.PUPPETEER_SLOWMO ? false : 50,
headless: process.env.PUPPETEER_HEADLESS || false,
ignoreHTTPSErrors: true,
args: [ '--window-size=1920,1080', '--user-agent=chrome' ],
devtools: true,
defaultViewport: {
width: 1280,
height: 800,
},
// Required for the logged out and logged in tests so they don't share app state/token.
browserContext: 'incognito',
},
};
}
module.exports = puppeteerConfig;

View File

@ -1,17 +0,0 @@
/** @format */
module.exports = {
launch: {
slowMo: process.env.PUPPETEER_SLOWMO ? false : 50,
headless: process.env.PUPPETEER_HEADLESS || false,
ignoreHTTPSErrors: true,
args: [ '--window-size=1920,1080', '--user-agent=chrome' ],
devtools: true,
defaultViewport: {
width: 1280,
height: 800,
},
// Required for the logged out and logged in tests so they don't share app state/token.
browserContext: 'incognito',
},
};