fix: align e2e tests with recent UI logic changes#180
Conversation
- Update crop shape test assertions from borderRadius to clipPath (compositor now uses clip-path: circle(...) instead of border-radius) - Add isExternalRelay flag to stream store to conditionally skip waitForBroadcastAnnouncement in gateway mode (only needed for external relay pipelines with separate pub/sub nodes) - Fix loadSamples auto-select to apply MoQ peer settings to stream store (pipelineNeedsVideo, serverUrl, etc.) so the store matches the selected template even when Radix RadioGroup doesn't fire onValueChange for an already-selected item - Add --use-fake-ui-for-media-stream to Playwright config so getUserMedia works for video capture in headless Chromium Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
ui/src/views/StreamView.tsx
Outdated
| } else if (moqSettings.gatewayPath && serverUrl) { | ||
| setServerUrl(updateUrlPath(serverUrl, moqSettings.gatewayPath)); |
There was a problem hiding this comment.
📝 Info: Race between loadConfig and loadSamples on mount may skip gateway path application
The loadSamples effect (line 408) and the loadConfig effect (line 350) both run on mount as independent async operations. The new auto-apply code at StreamView.tsx:430 reads useStreamStore.getState().serverUrl directly from the store to work around the stale closure, but if loadConfig hasn't completed yet, serverUrl will be '' and the else if guard at line 430 will prevent the gateway path from being applied. This means on first load, if the samples fetch completes before the config fetch, the server URL won't include the gateway path from the template. The user can fix this by re-clicking the template. This is strictly better than the old behavior (which didn't apply any MoQ settings on auto-select), but a future improvement could chain the operations or re-apply settings when config loads.
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
There was a problem hiding this comment.
Correct — serverUrl is still '' at mount time so the gatewayPath branch is a no-op during auto-select. This is intentional/acceptable: the primary goal of the auto-select fix is to sync the media type flags (pipelineNeedsVideo, pipelineNeedsAudio, etc.) with the selected template. The server URL is set correctly by the loadConfig effect once the async config fetch completes, and handleTemplateSelect also re-applies the URL when the user clicks a template.
Direct Connect mode connects to a relay without a skit pipeline, so there is no external relay announcement to wait for. Without this reset, a stale isExternalRelay=true from a previous template selection would cause an unnecessary 15s wait in performConnect. Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
…erverUrl in auto-select - Re-apply selected template's MoQ settings (isExternalRelay, pipelineMediaTypes, pipelineOutputTypes) when switching back to Session mode from Direct Connect - Use useStreamStore.getState().serverUrl in loadSamples auto-select instead of stale closure-captured value that is always '' on mount Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
* demo fixes * fixes * fixes * fix stale data * ws event handling fixes * fix more stale state issues * simplify * fixes * make it easier to run subset of e2e * fix: align e2e tests with recent UI logic changes (#180) * fix: align e2e tests with recent UI logic changes - Update crop shape test assertions from borderRadius to clipPath (compositor now uses clip-path: circle(...) instead of border-radius) - Add isExternalRelay flag to stream store to conditionally skip waitForBroadcastAnnouncement in gateway mode (only needed for external relay pipelines with separate pub/sub nodes) - Fix loadSamples auto-select to apply MoQ peer settings to stream store (pipelineNeedsVideo, serverUrl, etc.) so the store matches the selected template even when Radix RadioGroup doesn't fire onValueChange for an already-selected item - Add --use-fake-ui-for-media-stream to Playwright config so getUserMedia works for video capture in headless Chromium Co-Authored-By: Claudio Costa <cstcld91@gmail.com> * fix: reset isExternalRelay when switching to Direct Connect mode Direct Connect mode connects to a relay without a skit pipeline, so there is no external relay announcement to wait for. Without this reset, a stale isExternalRelay=true from a previous template selection would cause an unnecessary 15s wait in performConnect. Co-Authored-By: Claudio Costa <cstcld91@gmail.com> * fix: restore template settings on Session mode switch and fix stale serverUrl in auto-select - Re-apply selected template's MoQ settings (isExternalRelay, pipelineMediaTypes, pipelineOutputTypes) when switching back to Session mode from Direct Connect - Use useStreamStore.getState().serverUrl in loadSamples auto-select instead of stale closure-captured value that is always '' on mount Co-Authored-By: Claudio Costa <cstcld91@gmail.com> --------- Co-authored-by: StreamKit Devin <devin@streamkit.dev> Co-authored-by: Claudio Costa <cstcld91@gmail.com> * fix e2e lint --------- Co-authored-by: staging-devin-ai-integration[bot] <166158716+staging-devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: StreamKit Devin <devin@streamkit.dev>
Summary
Fixes 4 failing e2e tests on the
demobranch caused by recent UI logic changes. The MoQ pipelines work correctly (confirmed manually), but tests needed updates to match the new behavior.Changes:
Crop shape test assertions (
compositor-circle-pip.spec.ts,compositor-crop-shape.spec.ts): Updated from checkingborderRadius: '50%'to checkingclipPath: circle(...)— the compositor now usesclip-pathfor circle crop rendering instead ofborder-radius.Conditional
waitForBroadcastAnnouncement(streamStoreHelpers.ts,streamStore.ts): AddedisExternalRelayflag to the stream store. The 15-second broadcast announcement wait is now only applied for external relay pipelines (separate pub/sub nodes), not gateway mode where skit manages the peer connection directly. This prevents unnecessary delays and connection drops in gateway mode.Fix loadSamples auto-select (
StreamView.tsx): TheloadSampleseffect auto-selects the first template but only set the view state, not the stream store. This meantpipelineNeedsVideodefaulted totrueeven for audio-only pipelines. Since RadixRadioGroup.onValueChangedoesn't fire when clicking an already-selected item, the store defaults persisted. Fixed by also applying MoQ peer settings during auto-select.Playwright fake camera (
playwright.config.ts): Added--use-fake-ui-for-media-streamflag sogetUserMedia({ video })works in headless Chromium. Without this flag, video capture returns "Not supported" even with--use-fake-device-for-media-stream.Reset
isExternalRelayin Direct Connect mode (StreamView.tsx): Direct Connect mode connects to a relay without a skit pipeline, so there is no external relay announcement to wait for. Without this reset, a staleisExternalRelay=truefrom a previous template selection would cause an unnecessary 15s wait.Restore template settings on Session mode switch (
StreamView.tsx): When switching back to Session mode from Direct Connect, re-apply the selected template's MoQ settings viahandleTemplateSelectso thatisExternalRelay,pipelineMediaTypes, andpipelineOutputTypesmatch the still-selected template.Fix stale
serverUrlclosure in auto-select (StreamView.tsx): TheloadSampleseffect (deps[]) capturedserverUrlas''from initial render. Gateway path application was always skipped. Now readsuseStreamStore.getState().serverUrldirectly from the store.Review & Testing Checklist for Human
isExternalRelayflag correctly distinguishes gateway vs external relay pipelines — test both a gateway pipeline (e.g. MoQ Peer Transcoder) and an external relay pipeline to confirm the broadcast announcement wait only fires for the latterjust e2e-external http://localhost:4545locally to verify all tests passNotes
--use-fake-ui-for-media-streamflag auto-accepts the getUserMedia permission dialog, which is standard practice for headless Chromium media testingLink to Devin session: https://staging.itsdev.in/sessions/896aa9a588c84259a5ad2df3440c22c2
Requested by: @streamer45