Skip to content

fix: align e2e tests with recent UI logic changes#180

Merged
streamer45 merged 3 commits intodemofrom
devin/1774185367-fix-e2e-tests
Mar 22, 2026
Merged

fix: align e2e tests with recent UI logic changes#180
streamer45 merged 3 commits intodemofrom
devin/1774185367-fix-e2e-tests

Conversation

@staging-devin-ai-integration
Copy link
Contributor

@staging-devin-ai-integration staging-devin-ai-integration bot commented Mar 22, 2026

Summary

Fixes 4 failing e2e tests on the demo branch caused by recent UI logic changes. The MoQ pipelines work correctly (confirmed manually), but tests needed updates to match the new behavior.

Changes:

  1. Crop shape test assertions (compositor-circle-pip.spec.ts, compositor-crop-shape.spec.ts): Updated from checking borderRadius: '50%' to checking clipPath: circle(...) — the compositor now uses clip-path for circle crop rendering instead of border-radius.

  2. Conditional waitForBroadcastAnnouncement (streamStoreHelpers.ts, streamStore.ts): Added isExternalRelay flag 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.

  3. Fix loadSamples auto-select (StreamView.tsx): The loadSamples effect auto-selects the first template but only set the view state, not the stream store. This meant pipelineNeedsVideo defaulted to true even for audio-only pipelines. Since Radix RadioGroup.onValueChange doesn't fire when clicking an already-selected item, the store defaults persisted. Fixed by also applying MoQ peer settings during auto-select.

  4. Playwright fake camera (playwright.config.ts): Added --use-fake-ui-for-media-stream flag so getUserMedia({ video }) works in headless Chromium. Without this flag, video capture returns "Not supported" even with --use-fake-device-for-media-stream.

  5. Reset isExternalRelay in 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 stale isExternalRelay=true from a previous template selection would cause an unnecessary 15s wait.

  6. 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 via handleTemplateSelect so that isExternalRelay, pipelineMediaTypes, and pipelineOutputTypes match the still-selected template.

  7. Fix stale serverUrl closure in auto-select (StreamView.tsx): The loadSamples effect (deps []) captured serverUrl as '' from initial render. Gateway path application was always skipped. Now reads useStreamStore.getState().serverUrl directly from the store.

Review & Testing Checklist for Human

  • Verify the isExternalRelay flag 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 latter
  • Test switching between Session and Direct Connect modes: after selecting an external relay template, switch to Direct → back to Session, and confirm the template settings are restored correctly
  • Test the Webcam PiP pipeline manually in a real browser (not headless) to confirm camera + video compositing still works end-to-end
  • Run just e2e-external http://localhost:4545 locally to verify all tests pass

Notes

  • The 4 skipped tests are expected — they require features not configured in the test environment (e.g. external relay, specific AI models)
  • The --use-fake-ui-for-media-stream flag auto-accepts the getUserMedia permission dialog, which is standard practice for headless Chromium media testing
  • Test results: 21 passed, 4 skipped, 0 failed; lint clean; 266 unit tests passing

Link to Devin session: https://staging.itsdev.in/sessions/896aa9a588c84259a5ad2df3440c22c2
Requested by: @streamer45


Staging: Open in Devin

- 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>
@staging-devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Staging: Open in Devin
Debug

Playground

Comment on lines +430 to +431
} else if (moqSettings.gatewayPath && serverUrl) {
setServerUrl(updateUrlPath(serverUrl, moqSettings.gatewayPath));
Copy link
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration bot Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 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.

Staging: Open in Devin

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
staging-devin-ai-integration[bot]

This comment was marked as resolved.

…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>
@streamer45 streamer45 merged commit 2d9227b into demo Mar 22, 2026
1 check passed
@streamer45 streamer45 deleted the devin/1774185367-fix-e2e-tests branch March 22, 2026 13:52
streamer45 added a commit that referenced this pull request Mar 22, 2026
* 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>
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