mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
committed by
Andrey Lushnikov
parent
3b03ff65c7
commit
23d25a6e12
16
test/test.js
16
test/test.js
@@ -35,6 +35,7 @@ const RESET_COLOR = '\x1b[0m';
|
||||
|
||||
const headless = (process.env.HEADLESS || 'true').trim().toLowerCase() === 'true';
|
||||
const executablePath = process.env.CHROME;
|
||||
const extensionPath = path.resolve(__dirname, '../test/assets/simple-extension');
|
||||
|
||||
if (executablePath)
|
||||
console.warn(`${YELLOW_COLOR}WARN: running tests with ${executablePath}${RESET_COLOR}`);
|
||||
@@ -48,6 +49,15 @@ const defaultBrowserOptions = {
|
||||
headless,
|
||||
args: ['--no-sandbox']
|
||||
};
|
||||
const browserWithExtensionOptions = {
|
||||
headless: false,
|
||||
executablePath,
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
`--disable-extensions-except=${extensionPath}`,
|
||||
`--load-extension=${extensionPath}`,
|
||||
],
|
||||
};
|
||||
|
||||
let parallel = 1;
|
||||
if (process.env.PPTR_PARALLEL_TESTS)
|
||||
@@ -69,7 +79,7 @@ if (fs.existsSync(OUTPUT_DIR))
|
||||
|
||||
console.log('Testing on Node', process.version);
|
||||
|
||||
beforeAll(async state => {
|
||||
beforeAll(async state => {
|
||||
const assetsPath = path.join(__dirname, 'assets');
|
||||
const cachedPath = path.join(__dirname, 'assets', 'cached');
|
||||
|
||||
@@ -131,7 +141,7 @@ describe('Page', function() {
|
||||
require('./jshandle.spec.js').addTests({testRunner, expect});
|
||||
require('./network.spec.js').addTests({testRunner, expect});
|
||||
require('./page.spec.js').addTests({testRunner, expect, puppeteer, DeviceDescriptors, headless});
|
||||
require('./target.spec.js').addTests({testRunner, expect});
|
||||
require('./target.spec.js').addTests({testRunner, expect, puppeteer, browserWithExtensionOptions});
|
||||
require('./tracing.spec.js').addTests({testRunner, expect});
|
||||
});
|
||||
|
||||
@@ -139,7 +149,7 @@ describe('Page', function() {
|
||||
require('./puppeteer.spec.js').addTests({testRunner, expect, PROJECT_ROOT, defaultBrowserOptions});
|
||||
|
||||
if (process.env.COVERAGE) {
|
||||
describe('COVERAGE', function(){
|
||||
describe('COVERAGE', function() {
|
||||
const coverage = helper.publicAPICoverage();
|
||||
const disabled = new Set(['page.bringToFront']);
|
||||
if (!headless)
|
||||
|
||||
Reference in New Issue
Block a user