Skip to content

Commit 1a7ba5c

Browse files
committed
experiment: trace window visibility events
1 parent 5a77759 commit 1a7ba5c

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎.github/workflows/desktop-e2e.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
name: e2e (${{ matrix.shard }}/${{ strategy.job-total }})
108108
if: github.event_name != 'schedule' && github.event_name != 'push'
109109
runs-on: macos-26
110-
timeout-minutes: 30
110+
timeout-minutes: 60
111111
strategy:
112112
fail-fast: false
113113
matrix:
@@ -163,7 +163,7 @@ jobs:
163163

164164
- name: Run Playwright _electron smoke suite
165165
working-directory: apps/desktop
166-
run: bunx playwright test e2e/terminal-cancel.spec.ts --grep "the launch after|survives a quit" --repeat-each=15 --reporter=line,json
166+
run: bunx playwright test e2e/terminal-cancel.spec.ts --grep "the launch after|survives a quit" --repeat-each=30 --reporter=line,json
167167
env:
168168
PLAYWRIGHT_JSON_OUTPUT_FILE: test-results/desktop-smoke.json
169169

‎apps/desktop/src/main/observability.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ export function installMainProcessFailureObservers({
183183
app.on('quit', () => experimentTrace('quit'))
184184
process.on('exit', () => experimentTrace('process exit'))
185185
experimentTrace('observers installed')
186+
app.on('browser-window-created', (_event, win) => {
187+
const id = win.id
188+
let closed = false
189+
experimentTrace(`window ${id} created`)
190+
win.webContents.on('did-navigate', (_e, url) =>
191+
experimentTrace(`window ${id} navigated ${scrubUrl(url)}`)
192+
)
193+
for (const name of ['show', 'hide', 'minimize', 'maximize', 'restore'] as const) {
194+
win.prependListener(name as 'show', () =>
195+
experimentTrace(`window ${id} ${name} closed=${closed} destroyed=${win.isDestroyed()}`)
196+
)
197+
}
198+
win.on('closed', () => {
199+
closed = true
200+
experimentTrace(`window ${id} closed`)
201+
})
202+
})
186203
processSource.on('unhandledRejection', onUnhandledRejection)
187204
processSource.on('uncaughtException', onUncaughtException)
188205
}

0 commit comments

Comments
 (0)