Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(bidi): emit load events after browsingContext.create (#40944)

Holger Benl7eb404535112
diff --git a/packages/playwright-core/src/server/bidi/bidiBrowser.ts b/packages/playwright-core/src/server/bidi/bidiBrowser.ts
index 2607918afa..7e0c9f2863 100644
--- a/packages/playwright-core/src/server/bidi/bidiBrowser.ts
+++ b/packages/playwright-core/src/server/bidi/bidiBrowser.ts
@@ -272,7 +272,10 @@ export class BidiBrowserContext extends BrowserContext {
type: bidi.BrowsingContext.CreateType.Window,
userContext: this._browserContextId,
});
- return this._browser._bidiPages.get(context)!._page;
+ const page = this._browser._bidiPages.get(context)!._page;
+ page.frameManager.frameLifecycleEvent(context, 'domcontentloaded');
+ page.frameManager.frameLifecycleEvent(context, 'load');
+ return page;
}
async doGetCookies(urls: string[]): Promise<channels.NetworkCookie[]> {
diff --git a/tests/bidi/expectations/moz-firefox-nightly-library.txt b/tests/bidi/expectations/moz-firefox-nightly-library.txt
index cf00af30c2..70bbb117e3 100644
--- a/tests/bidi/expectations/moz-firefox-nightly-library.txt
+++ b/tests/bidi/expectations/moz-firefox-nightly-library.txt
@@ -1,4 +1,5 @@
library/agent-perform.spec.ts › retrieve a secret [timeout]
+library/browser.spec.ts › should dispatch page.on(close) upon browser.close and reject evaluate [timeout]
library/browsercontext-add-cookies.spec.ts › should allow unnamed cookies [fail]
library/browsercontext-basic.spec.ts › fetch with keepalive should throw when offline [fail]
library/browsercontext-basic.spec.ts › should disable javascript [fail]
@@ -8,6 +9,8 @@ library/browsercontext-cookies-third-party.spec.ts › same origin third party '
library/browsercontext-cookies-third-party.spec.ts › save/load third party non-partitioned cookies [fail]
library/browsercontext-cookies-third-party.spec.ts › save/load third party 'Partitioned;' cookies [fail]
library/browsercontext-cookies-third-party.spec.ts › should be able to send third party cookies via an iframe [fail]
+library/browsercontext-cookies-third-party.spec.ts › third party 'Partitioned;' cookies [timeout]
+library/browsercontext-cookies-third-party.spec.ts › third party non-partitioned cookies [timeout]
library/browsercontext-cookies.spec.ts › should support requestStorageAccess [fail]
library/browsercontext-csp.spec.ts › should bypass after cross-process navigation [fail]
library/browsercontext-csp.spec.ts › should bypass CSP header [fail]
@@ -29,14 +32,20 @@ library/browsercontext-locale.spec.ts › should format number in popups [fail]
library/browsercontext-locale.spec.ts › should format number in workers [timeout]
library/browsercontext-network-event.spec.ts › should reject response.finished if context closes [timeout]
library/browsercontext-page-event.spec.ts › should have about:blank for empty url with domcontentloaded [timeout]
+library/browsercontext-page-event.spec.ts › should have about:blank url with domcontentloaded [timeout]
library/browsercontext-page-event.spec.ts › should have an opener [fail]
library/browsercontext-page-event.spec.ts › should have url [fail]
library/browsercontext-page-event.spec.ts › should report when a new page is created and closed [fail]
+library/browsercontext-page-event.spec.ts › should work with Ctrl-clicking [timeout]
library/browsercontext-pages.spec.ts › frame.focus should work multiple times [fail]
library/browsercontext-pages.spec.ts › should click the button with deviceScaleFactor set [fail]
library/browsercontext-reuse.spec.ts › reuse connect › should not cache resources [fail]
+library/browsercontext-reuse.spec.ts › reuse connect › should reset serviceworker [timeout]
+library/browsercontext-reuse.spec.ts › reuse connect › should reset serviceworker that hangs in importScripts [timeout]
library/browsercontext-reuse.spec.ts › reuse connect › should update viewport and media [fail]
library/browsercontext-reuse.spec.ts › reuse launch › should not cache resources [fail]
+library/browsercontext-reuse.spec.ts › reuse launch › should reset serviceworker [timeout]
+library/browsercontext-reuse.spec.ts › reuse launch › should reset serviceworker that hangs in importScripts [timeout]
library/browsercontext-reuse.spec.ts › reuse launch › should update viewport and media [fail]
library/browsercontext-service-worker-policy.spec.ts › block › should not throw error on about:blank [fail]
library/browsercontext-storage-state.spec.ts › should roundtrip local storage in third-party context [fail]
@@ -63,7 +72,9 @@ library/browsertype-connect.spec.ts › run-server › should save download [fai
library/browsertype-connect.spec.ts › run-server › should saveAs videos from remote browser [timeout]
library/browsertype-connect.spec.ts › run-server › should save videos to artifactsDir [fail]
library/browsertype-connect.spec.ts › run-server › should upload a folder [fail]
+library/browsertype-launch.spec.ts › should reject all promises when browser is closed [timeout]
library/browsertype-launch.spec.ts › should reject if launched browser fails immediately [fail]
+library/capabilities.spec.ts › SharedArrayBuffer should work @smoke [timeout]
library/capabilities.spec.ts › should play video @smoke [timeout]
library/channels.spec.ts › should work with the domain module [timeout]
library/chromium/chromium.spec.ts › http credentials › httpCredentials [timeout]
@@ -136,6 +147,7 @@ library/launcher.spec.ts › should throw a friendly error if its headed and the
library/locator-dispatchevent-touch.spec.ts › should support touch points in touch event arguments [fail]
library/multiclient.spec.ts › last emulateMedia wins [fail]
library/multiclient.spec.ts › screencast should deliver cached last frame to a new client [fail]
+library/multiclient.spec.ts › should chain routes [timeout]
library/multiclient.spec.ts › should unroute websockets [timeout]
library/page-clock.spec.ts › popup › should tick after popup [flaky]
library/page-event-crash.spec.ts › should be able to close context when page crashes [timeout]
@@ -155,9 +167,11 @@ library/popup.spec.ts › should inherit touch support from browser context [fai
library/popup.spec.ts › should not dispatch binding on a closed page [fail]
library/popup.spec.ts › should not throw when click closes popup [timeout]
library/popup.spec.ts › should use viewport size from window features [timeout]
+library/proxy.spec.ts › should reconnect with credentials after CONNECT 407 closes the socket [fail]
library/role-utils.spec.ts › axe-core accessible-text [timeout]
library/role-utils.spec.ts › wpt accname #2 [timeout]
library/route-web-socket.spec.ts › should emit close upon frame detach [timeout]
+library/screencast.spec.ts › onFrame receives viewport size [fail]
library/screencast.spec.ts › screencast.start delivers frames via onFrame callback [fail]
library/screencast.spec.ts › start dispose stops recording [fail]
library/screencast.spec.ts › start should work when recordVideo is set [fail]
diff --git a/tests/bidi/expectations/moz-firefox-nightly-page.txt b/tests/bidi/expectations/moz-firefox-nightly-page.txt
index 9b897f3562..62286cfe9a 100644
--- a/tests/bidi/expectations/moz-firefox-nightly-page.txt
+++ b/tests/bidi/expectations/moz-firefox-nightly-page.txt
@@ -86,6 +86,7 @@ page/page-emulate-media.spec.ts › should emulate forcedColors [fail]
page/page-emulate-media.spec.ts › should emulate reduced motion [fail]
page/page-emulate-media.spec.ts › should emulate type @smoke [fail]
page/page-emulate-media.spec.ts › should keep reduced motion and color emulation after reload [fail]
+page/page-emulate-media.spec.ts › should report hover and fine pointer for desktop [fail]
page/page-emulate-media.spec.ts › should work during navigation [fail]
page/page-event-console.spec.ts › should trigger correct Log [timeout]
page/page-event-console.spec.ts › should work @smoke [flaky]
@@ -135,6 +136,8 @@ page/page-screenshot.spec.ts › page screenshot › should allow transparency [
page/page-screenshot.spec.ts › page screenshot animations › should not capture css animations in shadow DOM [flaky]
page/page-screenshot.spec.ts › page screenshot animations › should not capture pseudo element css animation [fail]
page/page-set-input-files.spec.ts › should upload a folder [fail]
+page/page-wait-for-load-state.spec.ts › should wait for load state of about:blank popup [timeout]
+page/page-wait-for-load-state.spec.ts › should wait for load state of about:blank popup with noopener [timeout]
page/page-wait-for-load-state.spec.ts › should wait for load state of empty url popup [timeout]
page/wheel.spec.ts › should dispatch wheel events after popup was opened @smoke [timeout]
page/workers.spec.ts › Page.workers @smoke [timeout]