Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): new browser tabs no longer lose waits, clicks and snapshots for good #32861

Mergedjuliusmarmingemerged 9 commits intomain fromrefs/pull/32861/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 131 additions and 5 deletions.

x
0 of 2 viewed, 2 left
76 additions and 0 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -34,6 +34,8 @@
const makeDebuggee = (
options: {
readonly deferFocus?: boolean;
+ /** The guest is still loading its first page. */
+ readonly loading?: boolean;
readonly refuse?: (method: string, sessionId: string | undefined) => boolean;
} = {},
) => {
@@ -69,10 +71,13 @@
sendWaiters.shift()?.();
}),
});
+ let destroyed = false;
const webContents = Object.assign(new NodeEvents.EventEmitter(), {
getURL: () => "http://localhost/",
getTitle: () => "Page",
getUserAgent: () => "Electron",
+ isLoadingMainFrame: () => options.loading === true,
+ isDestroyed: () => destroyed,
});
return {
tab: {
@@ -81,6 +86,12 @@
},
emit: (method: string, params: unknown) => emitter.emit("message", {}, method, params, ""),
navigate: () => webContents.emit("did-navigate"),
+ domReady: () => webContents.emit("dom-ready"),