feat(Target): Pass through "background_page" types (#2439) (#2493)

This commit is contained in:
Rafal Jarmolkovič
2018-05-17 00:36:34 +03:00
committed by Andrey Lushnikov
parent 3b03ff65c7
commit 23d25a6e12
6 changed files with 39 additions and 7 deletions

View File

@@ -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)