Repository navigation
Boost: Stop Overview tests dropping speed test clicks under React 18 - #55606
LiamSarsfield wants to merge 2 commits into
Conversation
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.
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
Code Coverage SummaryThis 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. 🤷 |
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.
Fixes an intermittent failure in Boost's Overview tests under React 18.
Proposed changes
clickRunSpeedTest()test helper that waits until the header's "Run speed test" button hasaria-disabled="false", then clicks it. Every test that clicks that button after the scores load now uses it.requestSpeedScoresmock inbeforeEach, so a response queued by one failed test cannot hang the next test's first score load.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
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.