test: Fix Firefox CI hang in video spec (mock MediaStream)#255
Conversation
The video state spec created a real MediaStream and spied on its getVideoTracks (and on a track's addEventListener). Firefox marks those native members non-configurable, so jasmine could not install the spies — erroring and hanging the browser until karma DISCONNECTed, intermittently failing CI. Replace the real MediaStream/track with plain mock objects whose methods are spies, so no native non-configurable property is patched (matches rylo-translate). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR updates ChangesVideoState Test Standardization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Permanent fix for the Firefox CI failure that's blocking deploys.
src/app/core/modules/ngxs/store/video/video.spec.tscreated a realnew MediaStream()and thenspyOn(...)-ed its nativegetVideoTracks(and a track'saddEventListener). Firefox marks those native members non-configurable, so jasmine can't install the spy — it errors (getVideoTracks is non-configurable and can't be deleted) and hangs the browser ~93s until karma reportsDISCONNECTED, failing thebuildjob intermittently (Jasmine's randomized order surfaced the hang at different points).Fix (matching
rylo-translate): replace the realMediaStream/track with plain mock objects whose methods arejasmine.createSpy(...), so no native non-configurable property is patched. Verifiedvideo.spec.tspasses 10/10 on both Chrome and Firefox locally.This keeps
--browsers=ChromeHeadless,FirefoxHeadlessin CI, so it supersedes #254 (the Chrome-only stopgap) — that PR can be closed.Test plan
video.spec.tspasses on ChromeHeadless (10/10)video.spec.tspasses on FirefoxHeadless locally (10/10, previously hung/disconnected)buildgreen on both browsers → deploy proceedsNote
Low Risk
Test-only changes to mocking strategy; no runtime or security impact.
Overview
Fixes intermittent Firefox CI hangs in
video.spec.tsby stopping use ofspyOnon realMediaStream/ track APIs.StartCamera tests now use plain mock objects:
getVideoTracksand trackaddEventListenerarejasmine.createSpyinstances on fakeMediaStream/MediaStreamVideoTrackshapes (withgetTracksstubbed where needed), instead of patching Firefox’s non-configurable native methods. Shared setup drops the global realMediaStreammock camera; one StopVideo case still seeds state withnew MediaStream()where no spies are required. Minor test cleanup (inline error string expectations).No production code changes—test-only CI stability so dual-browser Karma can stay enabled.
Reviewed by Cursor Bugbot for commit f4ce47e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Note: This release contains internal test improvements with no user-facing changes.