restore non-dev puppeteer config, move test config to sequencer

This commit is contained in:
Ron Rennick 2020-07-29 18:57:59 -03:00
parent d4620b5351
commit 09a594443d
3 changed files with 19 additions and 12 deletions

View File

@ -49,15 +49,6 @@ if ( appPath ) {
}
// Load test configuration file into an object.
const localTestConfigFile = path.resolve( appPath, 'tests/e2e/config/default.json' );
const testConfigFile = path.resolve( __dirname, '../config/default.json' );
// Copy local test configuration file if it exists.
if ( fs.existsSync( localTestConfigFile ) ) {
fs.copyFileSync(
localTestConfigFile,
testConfigFile
);
}
const testConfig = getTestConfig();
// Set some environment variables

View File

@ -4,7 +4,12 @@ const { jestPuppeteerConfig } = require( '@automattic/puppeteer-utils' );
let puppeteerConfig;
if ( 'no' == global.process.env.node_config_dev ) {
puppeteerConfig = jestPuppeteerConfig;
puppeteerConfig = {
launch: {
// Required for the logged out and logged in tests so they don't share app state/token.
browserContext: 'incognito',
},
};
} else {
puppeteerConfig = {
launch: {
@ -15,7 +20,7 @@ if ( 'no' == global.process.env.node_config_dev ) {
defaultViewport: {
width: 1280,
height: 800,
}
},
},
};
}

View File

@ -1,8 +1,19 @@
const path = require( 'path' );
const fs = require( 'fs' );
const getAppRoot = require( './app-root' );
// Copy local test configuration file if it exists.
const appPath = getAppRoot();
const localTestConfigFile = path.resolve( appPath, 'tests/e2e/config/default.json' );
const testConfigFile = path.resolve( __dirname, '../config/default.json' );
if ( fs.existsSync( localTestConfigFile ) ) {
fs.copyFileSync(
localTestConfigFile,
testConfigFile
);
}
const getTestConfig = () => {
const testConfigFile = path.resolve( __dirname, '../config/default.json' );
const rawTestConfig = fs.readFileSync( testConfigFile );
let testConfig = JSON.parse(rawTestConfig);