fix(e2e): enable fake media + pre-grant Calls permissions for CI - #3967
Merged
yasserfaraazkhan merged 1 commit intoAug 26, 2026
Merged
Conversation
The Calls E2E tests fail in CI for two independent reasons: 1. The headless Linux runner has no audio input device, so getUserMedia() returns no track and the Calls WebRTC peer never establishes (startCall times out waiting on callsClient.peer). Add Chromium's --use-fake-device-for-media-stream (plus --use-fake-ui-for-media-stream) to every Electron launch path. 2. The main process PermissionsManager denies `media` when NODE_ENV=test unless the origin is already allowed. Pre-write permissions.json into the userDataDir so each server origin's media/screenShare permission is granted before launch. Also stop test.skip()'ing when the Calls widget fails to open, so a real media/permission failure surfaces instead of masking as a skipped test.
|
@yasserfaraazkhan: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsI understand the commands that are listed here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the CI-only failure on #3943 where the Calls E2E tests pass locally but fail in CI. There are two independent blockers, and both must be addressed:
1. No audio input device in CI
The headless Linux runner has no microphone, so
getUserMedia({audio: true})returns no track and the Calls WebRTC peer (callsClient.peer) never establishes —startCall()times out waiting on it.Fix: add Chromium's
--use-fake-device-for-media-stream(plus--use-fake-ui-for-media-stream) to every Electron launch path:e2e/fixtures/index.tse2e/helpers/directLaunch.ts(DIRECT_LAUNCH_ARGS)This supplies a fake audio/video track — no virtual sound card or pulseaudio needed.
2. The app's permission manager denies
mediain test modesrc/main/security/permissionsManager.tshasif (process.env.NODE_ENV === 'test') resolve(false)— and E2E always launches withNODE_ENV=test. So even with a fake device, themediapermission request is denied unless the origin is already pre-granted. (Confirmed via Electron'selectron_permission_manager.cc: a registeredsetPermissionRequestHandleralways interceptsmedia, so--use-fake-ui-for-media-streamalone is not enough.)Fix: new
writePermissionsFile()helper ine2e/helpers/config.tsthat pre-writespermissions.json(keyed byserver.url.origin) into theuserDataDir, grantingmedia+screenShare. Wired into theelectronAppfixture andlaunchDirectTestApp().3. Stop masking failures as skips
calls_functionality.test.tswastest.skip()'ing when the widget failed to open, turning a real media/permission failure into a "skipped"/green test. Those two sites nowthrowso a genuine failure surfaces.Test plan
E2E/Runlabel) —calls_functionality,keyboard_shortcuts,slash_commandspass on linux/macos/windowsnpm run build-test && cd e2e && npm test -- callsagainst a server with the Calls pluginNotes
add-calls-e2e-tests(base of Add Calls E2E tests: slash commands, keyboard shortcuts, plugin setup #3943). The fake-media + permission changes are harness-level and benefit any futuregetUserMedia/Calls E2E.MM_TEST_SERVER_URL+ admin creds + a server with the Calls plugin in the marketplace), butnpx tsc --noEmitandnpx eslintboth pass on the changed files.