fix(tests): accomodate isplaywrightready (#1746)
This commit is contained in:
parent
cd2ecb2212
commit
bf656ea318
19
test/test.js
19
test/test.js
|
|
@ -20,6 +20,7 @@ const readline = require('readline');
|
|||
const TestRunner = require('../utils/testrunner/');
|
||||
const {Environment} = require('../utils/testrunner/Test');
|
||||
|
||||
function collect(browserNames) {
|
||||
let parallel = 1;
|
||||
if (process.env.PW_PARALLEL_TESTS)
|
||||
parallel = parseInt(process.env.PW_PARALLEL_TESTS.trim(), 10);
|
||||
|
|
@ -52,12 +53,6 @@ const testRunner = new TestRunner({
|
|||
if (config.setupTestRunner)
|
||||
config.setupTestRunner(testRunner);
|
||||
|
||||
console.log('Testing on Node', process.version);
|
||||
|
||||
const browserNames = ['chromium', 'firefox', 'webkit'].filter(name => {
|
||||
return process.env.BROWSER === name || process.env.BROWSER === 'all';
|
||||
});
|
||||
|
||||
for (const [key, value] of Object.entries(testRunner.api()))
|
||||
global[key] = value;
|
||||
|
||||
|
|
@ -205,4 +200,16 @@ if (filterArgIndex !== -1) {
|
|||
testRunner.focusMatchingTests(new RegExp(filter, 'i'));
|
||||
}
|
||||
|
||||
return testRunner;
|
||||
}
|
||||
|
||||
module.exports = collect;
|
||||
|
||||
if (require.main === module) {
|
||||
console.log('Testing on Node', process.version);
|
||||
const browserNames = ['chromium', 'firefox', 'webkit'].filter(name => {
|
||||
return process.env.BROWSER === name || process.env.BROWSER === 'all';
|
||||
});
|
||||
const testRunner = collect(browserNames);
|
||||
testRunner.run().then(() => { delete global.expect; });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ const PROJECT_ROOT = fs.existsSync(path.join(__dirname, '..', 'package.json')) ?
|
|||
const mkdtempAsync = util.promisify(require('fs').mkdtemp);
|
||||
const removeFolderAsync = util.promisify(removeFolder);
|
||||
|
||||
let platform = os.platform();
|
||||
|
||||
const utils = module.exports = {
|
||||
/**
|
||||
* @return {string}
|
||||
|
|
@ -182,9 +184,9 @@ const utils = module.exports = {
|
|||
FFOX: browserType.name() === 'firefox',
|
||||
WEBKIT: browserType.name() === 'webkit',
|
||||
CHROMIUM: browserType.name() === 'chromium',
|
||||
MAC: os.platform() === 'darwin',
|
||||
LINUX: os.platform() === 'linux',
|
||||
WIN: os.platform() === 'win32',
|
||||
MAC: platform === 'darwin',
|
||||
LINUX: platform === 'linux',
|
||||
WIN: platform === 'win32',
|
||||
browserType,
|
||||
defaultBrowserOptions,
|
||||
playwrightPath: PROJECT_ROOT,
|
||||
|
|
@ -193,6 +195,11 @@ const utils = module.exports = {
|
|||
OUTPUT_DIR,
|
||||
};
|
||||
},
|
||||
|
||||
setPlatform(p) {
|
||||
// To support isplaywrightready.
|
||||
platform = p;
|
||||
},
|
||||
};
|
||||
|
||||
function valueFromEnv(name, defaultValue) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue