WP Editor Meta Box e2e: wait for TinyMCE init#78631
Conversation
|
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. |
|
Size Change: 0 B Total Size: 8.04 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 170bd47. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26396843552
|
Fixes #43174, a flaky test that fails extraordinarily often last few days.
The issue is that we "Publish" a new post (including metabox data) a very short time after switching TinyMCE from "Code" mode to "Visual", and at that time the Visual mode is still initializing. When TinyMCE loses focus too quickly, it crashes:
because a selection object is
null. The switch to "Visual" never finishes:The saved content then includes a "bookmark"
spanelement that TinyMCE inserts for a very short moment to preserve selection:I'm fixing this by adding a better wait after every switch to "Visual", one that checks
window.tinyMCE.get(id).initialized.