Repository navigation
Repair wp/6.7 branch Actions: Fix wrong TinyMCE editor-tab selector in the meta box E2E test - #137
Closed
desrosj wants to merge 2 commits into
Conversation
wp/6.7 branch Actions: Fix flaky TinyMCE-initialization race in the meta box E2E testwp/6.7 branch Actions: Fix wrong TinyMCE editor-tab selector in the meta box E2E test
desrosj
removed this pull request from stack #90
September 10, 2026 19:33
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 10, 2026 19:36
1387eaf to
5d1423f
Compare
desrosj
added this pull request to stack #185
September 10, 2026 19:36
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 10, 2026 23:58
5d1423f to
3578619
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 11, 2026 00:29
3578619 to
e4b5a66
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 11, 2026 01:15
e4b5a66 to
156121c
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 11, 2026 02:20
156121c to
009b252
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 11, 2026 16:10
009b252 to
610a079
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 14, 2026 01:49
610a079 to
eddd734
Compare
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 14, 2026 17:38
eddd734 to
d490ac5
Compare
`test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js` waited only for the TinyMCE iframe (`#test_tinymce_id_ifr`) to exist before clicking the "Code" toggle button. The iframe element can exist in the DOM before TinyMCE has actually finished initializing inside it, so the "Code" button (rendered by TinyMCE itself once ready) isn't reliably present yet, and the click times out with `TimeoutError: locator.click: Timeout 10000ms exceeded` waiting for `role=button[name="Code"i]`. This reproduces consistently, not intermittently: every attempt fails at the exact same point. Trunk fixed this same race in `WordPress#78631` ("WP Editor Meta Box e2e: wait for TinyMCE init"), which replaces the iframe-existence wait with `page.waitForFunction(() => window.tinyMCE?.get('test_tinymce_id')?.initialized)`, both when switching to Visual mode initially and when switching back to Visual mode after typing in Code mode. That trunk commit is test-file only, with no product-code changes, so it ports directly. Trunk's *current* copy of this test also includes a step (added by `WordPress#71623`, "Add ability to toggle meta box pane open and closed") that clicks a "Meta Boxes" pane-toggle button before interacting with TinyMCE. That toggle button doesn't exist on `wp/6.7`: `WordPress#71623` restructured `packages/edit-post/src/components/layout/index.js` so the toggle renders unconditionally as part of the resizable pane's handle. On `wp/6.7`, the toggle only renders when `isShort` (a `(max-height: 549px)` media query) is true; otherwise the pane is a bare `ResizableBox` with a drag handle and no toggle button at all. CI runs the browser under `xvfb` at `1280x960` (see `.github/workflows/end2end-test.yml`), so `isShort` is false there and no such button exists to click. Porting `WordPress#71623`'s pane-toggle feature to fix an unrelated race would be a large, out-of-scope UI change for a frozen branch, so this commit adopts only `WordPress#78631`'s TinyMCE-wait fix and omits the pane-toggle step entirely.
…on-name selector. The previous commit ported `WordPress#78631`'s TinyMCE initialization wait, on the assumption the failure was a race between the meta box's TinyMCE iframe appearing and the editor finishing initialization. Verified against real CI, that fix did not resolve the failure: it still timed out at the same `role=button[name="Code"i]` click, now after the added `waitForFunction` had already resolved successfully. The actual cause is a button-label mismatch, unrelated to any timing race. The "Code"/"Text" toggle is rendered by WordPress Core's `wp_editor()` (`wp-includes/class-wp-editor.php`), and `wp-env`'s pinned core for this branch, `WordPress/WordPress#6.7-branch`, still ships the string `_x( 'Text', 'Name for the Text editor tab (formerly HTML)' )`. Core renamed this label to "Code" only on its own `master` branch (`_x( 'Code', 'Name for the Code editor tab (formerly Text)' )`) after `6.7-branch` was cut, and never backported the wording change to the maintenance branch. Screenshots from every failed run (the original cited run and the one testing the previous, ineffective commit) confirm the rendered button reads "Text", not "Code". The underlying behavior is identical either way, so using the correct label is a like-for-like change, not a weakened assertion. The Gutenberg plugin's own trunk renamed this locator from "Text" to "Code" in `WordPress#68872`/`WordPress#68886` (Jan 2025), correctly following its own trunk's newer bundled/tested core. That rename doesn't apply on `wp/6.7`, whose `wp-env` config intentionally pins to the matching `6.7-branch` core, so this reverts the locator back to "Text" for this branch and drops the TinyMCE-`waitForFunction` addition along with it, since the original iframe-existence wait was never the actual problem: the failure was 100% reproducible, not intermittent, which is what a hard-coded wrong locator produces and a genuine race condition would not.
desrosj
force-pushed
the
fix-actions-6.7/fix-flaky-metabox-tinymce-race
branch
from
September 14, 2026 19:17
d490ac5 to
0c51a15
Compare
desrosj
marked this pull request as ready for review
September 14, 2026 19:34
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Owner
Author
|
Migrated to real upstream: WordPress#82905. Closing this fork PR. |
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.
What?
Fixes a consistently-failing (not intermittent) E2E test on
wp/6.7:test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js, "Should save the changes". The test was clicking a button labeled "Code" that doesn't exist in this branch's bundled WordPress core — here, that button is labeled "Text".Why?
The failure initially looked like the TinyMCE-initialization race trunk fixed in WordPress#78631 ("WP Editor Meta Box e2e: wait for TinyMCE init"), so that fix was ported first. Verified against real CI, it didn't resolve the failure — the test still timed out on the same
role=button[name="Code"i]click, now occurring after TinyMCE had already finished initializing, proving that wasn't the blocking factor.The actual cause: this branch's
wp-envconfig pins WordPress Core toWordPress/WordPress#6.7-branch, which still renders the classic-editor tab as "Text" (wp-includes/class-wp-editor.php). Core only renamed that string to "Code" on itsmasterbranch, after6.7-branchwas cut, and Gutenberg trunk followed suit in WordPress#68872/WordPress#68886 (Jan 2025) — a rename that doesn't apply here, since this branch'swp-envis intentionally pinned to match its own core version (fix-actions-6.7/pin-wp-env-core-version, earlier in this stack). This also explains why the failure was 100% reproducible rather than intermittent: a hardcoded wrong locator fails every time, a genuine initialization race wouldn't.The fix reverts the ineffective TinyMCE-init wait and restores the test's original structure, changing only the button-name selector from
"Code"iback to"Text"i. Verified against real CI: the previously-failing shard now passes, with no new failures introduced elsewhere.Trunk's current version of this test also clicks a "Meta Boxes" pane-toggle button, added by WordPress#71623. That toggle only renders under a narrow-height media query this branch's CI viewport doesn't trigger, so porting that unrelated UI feature to a frozen maintenance branch is out of scope for this fix.
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.