feat(firefox): support Browser.target() (#4028)

Support browser target.

Drive-by: switch over to a more devtools'ish protocol:

- use `targetId` instead of `pageId` everywhere
- use target events instead of tab events
This commit is contained in:
Andrey Lushnikov
2019-02-17 10:23:48 -08:00
committed by GitHub
parent ea482c4751
commit 4a4793a5e1
5 changed files with 47 additions and 42 deletions

View File

@@ -24,7 +24,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, Errors}) {
const {TimeoutError} = Errors;
describe('Target', function() {
it_fails_ffox('Browser.targets should return all of the targets', async({page, server, browser}) => {
it('Browser.targets should return all of the targets', async({page, server, browser}) => {
// The pages will be the testing page and the original newtab page
const targets = browser.targets();
expect(targets.some(target => target.type() === 'page' &&
@@ -38,7 +38,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, Errors}) {
expect(allPages).toContain(page);
expect(allPages[0]).not.toBe(allPages[1]);
});
it_fails_ffox('should contain browser target', async({browser}) => {
it('should contain browser target', async({browser}) => {
const targets = browser.targets();
const browserTarget = targets.find(target => target.type() === 'browser');
expect(browserTarget).toBeTruthy();