Skip to content

fix(e2e): enable fake media + pre-grant Calls permissions for CI - #3967

Merged
yasserfaraazkhan merged 1 commit into
add-calls-e2e-testsfrom
fix-calls-e2e-media-permission
Aug 26, 2026
Merged

fix(e2e): enable fake media + pre-grant Calls permissions for CI#3967
yasserfaraazkhan merged 1 commit into
add-calls-e2e-testsfrom
fix-calls-e2e-media-permission

Conversation

@yasserfaraazkhan

Copy link
Copy Markdown
Contributor

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.ts
  • e2e/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 media in test mode

src/main/security/permissionsManager.ts has if (process.env.NODE_ENV === 'test') resolve(false) — and E2E always launches with NODE_ENV=test. So even with a fake device, the media permission request is denied unless the origin is already pre-granted. (Confirmed via Electron's electron_permission_manager.cc: a registered setPermissionRequestHandler always intercepts media, so --use-fake-ui-for-media-stream alone is not enough.)

Fix: new writePermissionsFile() helper in e2e/helpers/config.ts that pre-writes permissions.json (keyed by server.url.origin) into the userDataDir, granting media + screenShare. Wired into the electronApp fixture and launchDirectTestApp().

3. Stop masking failures as skips

calls_functionality.test.ts was test.skip()'ing when the widget failed to open, turning a real media/permission failure into a "skipped"/green test. Those two sites now throw so a genuine failure surfaces.

Test plan

  • CI E2E (E2E/Run label) — calls_functionality, keyboard_shortcuts, slash_commands pass on linux/macos/windows
  • Local npm run build-test && cd e2e && npm test -- calls against a server with the Calls plugin

Notes

  • This is a stacked PR targeting 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 future getUserMedia/Calls E2E.
  • I could not run CI locally (requires MM_TEST_SERVER_URL + admin creds + a server with the Calls plugin in the marketplace), but npx tsc --noEmit and npx eslint both pass on the changed files.

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.
@mm-cloud-bot

Copy link
Copy Markdown

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

Details

I understand the commands that are listed here

@yasserfaraazkhan yasserfaraazkhan added the E2E/Run Run Desktop E2E Tests label Aug 26, 2026
@github-actions github-actions Bot removed the E2E/Run Run Desktop E2E Tests label Aug 26, 2026
@yasserfaraazkhan yasserfaraazkhan added E2E/Override Cancels/skips E2E runs for this PR and marks the check as skipped and removed E2E/Override Cancels/skips E2E runs for this PR and marks the check as skipped labels Aug 26, 2026
@yasserfaraazkhan
yasserfaraazkhan merged commit 594fc3c into add-calls-e2e-tests Aug 26, 2026
49 of 56 checks passed
@yasserfaraazkhan
yasserfaraazkhan deleted the fix-calls-e2e-media-permission branch August 26, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants