Introducing a new way to review your PRs.

Read the announcement

ismaelmartinez / teams-for-linux

Unofficial Microsoft Teams for Linux client

View on GitHub

23 documents · Updated Nov 23, 2026

docs / automated-test-coverage

Automated test coverage

Automated test coverage gives the release process confidence that Teams for Linux still behaves correctly before publication. Unit tests check local rules, end-to-end tests check real Electron flows, and cross-distribution tests check the released Linux app across desktop environments. This page complements Release packaging and quality and Application updates and packaging.

Test model

The test model moves from isolated rules to user-facing application flows and then to packaged-app startup. Each layer answers a different release question, so a passing layer does not replace the others.

LayerMain questionMain environment
UnitDoes an application rule keep its contract?Node.js with mocks and fixtures
End-to-endCan Electron start and complete a user-facing flow?Electron with Playwright
Cross-distributionDoes the packaged Linux app start in supported desktop environments?Docker with Ubuntu, Fedora, and Debian

The suites verify selected product behavior. They are not a single code-coverage score. Live Teams features that need a user account remain in an explicit authenticated workflow rather than the normal pull-request gate.

Release path

The build workflow runs quality checks and tests before it builds platform packages. The Linux package job then starts a packaged application, while the cross-distribution workflow checks a published Linux asset in a wider environment matrix.

This diagram shows how a code change moves from local rule checks to packaged release checks.

flowchart LR
    A[Change] --> B[Unit tests]
    B --> C[Unauthenticated Playwright tests]
    C --> D[Package build]
    D --> E[Packaged app smoke launch]
    E --> F[Cross-distribution smoke matrix]

References: .github/…/build.yml• L20-117 .github/…/build.yml• L120-178 .github/…/cross-distro-smoke.yml• L1-18

Unit tests

The unit suite checks application rules without starting the full product. It uses Node's built-in test runner with mocks and source fixtures so a failure points to a local contract instead of a live service.

Rule coverage

The suite protects rules that affect startup, user data, security, desktop behavior, and package safety:

  • configuration defaults, renames, migration, source precedence, and deprecation warnings
  • IPC channel allowlists, sender boundaries, payload safety, listener cleanup, and preload exposure
  • profiles, account activation, notification flags, multi-account state, and tray unread aggregation
  • notification delivery, notification clicks, remote icons, sound, and cleanup
  • safe external-link schemes, login challenge boundaries, and permission grants
  • URL preview blocking for configured Teams gateway requests
  • Microsoft Graph calendar paging and safe handling of remote page links
  • Linux package rules for native libraries and PipeWire support

The configuration tests ensure that old option names produce stable, safe warnings and that new nested names keep the same value across files, command-line flags, and environment variables. They also check that migration preserves user intent when both names appear.

The security tests ensure that new IPC registrations are allowlisted and that privileged channels accept only the right app pages. They also protect listener removal and error handling so short-lived windows do not leave handlers behind or turn renderer input into an uncaught process failure. Preload checks keep raw Electron objects and event data out of the Teams page while allowing trusted web-notification clicks to reach the host.

The profile, notification, and tray tests protect account boundaries. A notification flag belongs to the profile that raised it, updates reach that profile's live renderers, and a click activates the raising profile before the main window gains focus. Tray updates combine unread state across profiles, avoid repeated attention requests for redraws, and fall back to a usable base icon for invalid data.

The URL and login tests protect bounded interaction with the operating system and identity services. External links use only approved schemes. Basic-auth credentials answer only expected HTTPS challenges or proxy challenges, and configured host restrictions remain restrictive when input is malformed. Permission checks grant device and link access only to trusted Teams, sign-in, configured, or app-local pages. URL preview blocking cancels only the intended Teams gateway lookup when the option is enabled.

The API and packaging tests protect bounded external work. Calendar paging follows trusted Microsoft Graph links and stops at a fixed page limit. Linux packaging checks keep only the client PipeWire files needed by the Snap and verify pinned downloads before installation.

References: package.json• L21-29 package.json• L104-107 tests/…/applicationTray.test.js• L100-223 tests/…/externalUrl.test.js• L7-53 tests/…/ipcSecurity.test.js• L40-404 tests/…/login.test.js• L36-161 tests/…/permissions.test.js• L15-192 tests/…/urlPreviewBlock.test.js• L39-67 tests/…/configDeprecationWarning.test.js• L11-273 tests/…/configRenames.test.js• L31-669 tests/…/configStartupDeprecation.test.js• L70-227 tests/…/ipcValidator.test.js• L129-226 tests/…/preloadIpcLeak.test.js• L17-118 tests/…/profileActivation.test.js• L32-77 tests/…/profileNotificationFlags.test.js• L19-57 tests/…/profileNotifications.test.js• L43-112 tests/…/customNotificationManager.test.js• L50-101 tests/…/notificationService.test.js• L143-492 tests/…/graphApiCalendarPaging.test.js• L25-68 tests/…/snapPipewireBundle.test.js• L57-132 app/…/ipcSecurity.js• L31-177 app/…/permissions.js• L93-190 app/…/index.js• L61-161 app/…/urlPreviewBlock.js• L1-21

End-to-end tests

The end-to-end suites use Playwright's Electron support to check the main process, preload layer, renderer, and desktop windows together. Each run uses isolated user data so cookies and local state do not leak into later tests.

Unauthenticated flows

The default suite starts the app without a Microsoft account and checks that it reaches the Microsoft login page. It also checks desktop-facing flows that can run with local state or test fixtures.

The multi-account flow checks the feature boundary rather than only its handlers. With the feature enabled, the app must preserve normal login startup, expose profile actions, show the switcher, limit pinned profiles to five, keep the active profile view full size, and show unread state from a background profile. It also checks that per-profile notification settings affect the correct renderer and that a notification click activates the profile that raised it.

These tests use real Electron windows with controlled state. The shared helper isolates user data, finds trusted Teams windows, and cleans up the app after each run. This keeps the normal gate useful when Microsoft authentication is not available.

References: playwright.config.js• L3-14 tests/…/electronApp.js• L42-77 tests/…/electronApp.js• L80-143 tests/…/multi-account-enabled.spec.js• L18-163 tests/…/multi-account-enabled.spec.js• L165-231 tests/…/multi-account-enabled.spec.js• L233-322 tests/…/multi-account-enabled.spec.js• L324-430 tests/…/multi-account-enabled.spec.js• L484-551

Authenticated flows

The authenticated suite checks behavior after Teams loads. A maintainer creates a saved login session through an interactive Docker login mode. Playwright then reuses that session to confirm that the app avoids the login page, reaches a usable state, keeps a usable window, and starts without crash or screen-sharing errors.

The session must use the same Electron version for creation and test. The authenticated project runs only its dedicated test directory and uses longer time limits for the live Teams page. The standard build workflow runs the unauthenticated project instead.

References: playwright.authenticated.config.js• L7-25 tests/…/app-ready.spec.js• L4-42 tests/…/screen-sharing.spec.js• L4-65 tests/…/window-management.spec.js• L4-45 tests/…/run-tests.sh• L1-12

Playwright configuration

The default and authenticated projects use one worker and do not run tests in parallel. CI enables retries and rejects focused tests. A trace is captured on the first retry so a failed run has evidence without tracing every passing test.

CI installs the browser and runs Electron under Xvfb. The cross-distribution runner uses the workspace Electron binary for both session creation and testing. This keeps saved-session data compatible with the test runtime.

References: playwright.config.js• L3-14 playwright.authenticated.config.js• L14-25 .github/…/build.yml• L62-110 tests/…/run-tests.sh• L50-73

Cross-distribution tests

Cross-distribution tests check whether Linux distribution and display-system differences change packaged-app startup. The matrix covers Ubuntu 24.04, Fedora 41, and Debian Bookworm with X11, native Wayland, and XWayland. This produces nine environment combinations.

The local runner tests a release AppImage or a downloaded release asset. It can also extract a .deb or .rpm when Docker emulation cannot run the AppImage. The test therefore exercises a release package in a desktop environment rather than a source checkout.

Smoke matrix

The CI smoke workflow resolves an x64 AppImage and runs one container for each distribution and display mode. The check waits for a real application log and rejects common execution, linker, and platform-startup errors. Wayland and XWayland cases also confirm that the app maps a window through the expected backend.

The smoke check proves that the app starts in the target environment. It does not prove that a user can sign in or that a Teams page becomes usable. The workflow keeps results from all nine combinations and preserves short-lived logs when a case fails.

References: .github/…/cross-distro-smoke.yml• L11-18 .github/…/cross-distro-smoke.yml• L41-78 .github/…/cross-distro-smoke.yml• L93-117 tests/…/README.md• L27-39 tests/…/entrypoint.sh• L27-56 tests/…/smoke-check.sh• L1-31 tests/…/smoke-check.sh• L74-100

Authenticated matrix

The local authenticated workflow reuses one saved Teams session across the same nine combinations. Login stays interactive because Microsoft authentication is not automated. After login, the matrix compares post-login behavior across distributions and display systems.

The runner selects the display system explicitly. Native Wayland runs without an X11 backend, while XWayland forces an X11 client. Desktop capture is skipped on pure Wayland because that capability needs an X11 display. The runner supports one distribution, one display type, or all nine combinations.

References: tests/…/README.md• L59-80 tests/…/README.md• L108-137 tests/…/README.md• L173-180 tests/…/run-all-tests.sh• L1-15 tests/…/run-all-tests.sh• L22-27 tests/…/run-all-tests.sh• L42-83 tests/…/run-tests.sh• L43-73 tests/…/start-wayland.sh• L1-20 tests/…/start-xwayland.sh• L1-18 tests/…/screen-sharing.spec.js• L11-18

Release test gates

Before publication, the build workflow combines test results with package checks. The quality job runs linting, generated-configuration checks, and a critical dependency audit. The test job then runs unit tests and unauthenticated Playwright tests.

The x64 Linux packaging job starts the packaged app for up to 60 seconds. It requires successful Teams navigation, continued process life, and no missing-module or main-process JavaScript error. This catches package contents that source-based tests cannot detect.

Cross-distribution CI runs later against the latest release asset. It validates the published release rather than the package built by a pull request. Authenticated checks remain an explicit maintainer workflow.

Gate boundaries

The release gates provide these signals:

  • Unit tests protect local rules and contracts.
  • Playwright tests protect startup and selected desktop flows.
  • Packaged-app smoke launch protects runtime files in the artifact.
  • Linux package guards protect archive structure and CPU-safe native delivery.
  • Cross-distribution smoke tests protect Linux startup and display-backend selection.
  • Authenticated checks protect behavior after Teams login.

References: .github/…/build.yml• L20-117 .github/…/build.yml• L135-178 .github/…/cross-distro-smoke.yml• L25-39 package.json• L104-107 tests/…/snapPipewireBundle.test.js• L57-132

Change checklist

When these files or sections are changed, remember to consider these:

  • When the Playwright scope or ignore rules change, check that authenticated specs stay out of the normal CI job.
  • When Electron, session storage, or browser versions change, recreate the saved session before authenticated runs.
  • When profile, notification, or tray aggregation contracts change, keep sender ownership, profile activation, unread totals, renderer flag updates, and the matching Electron flow aligned.
  • When IPC or preload contracts change, update the allowlist, sender policy, event wrapper, listener cleanup, event wrapper, and source guards together.
  • When external-link or permission rules change, keep the allowed schemes, trusted origins, local-page checks, and denial logs aligned.
  • When login challenge rules change, keep HTTPS requirements, proxy handling, host normalization, and per-window retry state consistent.
  • When URL preview rules change, keep the root-session handler and profile-session listener aligned with the configuration flag and gateway host pattern.
  • When configuration names or precedence change, keep schema defaults, migration output, startup warnings, and stored menu values consistent.
  • When Graph paging rules change, keep trusted-host checks, page limits, merged response shape, and mid-page errors aligned.
  • When Linux package or Snap library rules change, keep pinned assets, checksum checks, file selection, and runtime paths aligned.
  • When a distribution or display mode changes, update the matrix, container setup, display setup, ports, and authenticated runner together.

Important failure modes

TriggerConsequenceGuard
The saved session uses a different Electron version from the test runAuthenticated tests reject or fail to use the sessionUse the same workspace Electron binary for login and testing
A package omits a runtime file or ships an incompatible native librarySource tests pass but the packaged app exits or cannot reach TeamsPackaged-app smoke launch and Linux package tests check runtime contents
A tray redraw is treated as a new unread eventThe desktop window flashes on every Teams status changeUnit tests distinguish unread-state changes from icon redraws
A page sends an unapproved external scheme or requests permission from an untrusted originThe app may start an unsafe handler or grant device access to the wrong pageExternal-URL and permission unit tests enforce scheme and origin boundaries
IPC listener bookkeeping does not follow registration removal or a rejected sender spends a one-shot listenerShort-lived windows retain handlers or a later trusted request cannot completeIPC security tests cover removal, one-shot behavior, sender checks, and listener errors
A basic-auth challenge arrives from an unexpected host or cleartext URLCredentials may be sent to the wrong service or the login retry state may change incorrectlyLogin tests require expected HTTPS or proxy challenges and isolate retry state per window
URL preview blocking matches the wrong gateway request or only one session typePreview traffic remains enabled when requested or unrelated requests are canceledURL preview tests check the exact path, host boundary, option flag, root session, and profile sessions
A Graph next link points outside Microsoft Graph or pages foreverThe client can send an unsafe request or hang on unbounded workHost validation and a fixed page cap stop the request
A release download is metadata rather than an executableThe smoke container cannot start the appAsset validation checks the package before launch
A display backend starts differently from the requested caseA Linux environment fails early or a mislabeled case passesThe nine-way matrix checks the expected Wayland or XWayland window

Key files

FileWhy to read it
package.jsonDefines the test commands and package-related test rules.
playwright.config.jsDefines the normal end-to-end scope and CI behavior.
playwright.authenticated.config.jsDefines the saved-session test boundary.
.github/…/build.ymlShows the test, package, and release job order.
.github/…/cross-distro-smoke.ymlShows the published-release distribution and display matrix.
tests/…/electronApp.jsShows how Electron tests isolate state and inspect app windows.
tests/…/multi-account-enabled.spec.jsIllustrates the multi-account, notification, and profile-activation contract.
tests/…/applicationTray.test.jsIllustrates tray unread-state aggregation and desktop attention behavior.
tests/…/externalUrl.test.jsIllustrates the external-link scheme boundary.
tests/…/ipcSecurity.test.jsIllustrates IPC allowlist, sender-boundary, cleanup, and error guarantees.
tests/…/login.test.jsIllustrates safe basic-auth challenge and retry behavior.
tests/…/permissions.test.jsIllustrates trusted-page permission and external-link policy.
tests/…/urlPreviewBlock.test.jsIllustrates the optional URL preview block for root and profile sessions.
tests/…/configRenames.test.jsIllustrates configuration compatibility across names and input sources.
tests/…/profileNotifications.test.jsIllustrates profile-owned notification settings and updates.
tests/…/notificationService.test.jsIllustrates native notification delivery and click relays.
tests/…/README.mdExplains local package, display, and saved-session workflows.
tests/…/smoke-check.shDefines successful launch and display-backend checks.
tests/…/snapPipewireBundle.test.jsIllustrates the Snap PipeWire bundle and asset safety checks.