Fix e2e tests that break when shard rebalancing changes their neighbors - #81117
Merged
jorgefilipecosta merged 2 commits intoAug 3, 2026
Conversation
The two tests in font-appearance-control.spec.js read the block inspector but never opened it, relying on the sidebar's default-visible state. Sidebar visibility is a persisted user preference shared across every test in a CI shard, so any earlier test that closes the sidebar (or whose debounced preference write lands that way) leaves these tests without an inspector, and the 'Typography options' click times out. This surfaced when WordPress#80314 added new revisions e2e tests: shard balancing uses historical test durations, so the added tests reshuffled shard 5 and these two started running after specs that leave the sidebar hidden. Open the sidebar explicitly in beforeEach, like sibling specs do.
|
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. |
The InserterUtils tab locator used getByRole's default substring matching, so 'Patterns' also matches the 'My patterns' pattern category tab, which renders inside the Patterns panel whenever the site has user patterns — for example ones left behind by an earlier spec in the same CI run. The zoomed-out inserter opens straight to the Patterns tab, so expectActiveTab( 'Patterns' ) hits a strict mode violation. Match the tab name exactly instead.
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.
Trunk's e2e suite has been red since #80314 landed, but not because that PR broke the editor: it added new e2e tests, and shard balancing is duration-based, so the suite's shards recomposed and two latent order-dependent specs started failing deterministically. This PR hardens both. The failing tests moved with each subsequent reshuffle —
font-appearance-control.spec.json Playwright shard 5 in the first two red runs,site-editor-inserter.spec.json shard 7 after #79934 added more tests — which is the signature of order dependence rather than a product regression.Font appearance control: the two tests read the block inspector but never open it, relying on the sidebar's default-visible state. Sidebar visibility is a persisted user preference: preferences are reset once per CI run in the global setup, then shared by every test in the shard, with writes flushed on a debounce. Any earlier test that leaves the sidebar hidden therefore starves these tests of an inspector, and the failure screenshots show exactly that: the
Typography optionsclick timing out with the sidebar closed. With a seededisComplementaryAreaVisible: falsepreference the failure reproduces on trunk before #80314 too, and both development and production builds pass with a clean profile — the editor itself is fine. Fix: calleditor.openDocumentSettingsSidebar()inbeforeEach, like sibling specs do (a no-op when the sidebar is already open).Site editor inserter: the
InserterUtilstab locator usedgetByRole's default substring matching, so'Patterns'also matches theMy patternspattern-category tab, which renders inside the Patterns panel whenever the site has user patterns — for example ones left behind by an earlier spec in the same run (deleteAllBlocks()also only runs once, in the global setup). The zoomed-out inserter opens straight to the Patterns tab, soexpectActiveTab( 'Patterns' )dies on a strict mode violation: with a user pattern present, the substring locator resolves to both tabs while the exact locator resolves to the one selected top-level tab. Fix: match tab names exactly.Testing Instructions
npm run test:e2e -- test/e2e/specs/editor/various/font-appearance-control.spec.js test/e2e/specs/site-editor/site-editor-inserter.spec.jspasses.wp user meta update admin wp_persisted_preferences --format=json '{"core":{"isComplementaryAreaVisible":false},"_modified":"2026-08-03T00:00:00.000Z"}'— then drive the spec's steps manually (insert a paragraph, clickTypography options): without this change the button never renders; with it the sidebar is opened explicitly. (Running the suite re-resets preferences in global setup, which is why mid-run state must be simulated.)getByRole( 'tab', { name: 'Patterns' } )now resolves to two tabs (Patterns,My patterns) which is the CI strict mode violation, while the exact-match locator used by this change resolves to the single selected tab.AI usage disclosure: investigation and fixes drafted with AI assistance and reviewed by me.