Skip to content

test: wait for the tour dialog before finding its button by name - #2287

Merged
brian-smith-tcril merged 1 commit into
openedx:masterfrom
brian-smith-tcril:product-tours-test-cheap-wait
Dec 3, 2026
Merged

brian-smith-tcril merged 1 commit into
openedx:masterfrom
brian-smith-tcril:product-tours-test-cheap-wait

Conversation

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

Summary

"completes the existing-user tour" in src/product-tours/ProductTours.test.jsx fails on a machine under CPU load with Unable to find role="button" and name "Okay". The test polled for the button by accessible name while the tour was still rendering. That query is expensive enough to hold the thread the render needs, so the checkpoint arrives after findByRole's 1000 ms. Test-only change.

CI has not hit this; it shows up in local full runs on a busy machine.

What changed

  • The test waits for the checkpoint with findByRole('dialog') before it finds the "Okay" button by name.

Testing

Measured on master at ed620369, Node 24.22.3, 8 cores, running src/product-tours/ProductTours.test.jsx alone. "Loaded" means eight node -e 'for(;;){}' processes running alongside.

Cost of one query on the page this test renders (146 elements, 11 buttons):

Query Idle Loaded
queryByRole('button', { name: 'Okay' }) 46 to 89 ms 176 to 667 ms
queryByRole('dialog') 2 to 3 ms 7 to 25 ms

Time until the checkpoint is visible, by what the wait polls with (4 runs each):

Polling with Idle Loaded
getByRole('dialog') 82 to 88 ms, found 4 of 4 476 to 673 ms, found 4 of 4
getByRole('button', { name: 'Okay' }) 419 to 612 ms, found 4 of 4 1586 to 3047 ms, timed out 4 of 4

The test itself, loaded: failed 2 of 2 runs before this change, passed 3 of 3 after. npm run lint reports 0 errors.

Not covered here: "completes the courseware tour" finds its "Okay" button the same way and failed 1 of 3 loaded runs after this change. In a loaded full npm run test, the three longest tests in the file can also exceed the 5000 ms test timeout.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
brian-smith-tcril added a commit to brian-smith-tcril/bairf that referenced this pull request Dec 2, 2026
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.27%. Comparing base (9b69394) to head (8232104).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2287   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files         373      373           
  Lines        5505     5505           
  Branches     1465     1469    +4     
=======================================
  Hits         5465     5465           
  Misses         40       40           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brian-smith-tcril
brian-smith-tcril merged commit a40b7da into openedx:master Dec 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants