test: fix tests to work on node6 (#4851)

Our magical node6 transpiler can't handle object spreads :(

Drive-by: use "includes" instead of "startsWith" for devtools URL
since I remember that it used to be "chrome-devtools://", and somehow
I saw it as "devtools://" somewhere.
This commit is contained in:
Andrey Lushnikov 2019-08-14 17:49:12 -07:00 committed by GitHub
parent f47ed1649c
commit f595bc0b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,11 +118,11 @@ module.exports.addTests = function({testRunner, expect, puppeteer, defaultBrowse
await browser.close();
});
it('should open devtools when "devtools: true" option is given', async({server}) => {
const browser = await puppeteer.launch({...headfulOptions, devtools: true});
const browser = await puppeteer.launch(Object.assign({devtools: true}, headfulOptions));
const context = await browser.createIncognitoBrowserContext();
await Promise.all([
context.newPage(),
context.waitForTarget(target => target.url().startsWith('devtools://')),
context.waitForTarget(target => target.url().includes('devtools://')),
]);
await browser.close();
});