Fix Windows-only failures in the Electron backend integration tests - #9668
Conversation
These only failed on Windows
My Windows display scale is set to 250%, and the rounding that that produced led to the window resize tests being impossible to pass as previously written.
There was a problem hiding this comment.
Pull request overview
Stabilizes Windows Electron backend integration tests around window restoration, fractional scaling, and Chromium startup.
Changes:
- Waits for Electron readiness before running tests.
- Adds window-bound stabilization and longer polling.
- Records a test-only Rush change entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
RunSingleTest.ts |
Uses Electron-managed startup and exit. |
ElectronHost.test.ts |
Makes window-state tests scaling-aware. |
tcobbs-electron-race-fixes_2026-08-27-22-34-10.json |
Adds the package change record. |
Suppressed comments (1)
core/electron/src/test/backend/ElectronHost.test.ts:224
- The position check has the same stale-baseline/all-fields issue: it compares with bounds captured before the maximize cycle and requires both coordinates to change. A prior window-manager adjustment can make this true before
setPositionis reflected, while a legitimate move where one coordinate was already equal to the target will time out. Compare against bounds captured immediately before the move and accept either coordinate changing.
assert(await waitUntil(() => window.getBounds().x !== expectedBounds.x && window.getBounds().y !== expectedBounds.y));
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
GytisCepk
left a comment
There was a problem hiding this comment.
These size tests are constant problem and have been fixed multiple times. I'll need to review them and figure out what is a long term solution here.
Approving for release
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
core/electron/src/test/backend/ElectronHost.test.ts:228
- The initial BrowserWindow position is chosen by the OS, so it can already be
(50, 75). In that casesetPositionis a no-op and the new “window changed” assertion waits five seconds and fails even though persistence is working. Choose a target that is guaranteed to differ from the sampled position.
window.setPosition(50, 75);
hl662
left a comment
There was a problem hiding this comment.
Thanks for doing this, I ran into these flaky windows problems all the time months ago in my first MVP for vitest certa. Could never nail down the problem but you got it
Don't I know it. The last person to make fixes to this file before this PR was me. Those fixes were due to failures in my ARM64 Linux VM. |
|
Tick the box to add this pull request to the merge queue (same as
|
|
@Mergifyio backport release/5.13.x |
✅ Backports have been createdDetails
|
Fix Windows-only failures in the Electron backend integration tests
Two causes of the failures were introduced by #9627 and reproduced on Windows in the Node 20 and Node 24 CI legs. The fractional scaling problem has probably always existed.
Should save main window size, position and maximized flag.Three separate problems in
ElectronHost.test.ts:unmaximize()with awaitUntilthat returns immediately, becausesavedMaximized()andwindow.isMaximized()flip in the same tick.setSizethen landed while Windows was still restoring, and the restored bounds won the last debounced write. AddedwaitForStableBounds()to wait for the window to settle first.waitUntilbudget raised from ~1.25 s to ~5 s.Should ignore a response after its request was removed during shutdown.Exited with
0x80000003(STATUS_BREAKPOINT) — a Chromium abort, not an assertion failure. This test never callsElectronHost.startup(), so it could finish and tear down the main process while Chromium was still initializing.RunSingleTest.tsnow awaitsapp.whenReady()and exits viaapp.exit()rather thanprocess.exit().Notes
masterfor backport torelease/5.13.x. The affected files are identical on both branches, so the cherry-pick should be clean.0x80000003failure was intermittent and passed on the Node 24 leg.