combine puppeteer config files
This commit is contained in:
parent
4af4d29952
commit
97a6110ae4
|
@ -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' );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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',
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue