mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
773ee08e9d
* chore(test): restore api coverage checks * try to catch the correct error on the bots * try to trick github into taking the new code * uninstall coverage * dgozman comments
84 lines
2.9 KiB
JavaScript
84 lines
2.9 KiB
JavaScript
/**
|
|
* Copyright 2019 Google Inc. All rights reserved.
|
|
* Modifications copyright (c) Microsoft Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const path = require('path');
|
|
const utils = require('./utils');
|
|
const {DefaultBrowserOptionsEnvironment, ServerEnvironment, GoldenEnvironment, TraceTestEnvironment} = require('./environments.js');
|
|
|
|
const playwrightPath = path.join(__dirname, '..');
|
|
|
|
const dumpLogOnFailure = valueFromEnv('DEBUGP', false);
|
|
const defaultBrowserOptionsEnvironment = new DefaultBrowserOptionsEnvironment({
|
|
handleSIGINT: false,
|
|
slowMo: valueFromEnv('SLOW_MO', 0),
|
|
headless: !!valueFromEnv('HEADLESS', true),
|
|
}, dumpLogOnFailure, playwrightPath);
|
|
|
|
const serverEnvironment = new ServerEnvironment();
|
|
const customEnvironment = new GoldenEnvironment();
|
|
|
|
function valueFromEnv(name, defaultValue) {
|
|
if (!(name in process.env))
|
|
return defaultValue;
|
|
return JSON.parse(process.env[name]);
|
|
}
|
|
|
|
function setupTestRunner(testRunner) {
|
|
const collector = testRunner.collector();
|
|
collector.addTestModifier('skip', (t, condition) => condition && t.setSkipped(true));
|
|
collector.addSuiteModifier('skip', (s, condition) => condition && s.setSkipped(true));
|
|
collector.addTestModifier('fail', (t, condition) => condition && t.setExpectation(t.Expectations.Fail));
|
|
collector.addSuiteModifier('fail', (s, condition) => condition && s.setExpectation(s.Expectations.Fail));
|
|
collector.addTestModifier('slow', t => t.setTimeout(t.timeout() * 3));
|
|
collector.addTestAttribute('debug', t => TraceTestEnvironment.enableForTest(t));
|
|
testRunner.api().fdescribe = testRunner.api().describe.only;
|
|
testRunner.api().xdescribe = testRunner.api().describe.skip(true);
|
|
testRunner.api().fit = testRunner.api().it.only;
|
|
testRunner.api().xit = testRunner.api().it.skip(true);
|
|
testRunner.api().dit = testRunner.api().it.only.debug;
|
|
}
|
|
|
|
module.exports = {
|
|
playwrightPath,
|
|
dumpLogOnFailure: valueFromEnv('DEBUGP', false),
|
|
launchOptions: {
|
|
executablePath: {
|
|
chromium: process.env.CRPATH,
|
|
firefox: process.env.FFPATH,
|
|
webkit: process.env.WKPATH,
|
|
},
|
|
slowMo: valueFromEnv('SLOW_MO', 0),
|
|
headless: !!valueFromEnv('HEADLESS', true),
|
|
},
|
|
|
|
globalEnvironments: [defaultBrowserOptionsEnvironment, serverEnvironment],
|
|
setupTestRunner,
|
|
|
|
specs: [
|
|
{
|
|
files: [
|
|
],
|
|
environments: [customEnvironment],
|
|
},
|
|
{
|
|
files: [
|
|
],
|
|
environments: [],
|
|
},
|
|
],
|
|
};
|