Skip to content

Boost: Stop Overview tests dropping speed test clicks under React 18 - #55606

Draft
LiamSarsfield wants to merge 2 commits into
trunkfrom
fm/boost-overview-flake-fix-1130
Draft

LiamSarsfield wants to merge 2 commits into
trunkfrom
fm/boost-overview-flake-fix-1130

Conversation

@LiamSarsfield

@LiamSarsfield LiamSarsfield commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes an intermittent failure in Boost's Overview tests under React 18.

Proposed changes

  • Add a clickRunSpeedTest() test helper that waits until the header's "Run speed test" button has aria-disabled="false", then clicks it. Every test that clicks that button after the scores load now uses it.
  • Reset the requestSpeedScores mock in beforeEach, so a response queued by one failed test cannot hang the next test's first score load.
  • Test-only: nothing reaches users.

Why are these changes being made?

Under React 18 the header button stays disabled for one more render after the scores appear. Testing Library's short pause after a findBy… query usually covers that render. When it does not, the click is ignored, no speed test starts, and the test times out. The queued mock response it leaves behind then breaks the next test. This has failed about once in 1,900 trunk runs, only in the React 18 job. The button is meant to be disabled while scores load, so this PR changes the tests, not the product. When a local run skips that pause, the file before this change fails 12 of its 79 tests, and this PR's file passes all 79.

Related product discussion/links

  • None.

Does this pull request change what data or activity we track or use?

No.

Testing instructions

This changes only tests, so there is nothing to check by hand; the "JS tests" and "JS tests (React 18)" CI jobs run it.

Under React 18 the Overview header's Run speed test button can stay
aria-disabled for one render after new scores or an error appear, so
a click in that render is sometimes ignored and no speed test starts.
Click it through one helper that first waits for
aria-disabled="false", and reset the requestSpeedScores mock in
beforeEach so a queued response left by a failed test cannot leak
into the next one.
@LiamSarsfield
LiamSarsfield requested a review from a team as a code owner November 30, 2026 18:47
@github-actions github-actions Bot added the [Plugin] Boost A feature to speed up the site and improve performance. label Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 30, 2026
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@LiamSarsfield LiamSarsfield changed the title test(boost): stabilize overview speed test interactions Boost: Stop Overview tests dropping speed test clicks under React 18 Nov 30, 2026
@LiamSarsfield
LiamSarsfield marked this pull request as draft November 30, 2026 19:20
Find the Run speed test button inside the wait so a re-rendered button is
picked up, and say why beforeEach resets the speed score mock.

This branch has not been deployed

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

Labels

[Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant