mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: fixes expectation for test in Firefox (#10239)
This commit is contained in:
parent
8903d2f6ec
commit
49360eac10
@ -33,7 +33,7 @@ import {Connection} from './Connection.js';
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class Browser extends BrowserBase {
|
export class Browser extends BrowserBase {
|
||||||
static readonly subscribeModules = ['browsingContext', 'network'];
|
static readonly subscribeModules = ['browsingContext', 'network', 'log'];
|
||||||
|
|
||||||
static async create(opts: Options): Promise<Browser> {
|
static async create(opts: Options): Promise<Browser> {
|
||||||
// TODO: await until the connection is established.
|
// TODO: await until the connection is established.
|
||||||
|
@ -54,7 +54,7 @@ export class BrowsingContext extends EventEmitter {
|
|||||||
connection: Connection;
|
connection: Connection;
|
||||||
#timeoutSettings: TimeoutSettings;
|
#timeoutSettings: TimeoutSettings;
|
||||||
#id: string;
|
#id: string;
|
||||||
#url: string;
|
#url = 'about:blank';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
@ -65,7 +65,6 @@ export class BrowsingContext extends EventEmitter {
|
|||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.#timeoutSettings = timeoutSettings;
|
this.#timeoutSettings = timeoutSettings;
|
||||||
this.#id = info.context;
|
this.#id = info.context;
|
||||||
this.#url = info.url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get url(): string {
|
get url(): string {
|
||||||
|
@ -25,8 +25,6 @@ import {
|
|||||||
WaitForOptions,
|
WaitForOptions,
|
||||||
} from '../../api/Page.js';
|
} from '../../api/Page.js';
|
||||||
import {assert} from '../../util/assert.js';
|
import {assert} from '../../util/assert.js';
|
||||||
import {isErrorLike} from '../../util/ErrorLike.js';
|
|
||||||
import {isTargetClosedError} from '../Connection.js';
|
|
||||||
import {ConsoleMessage, ConsoleMessageLocation} from '../ConsoleMessage.js';
|
import {ConsoleMessage, ConsoleMessageLocation} from '../ConsoleMessage.js';
|
||||||
import {Handler} from '../EventEmitter.js';
|
import {Handler} from '../EventEmitter.js';
|
||||||
import {FrameManagerEmittedEvents} from '../FrameManager.js';
|
import {FrameManagerEmittedEvents} from '../FrameManager.js';
|
||||||
@ -133,18 +131,6 @@ export class Page extends PageBase {
|
|||||||
connection.on(event, subscriber);
|
connection.on(event, subscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.#connection
|
|
||||||
.send('session.subscribe', {
|
|
||||||
events: [...page.#subscribedEvents.keys()],
|
|
||||||
// TODO: We should subscribe globally
|
|
||||||
contexts: [info.context],
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
if (isErrorLike(error) && isTargetClosedError(error)) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,17 +281,6 @@ export class Page extends PageBase {
|
|||||||
this.removeAllListeners();
|
this.removeAllListeners();
|
||||||
this.#networkManager.dispose();
|
this.#networkManager.dispose();
|
||||||
|
|
||||||
await this.#connection
|
|
||||||
.send('session.unsubscribe', {
|
|
||||||
events: [...this.#subscribedEvents.keys()],
|
|
||||||
// TODO: Remove this once we subscrite gloablly
|
|
||||||
contexts: [this.mainFrame()._id],
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
// Suppress the error as we remove the context
|
|
||||||
// after that anyway.
|
|
||||||
});
|
|
||||||
|
|
||||||
await this.#connection.send('browsingContext.close', {
|
await this.#connection.send('browsingContext.close', {
|
||||||
context: this.mainFrame()._id,
|
context: this.mainFrame()._id,
|
||||||
});
|
});
|
||||||
|
@ -95,6 +95,12 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Request.isNavigationRequest *",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Response.buffer *",
|
"testIdPattern": "[network.spec] network Response.buffer *",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -461,12 +467,6 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"testIdPattern": "[network.spec] network raw network headers Same-origin set-cookie subresource",
|
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
|
||||||
"parameters": ["webDriverBiDi"],
|
|
||||||
"expectations": ["FAIL"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Request.frame should work for subframe navigation request",
|
"testIdPattern": "[network.spec] network Request.frame should work for subframe navigation request",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -491,18 +491,6 @@
|
|||||||
"parameters": ["webDriverBiDi"],
|
"parameters": ["webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"testIdPattern": "[network.spec] network Request.isNavigationRequest should work",
|
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
|
||||||
"parameters": ["webDriverBiDi"],
|
|
||||||
"expectations": ["FAIL"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"testIdPattern": "[network.spec] network Request.isNavigationRequest should work with request interception",
|
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
|
||||||
"parameters": ["webDriverBiDi"],
|
|
||||||
"expectations": ["FAIL"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Request.postData should work",
|
"testIdPattern": "[network.spec] network Request.postData should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1295,6 +1283,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to dataURL and fire dataURL requests",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to empty page with domcontentloaded",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to empty page with domcontentloaded",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1319,6 +1313,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should navigate to URL with hash and fire requests without hash",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should not leak listeners during navigation",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should not leak listeners during navigation",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1343,6 +1343,12 @@
|
|||||||
"parameters": ["firefox", "webDriverBiDi"],
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should return last response in redirect chain",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should return response when page changes its URL after load",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should return response when page changes its URL after load",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1409,6 +1415,12 @@
|
|||||||
"parameters": ["chrome", "webDriverBiDi"],
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[navigation.spec] navigation Page.goto should work with self requesting page",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[navigation.spec] navigation Page.goto should work with subframes return 204",
|
"testIdPattern": "[navigation.spec] navigation Page.goto should work with subframes return 204",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1541,12 +1553,24 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Page.authenticate should work",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["SKIP"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders should work",
|
"testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network raw network headers Same-origin set-cookie subresource",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network raw network headers Same-origin set-cookie subresource",
|
"testIdPattern": "[network.spec] network raw network headers Same-origin set-cookie subresource",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1559,6 +1583,12 @@
|
|||||||
"parameters": ["cdp", "chrome"],
|
"parameters": ["cdp", "chrome"],
|
||||||
"expectations": ["FAIL", "PASS"]
|
"expectations": ["FAIL", "PASS"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Request.headers should define Firefox as user agent header",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Request.initiator should return the initiator",
|
"testIdPattern": "[network.spec] network Request.initiator should return the initiator",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1571,12 +1601,24 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Request.isNavigationRequest should work when navigating to image",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["chrome", "webDriverBiDi"],
|
||||||
|
"expectations": ["PASS"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Request.isNavigationRequest should work with request interception",
|
"testIdPattern": "[network.spec] network Request.isNavigationRequest should work with request interception",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"expectations": ["FAIL"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Request.postData should be |undefined| when there is no post data",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Request.postData should work",
|
"testIdPattern": "[network.spec] network Request.postData should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1601,6 +1643,12 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Response.fromCache should return |false| for non-cached content",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Response.fromCache should work",
|
"testIdPattern": "[network.spec] network Response.fromCache should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1613,12 +1661,30 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Response.headers should work",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Response.json should work",
|
"testIdPattern": "[network.spec] network Response.json should work",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["SKIP"]
|
"expectations": ["SKIP"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Response.statusText handles missing status text",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"testIdPattern": "[network.spec] network Response.statusText should work",
|
||||||
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
"parameters": ["firefox", "webDriverBiDi"],
|
||||||
|
"expectations": ["FAIL"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[network.spec] network Response.text should return uncompressed text",
|
"testIdPattern": "[network.spec] network Response.text should return uncompressed text",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -556,7 +556,7 @@ describe('network', function () {
|
|||||||
|
|
||||||
const requests: HTTPRequest[] = [];
|
const requests: HTTPRequest[] = [];
|
||||||
page.on('requestfinished', request => {
|
page.on('requestfinished', request => {
|
||||||
return requests.push(request);
|
return !isFavicon(request) && requests.push(request);
|
||||||
});
|
});
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(requests).toHaveLength(1);
|
expect(requests).toHaveLength(1);
|
||||||
@ -580,7 +580,12 @@ describe('network', function () {
|
|||||||
return events.push('requestfinished');
|
return events.push('requestfinished');
|
||||||
});
|
});
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(events).toEqual(['request', 'response', 'requestfinished']);
|
// Events can sneak in after the page has navigate
|
||||||
|
expect(events.slice(0, 3)).toEqual([
|
||||||
|
'request',
|
||||||
|
'response',
|
||||||
|
'requestfinished',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
it('should support redirects', async () => {
|
it('should support redirects', async () => {
|
||||||
const {page, server} = getTestState();
|
const {page, server} = getTestState();
|
||||||
|
Loading…
Reference in New Issue
Block a user