Skip to content

Block Editor: Fix flaky text gradient contrast warning test - #86403

Merged
ramonjd merged 1 commit into
trunkfrom
fix/typography-panel-gradient-notice-flaky-test
Nov 6, 2026
Merged

ramonjd merged 1 commit into
trunkfrom
fix/typography-panel-gradient-notice-flaky-test

Conversation

@ramonjd

@ramonjd ramonjd commented Nov 6, 2026

Copy link
Copy Markdown
Member

What?

Follow-up to #86148.

Fixes the flaky shows the contrast warning on the gradient control when the text is a gradient test in typography-panel.browser.test.tsx, reported here. The test now waits for the popover to finish opening before it checks that the warning is visible. It uses the existing toBePositionedPopover matcher to wait.

The testing docs prefer await expect.element( ... ).toBeVisible() in Browser Mode, but it isn't used here. Vitest's version ignores opacity, so it would pass while the popover is still at opacity: 0.

Why?

The popover that holds the warning fades in from opacity: 0, and toBeVisible() counts opacity: 0 as hidden. The test checked once, as soon as the warning appeared, so it failed whenever the fade hadn't started yet. It failed this way on two trunk runs on 5 November. Locally, with every CPU core busy, I ran the test 50 times in each of 20 runs: 10 runs failed before this change and none after.

Trade-off

The test takes about 0.2s longer per run, because the popover's slide-in has to finish before the popover counts as positioned.

The popover that holds the warning fades in from opacity 0, and
toBeVisible() counts opacity 0 as hidden. The test checked once, right
after the notice appeared, so it failed whenever the fade had not
started yet. Wait for the popover to finish opening first.
@ramonjd
ramonjd requested a review from ellatrix as a code owner November 6, 2026 01:13
@ramonjd ramonjd added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Block editor /packages/block-editor labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: ramonjd <ramonopoly@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 8.61 MB

9b15b5a Run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the test update that waits for popover positioning before asserting warning visibility.

No open issues 🎉

What changed in this PR

Stabilizes the text-gradient contrast warning test added in #86148 by waiting for the popover to finish opening before checking visibility.

Changes:

  • Uses waitFor with the existing toBePositionedPopover matcher.
  • Preserves the visibility assertion and explains the opacity-related timing issue.
File Description
packages/​block-editor/​src/​components/​global-styles/​test/​typography-panel.browser.test.tsx Waits for popover positioning before asserting that the contrast warning is visible.

Review effort: Balanced

@ramonjd

ramonjd commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

I'll get this in and monitor.

@ramonjd
ramonjd merged commit 8e4cbd2 into trunk Nov 6, 2026
95 checks passed
@ramonjd
ramonjd deleted the fix/typography-panel-gradient-notice-flaky-test branch November 6, 2026 02:04
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 6, 2026
@aaronrobertshaw

Copy link
Copy Markdown
Contributor

Thanks for getting this fix up and merged 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants