#54728: test: run focus-dependent specs serially
Merged
Description of Change
Run the specs that need OS focus serially, and wait for focus where they assumed it.
Under the parallel runner, another worker's window can take focus away from them.
api-web-contents-view.spec.ts, "does not crash when closed via window.close()": waits for'blur', which only fires if the view had focus.
Contents only get initial focus in an active window.api-web-frame-main.spec.ts, "keeps a single instance when mainFrame is touched from focus/blur during a cross-origin swap": needs the view focused before the swap.
It now waits forisFocused()instead of assumingfocus()is synchronous.api-web-contents.spec.ts:- The win32 test "keeps the page focused when the window is re-activated while the prompt is pending" now waits for focus instead of sleeping 100 ms.
- The
setIgnoreMenuShortcuts(ignore)block sends real menu shortcuts.
"honors the initial ignoreMenuShortcuts preference" now waits for focus before sending them.
Downstream CI hits this test on43-x-yand44-x-y. - "reveals paths under a registered workspace folder without executing them" opens a real Finder or Explorer window, which takes focus and stays open.
All of these are tagged serial.
Only test code changes.
Validation
Ran on a local Linux testing build of main under Xvfb:
e test --files spec/api-web-contents-view.spec.ts spec/api-web-frame-main.spec.ts spec/api-web-contents.spec.ts -g "does not crash when closed via window.close|keeps a single instance when mainFrame is touched|setIgnoreMenuShortcuts": 7 passed in the serial phase, and 3 of 3 runs passed.- The win32 and non-Linux tests aren't exercised on Linux.
script/lint.js --jsandtsc -p tsconfig.spec.jsonpass.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: none
Backports
42-x-y
PendingWaiting for a manual backport
43-x-y
PendingWaiting for a manual backport
45-x-y
MergedPR Number
#54746Merged At
Oct 8, 2026, 8:56:37 AM
Released In
v45.0.0-beta.1Release Date
Oct 8, 2026, 7:07:44 PM
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron