Repository navigation
Open
Labels
flaky-testDetails a test removed as part of the flaky test process
Description
Several VideoBlock karma tests seem to be flakey.
By my estimate, one of any of these fails around 10% of the time.
1) player state was changed
Video HTML5Video non-hls encoding on non-Touch devices events: [play]
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. in http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d (line 3938)
QueueRunner.prototype.run/attemptAsync/timeoutId<@http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d:3938:23
2) callback was called
Video HTML5Video non-hls encoding on non-Touch devices events: [play]
Expected [ 3, 1 ] to contain -1.
../tests/js/html5_video_spec.js/</</describeInfo</</</</<@http://localhost:9876/base/public/js/commons.js?70e765de13f56a983143d5c15cc43f401e110fe8:65273:72
Deferred/then/</</<@http://localhost:9876/base/assets/js/src/vendor/jquery.js?26e6b63b81813d8ad942c90d369df2673602b812:3366:33
fire@http://localhost:9876/base/assets/js/src/vendor/jquery.js?26e6b63b81813d8ad942c90d369df2673602b812:3187:31
fireWith@http://localhost:9876/base/assets/js/src/vendor/jquery.js?26e6b63b81813d8ad942c90d369df2673602b812:3317:7 Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. in http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d (line 3938)
QueueRunner.prototype.run/attemptAsync/timeoutId<@http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d:3938:23
3) callback was called
Video HTML5Video hls encoding on non-Touch devices events: [play]
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. in http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d (line 3938)
QueueRunner.prototype.run/attemptAsync/timeoutId<@http://localhost:9876/absolute/home/runner/work/xblocks-core/xblocks-core/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?da99c5b057693d025fad3d7685e1590600ca376d:3938:23
Metadata
Metadata
Assignees
Labels
flaky-testDetails a test removed as part of the flaky test process
Type
Projects
- StatusShow more project fields📋 Backlog
Activity
[-]Flaky VideoBlock tests[/-][+]Flaky VideoBlock JS tests[/+]kdmccormick commentedon Aug 13, 2026
@openedx/axim-aximprovements No action needed right now, but I just wanted to share that I've been noticing that there is flakiness in a few of the VideoBlock JS tests. Curious if any of you guys hit this when developing, too. We can consider fixing or removing them in the future if they prove to be disruptive.
kdmccormick commentedon Aug 13, 2026
summary from Claude Opus. Claude is pretty confident about this, but I'm not exactly sure.
Flaky video JS tests:
waitUntiltimeouts blame the wrong specSymptom
Occasional failures in the
video-xblockKarma/Jasmine suite(
src/xblock_video), most often on specs namedplayer state was changedunder
Video HTML5Video … events: [play] | [pause] | …, reported as:Characteristics that make it confusing:
[play]one time,[pause]the next, sometimes an hls vs non-hls variant).
waitUntilandtherefore cannot itself time out.
focused browser.
Root cause
The shared helper
tests/spec_helpers/jasmine-waituntil.jshas two propertiesthat combine badly:
setTimeout, so its timer keepsrunning across spec boundaries.
fail(), which fails whichever spec iscurrently executing.
So when a
waitUntilstarted in spec A never satisfies its condition, itstimer keeps ticking after A finishes and, ~
jasmine.DEFAULT_TIMEOUT_INTERVALlater, calls
fail()during some unrelated later spec B. B gets blamed — evenif B is synchronous. The reported spec name is essentially "whoever was running
when the leaked timer expired," which is why it wanders.
The trigger is that many of these specs wait on real, timing-dependent
HTML5 media events — especially reaching
STATUS.PLAYING, which needs thebrowser's real
playingevent on a<video>actually decoding the fixture.Headless CI (no autoplay/user-gesture, no window focus) makes those events fire
late or never, so the waits time out and the leaked
fail()fires. A local runwith a real focused browser reaches those states more reliably, hence the lower
local failure rate. Anything that perturbs event-loop/focus timing (e.g. a
browser modal) shifts the failure rate too.
Suggested fixes (in preference order)
Harden the helper. Track pending
waitUntiltimers and clear them in aglobal
afterEachso no timer survives its spec. Keep failing the spec on agenuinely unmet condition — but attribute it to the spec that owns the wait,
not a bystander. This is a small change to shared infra and removes the
cross-spec mislabeling that makes the flake so hard to read.
Make individual specs deterministic. Where a spec asserts a state, have
its
waitUntilpoll for that state rather than a looser condition, and/orfire synthetic media events instead of relying on real playback. Example
already applied: the
[pause]"player state was changed" spec now waits for=== STATUS.PAUSED(the asserted state) instead of!== STATUS.PLAYING(which
BUFFERINGalso satisfies), closing that particular race.Fix (1) addresses the mechanism; fix (2) reduces how often it's triggered.
Reproducing / debugging
--grepdoes not filter on this toolchain (karma-jasmine0.3.8 +jasmine-core2.6.4 ignore the adapter'sspecFilter). Use Jasmine focus(
fit/fdescribe) to narrow to a spec, and/or comment out spec imports inassets/karma.webpack.entry.jsto shrink the bundle.(the real offender is a different, earlier spec). Run a representative
subset repeatedly and watch whether the named failing spec changes — that
variance is itself the tell for cross-spec contamination.
feanil commentedon Nov 30, 2026
Hit this twice in a row on #337 today, it passed on the third run.
events: [ended] callback was calledmethods playVideoThe second one fits the leaked timer explanation above. The
methods playVideospec is synchronous and never calls thewaitUntilhelper, so theTimeout has expiredfailure has to come from a wait that another spec started.The part I can't make fit is that neither run has a second failure. The helper's limit and jasmine's own spec timeout are both
jasmine.DEFAULT_TIMEOUT_INTERVAL, and the helper counts 50ms per poll rather than measuring elapsed time, so it should always give up after jasmine does. That means the spec that started the wait should fail withAsync callback was not invokedfirst, like in your original report. Both of today's runs only have the oneTimeout has expiredfailure, so I wasn't able to find the spec that started the wait.farhan commentedon Dec 1, 2026
@salman2013
I experienced same often.
irfanuddinahmad commentedon Dec 2, 2026
More data from
main: the JavaScript Tests workflow failed on 4 of the last 7 pushes, each time on a single Video spec:7dc8ff8(11-30)Video HTML5Video non-hls … methods getDuration332ba2e(11-27)VideoCaption constructor always fetch the transcript in Flash modedf67a94(11-24)VideoCaption constructor always fetch the transcript in Flash mode9b851ba(11-23)Video HTML5Video non-hls … methods _getLogsSo besides the
events: [play]/[ended]cases above,methods getDuration,methods _getLogsand theVideoCaption … Flash modeconstructor spec fail intermittently too.This matters more soon: openedx/openedx-platform#38750 deletes the platform's copy of these specs, which leaves this repo's CI as the only place they run. A ~50% red rate on
mainmakes real Video regressions easy to miss or re-run past.Generated using Claude Code