Skip to content

Repair wp/5.9 branch Actions: Retry detached menu item clicks in the Widgets Customizer e2e tests - #682

Closed
desrosj wants to merge 1 commit into
fix-actions-5.9/fix-create-user-field-typingfrom
fix-actions-5.9/fix-flaky-customizer-inspector-test
Closed

desrosj wants to merge 1 commit into
fix-actions-5.9/fix-create-user-field-typingfrom
fix-actions-5.9/fix-flaky-customizer-inspector-test

Conversation

@desrosj

@desrosj desrosj commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

What?

Adds a clickMenuItem() helper to the Widgets Customizer e2e tests (packages/e2e-tests/specs/widgets/customizing-widgets.test.js) and uses it for the three "Show more settings" clicks in the block toolbar's Options menu. The helper finds the menu item and clicks it. If the click fails because the element was detached, it reopens the Options menu if the menu closed, finds the item again and retries, up to three attempts in total. Any other error is thrown as before.

Why?

Widgets Customizer › should open the inspector panel fails intermittently on this branch with Node is detached from document at showMoreSettingsButton.click(): https://github.com/desrosj/gutenberg/actions/runs/37718246276/job/113119651984 ("Admin - 4"). The test finds the menu item with find(), then clicks the returned element handle, and the Options menu can re-render in between, so the click targets a node that is no longer in the document. Across 36 Admin - 4 jobs on this stack between 2026-10-06 and 2026-10-08, it failed on every attempt in 13 and passed only on a retry in 8.

Trunk has no Puppeteer fix to backport. These tests were moved to Playwright in WordPress#39540 (WordPress@9f5b842), whose locators look the element up again when clicking. wp/5.9 has no Playwright e2e setup, so this does the same thing within the Puppeteer test.

How?

clickMenuItem( name ) calls find( { role: 'menuitem', name } ) and .click() in a loop, and only retries when the error message contains "detached". Before a retry, if no [role="menu"] is open, it shows the block toolbar and clicks "Options" again, because the re-render that detaches the item can also close the menu. The test steps and assertions are unchanged.

Use of AI Tools

This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.

🤖 Generated with Claude Code

@desrosj desrosj self-assigned this Oct 8, 2026
@desrosj
desrosj added this pull request to stack #668 October 8, 2026 03:20
@desrosj
desrosj force-pushed the fix-actions-5.9/fix-flaky-customizer-inspector-test branch from 69f1852 to 1cf2ec9 Compare October 8, 2026 04:41
@desrosj
desrosj force-pushed the fix-actions-5.9/fix-flaky-customizer-inspector-test branch from 1cf2ec9 to 8777c3f Compare October 8, 2026 18:17
@desrosj
desrosj removed this pull request from stack #668 October 8, 2026 19:35
@desrosj
desrosj force-pushed the fix-actions-5.9/fix-flaky-customizer-inspector-test branch from 8777c3f to 0e1d892 Compare October 8, 2026 19:35
@desrosj
desrosj added this pull request to stack #695 October 8, 2026 19:35
@desrosj
desrosj marked this pull request as ready for review October 9, 2026 16:40
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj

desrosj commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Moved to WordPress#84426.

@desrosj desrosj closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant