test(desktop): decide the WorkHub popup close in the main process - #5918
Merged
Merged
Conversation
`workhub-layout.spec.ts` checked the renderer's `aria-expanded`, then called `closePopup` in a separate main-process evaluate. Linux can auto-dismiss the native menu between the two, and `closePopup` on a dead popup crashes the main process, which fails the test with "Target page ... has been closed" or "session closed". It failed this way on two unrelated PRs (apache#5906, apache#5902). Track the popup's lifetime with its own `menu-will-close` event, and check it in the same main-process task that closes it. The existing `aria-expanded` assertion afterwards still pins the renderer state. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
M4n5ter
approved these changes
Oct 2, 2026
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5917.
This is a test-only change to
apps/desktop/e2e/workhub-layout.spec.ts. The spec closed the Workbar's native menu in two round trips. First it read the renderer'saria-expanded, then it calledclosePopupin a separate main-process evaluate. Linux can auto-dismiss that popup in between, andclosePopupon a dead popup crashes the main process. The test then fails with "Target page … has been closed" or "session closed". That happened on #5906 and #5902, and both passed on rerun.Change
Menu.prototype.popupprobe now also subscribes to the menu'smenu-will-closeevent and records whether the popup is still open.closePopupin the same task, so a dismissal can no longer land between the check and the call.expect(addPanel).not.toHaveAttribute('aria-expanded', 'true')still pins the renderer state afterwards.closePopup.Verification
format:checkpass, and so doescheck:e2e-budget(34 tests in 20 files). Type-checking the spec reports no errors in the changed lines.menu-will-closearrives in the same main-thread task as the native teardown, so that it closes the window fully rather than narrowing it, rests on Electron dispatching the event synchronously from the menu-closed callback. CI on this PR exercises the spec on Linux.AI use
Diagnosed and written with Claude Code; the commit carries a
Co-Authored-Bytrailer.🤖 Generated with Claude Code