Skip to content

test(e2e): Notifications, focus, Calls, menu bar, and permissions - #3862

Merged
yasserfaraazkhan merged 24 commits into
masterfrom
e2e/08-notifications-focus-calls
Jul 6, 2026
Merged

test(e2e): Notifications, focus, Calls, menu bar, and permissions#3862
yasserfaraazkhan merged 24 commits into
masterfrom
e2e/08-notifications-focus-calls

Conversation

@yasserfaraazkhan

@yasserfaraazkhan yasserfaraazkhan commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary:

  • Notification trigger specs — delivery, dock bounce, taskbar flash, badge (platform-split: macOS dock vs Windows/Linux), click-to-focus.
  • Focus — app switch and window focus when clicking notifications or switching apps.
  • Menu bar — File/Edit/View/Window/Help, clear all data, devtools for current server, diagnostics, full screen. Mostly “does the menu item do the right thing” coverage; watch for macOS-only items and skip guards.
  • Permissions — IPC permission prompts via existing test hooks.

Release Note

NONE

Change Impact: 🟠 Medium

Regression Risk: The changes are mostly test coverage and test-helper updates, but they also touch shared E2E utilities and a few main-process test hooks. Risk is moderate because several existing test flows were refactored and platform gating was adjusted, which could expose gaps in cross-platform behavior or flaky teardown/setup paths.

QA Recommendation: Some manual QA is recommended for the newly covered desktop notification, focus, menu bar, calls, and permissions flows on the target platforms, especially around platform-specific behavior and Electron window handling.
Generated by CodeRabbitAI

Part 1 of splitting #3847 — core Playwright config, fixtures, electronApp
teardown, and GitHub Actions E2E workflow updates. No new specs yet.
Exposes __e2eTestRefs, message-box stub, tray/deep-link hooks (NODE_ENV=test
only) plus directLaunch, testRefs, and shared helper updates.
@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

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds new Playwright/Electron e2e tests covering Calls widget controls, app-switch focus, menu bar actions (clear data, diagnostics, devtools, help menu), and notification triggers (delivery, dock bounce, flash taskbar, click navigation). It introduces shared helpers (settings window, downloads dropdown, method spies), removes numerous platform-specific test skips, refactors several specs to use shared launch/close helpers, adds test-only main-process hooks (findActiveMentionByChannelId, __e2eDisplayAndClickMention, updateNotifier reference), and centralizes flaky-test result construction with a new collection-failure status.

Changes

Desktop E2E coverage

Layer / File(s) Summary
Shared helpers and test hooks
e2e/helpers/settingsWindow.ts, e2e/helpers/downloadsDropdown.ts, e2e/helpers/methodSpy.ts, e2e/helpers/mattermostShell.ts, src/main/notifications/index.ts, src/main/app/initialize.ts
Adds helpers to open the settings window, close the downloads dropdown overlay, spy on dock bounce/flash frame calls, and dedupe post-textbox candidates; adds test-only findActiveMentionByChannelId/__e2eDisplayAndClickMention hooks and exposes updateNotifier via __e2eTestRefs.
Calls widget and app-switch focus coverage
e2e/specs/calls/calls_functionality.test.ts, e2e/specs/focus/app_switch_focus.test.ts, e2e/specs/focus.test.ts
Adds Calls widget discovery/polling helpers and three call scenarios (mute button, widget/post fallback, keyboard shortcut), a new app-switch focus retention test, and switches focus teardown to closeElectronAppFast.
Menu bar specs and harness refactor
e2e/specs/menu_bar/*.test.ts
Adds clear-all-data, diagnostics, devtools-per-tab, and help-menu tests; migrates several specs to shared launchDirectTestApp/closeElectronAppFast/clickApplicationMenuItem helpers; refactors window-menu tab creation and teardown; removes several platform-specific skip guards.
Notification trigger flows and badge coverage
e2e/specs/notification_trigger/*.test.ts
Adds desktop notification delivery, dock bounce, flash taskbar, and click-navigation tests; removes platform skip guards across badge tests and a duplicated Linux test case.

Estimated code review effort: 4 (Complex) | ~60 minutes

Flaky Test Analysis

Layer / File(s) Summary
Flaky result construction
e2e/utils/analyze-flaky-test.js
Introduces buildAnalysisResult to centralize result shape and treat zero-collected tests as a "no-tests-collected" failure.
Commit status description
e2e/utils/github-actions.js
Updates formatStatusDescription to report "No tests ran (collection failed)" when collectionFailed is set.

Possibly related PRs

  • mattermost/desktop#3829: Both PRs modify e2e/utils/analyze-flaky-test.js and e2e/utils/github-actions.js to change test-outcome/"no tests collected" reporting.
  • mattermost/desktop#3859: Both PRs add/modify e2e/helpers/downloadsDropdown.ts and its closeDownloadsDropdownIfOpen logic.
  • mattermost/desktop#3857: Both PRs touch e2e/helpers/mattermostShell.ts post-textbox selector/candidate handling.

Suggested reviewers: saturninoabril, devinbinnie, edgarbellot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main E2E coverage areas changed in this PR, even though it is broad and omits helper updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e2e/08-notifications-focus-calls

Comment @coderabbitai help to get the list of available commands.

@yasserfaraazkhan yasserfaraazkhan changed the title E2E: Notifications, focus, and Calls (8/10) E2E: Notifications, focus, and Calls Jun 19, 2026
Base automatically changed from e2e/02-main-hooks to e2e/01-harness-ci June 19, 2026 11:21
Base automatically changed from e2e/01-harness-ci to master June 30, 2026 23:13
yasserfaraazkhan and others added 2 commits July 1, 2026 04:52
Resolve harness/hook conflicts by keeping merged #3855 changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align notification trigger tests with #3855 helper rename after master merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jun 30, 2026
@mm-cloud-bot

Copy link
Copy Markdown

❌ E2E Test Setup Failed

Failed to create E2E test instances: installation wait cancelled: context canceled

@yasserfaraazkhan

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yasserfaraazkhan yasserfaraazkhan added E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. and removed E2E/Run Run Desktop E2E Tests E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. labels Jul 1, 2026
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 1, 2026
@mm-cloud-bot

Copy link
Copy Markdown

❌ E2E Test Setup Failed

Failed to create E2E test instances: installation wait cancelled: context canceled

@yasserfaraazkhan yasserfaraazkhan added E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. and removed E2E/Run Run Desktop E2E Tests E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. labels Jul 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (8)
e2e/specs/calls/calls_functionality.test.ts (2)

63-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate widget-wait polling loop.

The same "poll findCallsWidgetWindow every 500ms until deadline" loop appears twice. Extract into a shared helper (e.g. waitForCallsWidgetWindow(electronApp, timeoutMs)) reused by both tests and the slash-command test's poll.

♻️ Proposed helper extraction
+async function waitForCallsWidgetWindow(electronApp: ElectronApplication, timeoutMs = 20_000): Promise<Page | null> {
+    const deadline = Date.now() + timeoutMs;
+    let widgetWindow: Page | null = null;
+    while (!widgetWindow && Date.now() < deadline) {
+        widgetWindow = await findCallsWidgetWindow(electronApp);
+        if (!widgetWindow) {
+            await new Promise((resolve) => setTimeout(resolve, 500));
+        }
+    }
+    return widgetWindow;
+}

Also applies to: 189-196

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/calls/calls_functionality.test.ts` around lines 63 - 70, The
polling logic for findCallsWidgetWindow is duplicated in multiple places, so
extract it into a shared helper such as waitForCallsWidgetWindow(electronApp,
timeoutMs) and reuse it from both tests and the slash-command polling path. Move
the repeated loop that waits up to widgetDeadline into this helper, keep the
timeout and retry interval configurable, and update the existing call sites in
calls_functionality.test.ts to use the new helper.

135-177: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Awkward type narrowing forces redundant casts.

outcome is mutated inside the expect.poll closure, so TypeScript can't narrow it after the await, forcing (outcome as Outcome)!.kind and a second cast to {kind:'widget'; window: Page} on Line 172. A type guard function or restructuring to return the outcome directly from the poll callback would avoid the double cast.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/calls/calls_functionality.test.ts` around lines 135 - 177, The
polling logic in calls_functionality.test.ts uses a mutable Outcome variable in
the expect.poll closure, which prevents TypeScript from narrowing it cleanly and
forces redundant casts later. Refactor the polling flow around the relevant
expect.poll block and outcome handling so the callback returns a typed result
directly or add a dedicated type guard for Outcome; then use the narrowed result
when checking for the widget case in the post-poll branch, avoiding both the
non-null assertion and the extra {kind: 'widget'; window: Page} cast.
e2e/specs/menu_bar/devtools_current_server.test.ts (1)

28-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant return after test.skip(true, ...).

Per Playwright semantics, test.skip(condition, description) called inside the test body aborts execution immediately when the condition is true, so the subsequent return; is unreachable dead code. Harmless but unnecessary.

♻️ Optional cleanup
             if (!process.env.MM_TEST_SERVER_URL) {
                 test.skip(true, 'MM_TEST_SERVER_URL required');
-                return;
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/menu_bar/devtools_current_server.test.ts` around lines 28 - 31,
Remove the redundant unreachable return after the test.skip(true,
'MM_TEST_SERVER_URL required') call in devtools_current_server.test.ts; when
locating the code in the test body around the MM_TEST_SERVER_URL check, keep the
test.skip guard and delete the following return since Playwright already aborts
execution there.
e2e/specs/notification_trigger/flash_taskbar.test.ts (1)

65-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Stale __e2eOriginalFlashFrame marker left on mainWin after restore.

Unlike dock_bounce.test.ts's restoreDockBounce, which explicitly deletes __e2eOriginalBounce after restoring, this cleanup restores mainWin.flashFrame but never removes the __e2eOriginalFlashFrame marker property from the window object. Harmless today, but inconsistent with the cleanup hygiene used elsewhere in this same PR and could cause confusion if a later test checks for that marker to detect "spy installed" state.

♻️ Proposed fix
                     if (mainWin && (mainWin as any).__e2eOriginalFlashFrame) {
                         mainWin.flashFrame = (mainWin as any).__e2eOriginalFlashFrame;
+                        delete (mainWin as any).__e2eOriginalFlashFrame;
                     }
                     delete (global as any).__e2eFlashFrameCalls;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/notification_trigger/flash_taskbar.test.ts` around lines 65 - 73,
The cleanup in the flash taskbar test restores mainWin.flashFrame but leaves the
__e2eOriginalFlashFrame marker behind on the MainWindow object. Update the
restore logic in electronApp.evaluate to also remove that marker after restoring
the original flashFrame, matching the cleanup pattern used by restoreDockBounce
in dock_bounce.test.ts and keeping the __e2eTestRefs/MainWindow state
consistent.
e2e/specs/notification_trigger/desktop_notification_delivery.test.ts (3)

4-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Sibling import placed before parent imports.

./helpers (line 4) is a sibling-relative import placed before the parent-relative imports (../../fixtures/index, ../../helpers/*) on lines 6-9, and the two groups are separated by a blank line implying distinct groups. Per the import-order convention, parent-relative imports should precede sibling imports.

♻️ Proposed fix
-import {triggerTestNotification, verifyNotificationReceivedInDM} from './helpers';
-
 import {test, expect} from '../../fixtures/index';
 import {demoMattermostConfig} from '../../helpers/config';
 import {acquireExclusiveLock} from '../../helpers/exclusiveLock';
 import {loginToMattermost} from '../../helpers/login';
+
+import {triggerTestNotification, verifyNotificationReceivedInDM} from './helpers';

As per coding guidelines, "Follow import order enforced by ESLint: builtins → external → @mattermost/* → internal aliases (app, common, main, renderer) → types → siblings/parent/index, with groups separated by blank lines and alphabetized within groups".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/notification_trigger/desktop_notification_delivery.test.ts` around
lines 4 - 9, Reorder the imports in desktop_notification_delivery.test.ts so the
parent-relative imports from ../../fixtures/index and ../../helpers/* come
before the sibling import from ./helpers, keeping the blank-line group
separation and preserving alphabetical order within each group. Use the existing
import block in the test file as the target, especially triggerTestNotification,
verifyNotificationReceivedInDM, test, expect, demoMattermostConfig,
acquireExclusiveLock, and loginToMattermost.

Source: Coding guidelines


50-58: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant condition; simplify to avoid confusion.

unityRunning (lines 56-58) already resolves to true for every non-Linux platform, so the disjunct process.platform !== 'linux' in the gate at line 65 is always true whenever unityRunning isn't already true from that same platform check — i.e., (unityRunning || process.platform !== 'linux') is logically equivalent to just unityRunning. The extra clause doesn't change behavior, but obscures intent.

♻️ Proposed simplification
-                if ((unityRunning || process.platform !== 'linux') && process.platform !== 'win32') {
+                if (unityRunning && process.platform !== 'win32') {

Also applies to: 65-70

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/notification_trigger/desktop_notification_delivery.test.ts` around
lines 50 - 58, The gate in the desktop notification delivery test is redundant
because `unityRunning` already falls back to `true` on non-Linux platforms, so
the extra `process.platform !== 'linux'` check adds no behavior. Simplify the
condition near the `unityRunning` setup and the later assertion block by relying
on `unityRunning` alone, keeping the logic in
`desktop_notification_delivery.test.ts` clear and avoiding the unnecessary
disjunct.

11-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer a top-level import type for consistency.

Other files in this same cohort (e.g. dock_bounce.test.ts) use import type {ElectronApplication} from 'playwright'; at the top of the file. This file instead inlines the type as import('playwright').ElectronApplication. Purely stylistic, but worth aligning for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/notification_trigger/desktop_notification_delivery.test.ts` at line
11, The `readBadgeCount` helper is using an inline
`import('playwright').ElectronApplication` type annotation instead of the
preferred top-level `import type` style. Update
`desktop_notification_delivery.test.ts` to add a top-level `import type
{ElectronApplication} from 'playwright';` and change `readBadgeCount` to use
that imported type, matching the pattern used in `dock_bounce.test.ts` and
keeping imports consistent across the cohort.
e2e/specs/notification_trigger/dock_bounce.test.ts (1)

71-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated monkey-patch/spy/restore pattern across dock_bounce.test.ts and flash_taskbar.test.ts.

installDockBounceSpy/restoreDockBounce here are structurally identical to the inline spy-install/restore blocks in flash_taskbar.test.ts (same pattern: save original method on a marker property, push observed calls to a global array, restore in finally). Given both files touch the same production flashFrame() path (per the “Production code path” comment), extracting a small shared installMethodSpy/restoreMethodSpy helper into e2e/helpers would reduce duplication and keep the two test suites in sync as the spy contract evolves.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/specs/notification_trigger/dock_bounce.test.ts` around lines 71 - 156,
The dock bounce test repeats the same monkey-patch spy/restore logic used in
flash_taskbar tests, so factor this pattern into a shared helper instead of
duplicating it. Extract a reusable installMethodSpy/restoreMethodSpy utility
under e2e/helpers, then update installDockBounceSpy and restoreDockBounce here
(and the equivalent flash_taskbar setup) to use it so both suites stay aligned
with the same spy contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/specs/calls/calls_functionality.test.ts`:
- Around line 137-169: The try/catch around expect.poll in
calls_functionality.test.ts is too broad and turns unrelated failures into a
skip. Narrow the handling in the /call start check so only the expected “Calls
plugin/widget not available” case skips, and let other errors from
findCallsWidgetWindow, serverWin.evaluate, or expect.poll propagate as test
failures. Use the outcome detection logic in the polling block to distinguish
the widget/post cases, and avoid swallowing page/electron errors when deciding
whether to call test.skip.

In `@e2e/specs/menu_bar/edit_menu.test.ts`:
- Line 106: The afterAll cleanup in the menu_bar/edit_menu test should be
protected against a failed launch so it does not call closeElectronAppFast with
an uninitialized electronApp. Update the test setup around launchDirectTestApp
and the afterAll hook to track whether the app was successfully assigned before
attempting cleanup, and only invoke closeElectronAppFast(electronApp,
userDataDir) when that handle exists.

In `@e2e/specs/menu_bar/help_menu.test.ts`:
- Around line 22-29: The help menu test is patching refs.updateNotifier even
though that singleton is never exposed in __e2eTestRefs, so the setup fails
before the menu action is exercised. Update the test bootstrap to expose the
actual update notifier singleton used by the menu, or change the patching code
to target the same instance the click handler invokes; use __e2eTestRefs and
updateNotifier as the key symbols to locate the setup.

In `@e2e/specs/menu_bar/view_menu.test.ts`:
- Line 135: The teardown in the view menu test can run even when Electron never
finished launching, so guard the `closeElectronAppFast` call in
`view_menu.test.ts` behind a check that `electronApp` was assigned before
attempting cleanup. Update the test’s setup/teardown flow to follow the same
guarded pattern used in `focus.test.ts`, and keep the existing
`closeElectronAppFast(electronApp, userDataDir)` call only when the app launch
succeeded.

In `@e2e/specs/notification_trigger/desktop_notification_delivery.test.ts`:
- Around line 47-54: The feature-detection check in the desktop notification
test uses an immediate $ query after login, which can falsely skip the test
before the tour UI finishes mounting. Update the check around loginToMattermost
and tourButton to use an explicit bounded wait such as waitForSelector with a
timeout, and only fall back to test.skip when that wait definitively fails. Keep
the skip logic tied to the CustomizeYourExperienceTour button so the
notification flow is exercised whenever the element does appear.

In `@e2e/specs/notification_trigger/notification_click.test.ts`:
- Around line 70-88: The notification click test is bypassing the real
production handler by registering its own ipcMain listener and sending
NOTIFICATION_CLICKED directly. Update the test to exercise the actual
mention.on('click') flow in notifications/index.ts instead of the synthetic
focus callback, and assert the resulting MainWindow.show() and
TabManager.switchToTab(view.id) behavior through the normal app path.

---

Nitpick comments:
In `@e2e/specs/calls/calls_functionality.test.ts`:
- Around line 63-70: The polling logic for findCallsWidgetWindow is duplicated
in multiple places, so extract it into a shared helper such as
waitForCallsWidgetWindow(electronApp, timeoutMs) and reuse it from both tests
and the slash-command polling path. Move the repeated loop that waits up to
widgetDeadline into this helper, keep the timeout and retry interval
configurable, and update the existing call sites in calls_functionality.test.ts
to use the new helper.
- Around line 135-177: The polling logic in calls_functionality.test.ts uses a
mutable Outcome variable in the expect.poll closure, which prevents TypeScript
from narrowing it cleanly and forces redundant casts later. Refactor the polling
flow around the relevant expect.poll block and outcome handling so the callback
returns a typed result directly or add a dedicated type guard for Outcome; then
use the narrowed result when checking for the widget case in the post-poll
branch, avoiding both the non-null assertion and the extra {kind: 'widget';
window: Page} cast.

In `@e2e/specs/menu_bar/devtools_current_server.test.ts`:
- Around line 28-31: Remove the redundant unreachable return after the
test.skip(true, 'MM_TEST_SERVER_URL required') call in
devtools_current_server.test.ts; when locating the code in the test body around
the MM_TEST_SERVER_URL check, keep the test.skip guard and delete the following
return since Playwright already aborts execution there.

In `@e2e/specs/notification_trigger/desktop_notification_delivery.test.ts`:
- Around line 4-9: Reorder the imports in desktop_notification_delivery.test.ts
so the parent-relative imports from ../../fixtures/index and ../../helpers/*
come before the sibling import from ./helpers, keeping the blank-line group
separation and preserving alphabetical order within each group. Use the existing
import block in the test file as the target, especially triggerTestNotification,
verifyNotificationReceivedInDM, test, expect, demoMattermostConfig,
acquireExclusiveLock, and loginToMattermost.
- Around line 50-58: The gate in the desktop notification delivery test is
redundant because `unityRunning` already falls back to `true` on non-Linux
platforms, so the extra `process.platform !== 'linux'` check adds no behavior.
Simplify the condition near the `unityRunning` setup and the later assertion
block by relying on `unityRunning` alone, keeping the logic in
`desktop_notification_delivery.test.ts` clear and avoiding the unnecessary
disjunct.
- Line 11: The `readBadgeCount` helper is using an inline
`import('playwright').ElectronApplication` type annotation instead of the
preferred top-level `import type` style. Update
`desktop_notification_delivery.test.ts` to add a top-level `import type
{ElectronApplication} from 'playwright';` and change `readBadgeCount` to use
that imported type, matching the pattern used in `dock_bounce.test.ts` and
keeping imports consistent across the cohort.

In `@e2e/specs/notification_trigger/dock_bounce.test.ts`:
- Around line 71-156: The dock bounce test repeats the same monkey-patch
spy/restore logic used in flash_taskbar tests, so factor this pattern into a
shared helper instead of duplicating it. Extract a reusable
installMethodSpy/restoreMethodSpy utility under e2e/helpers, then update
installDockBounceSpy and restoreDockBounce here (and the equivalent
flash_taskbar setup) to use it so both suites stay aligned with the same spy
contract.

In `@e2e/specs/notification_trigger/flash_taskbar.test.ts`:
- Around line 65-73: The cleanup in the flash taskbar test restores
mainWin.flashFrame but leaves the __e2eOriginalFlashFrame marker behind on the
MainWindow object. Update the restore logic in electronApp.evaluate to also
remove that marker after restoring the original flashFrame, matching the cleanup
pattern used by restoreDockBounce in dock_bounce.test.ts and keeping the
__e2eTestRefs/MainWindow state consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 13526025-0d89-44a0-83fd-f27b0a214a56

📥 Commits

Reviewing files that changed from the base of the PR and between 08129c4 and 081a3b5.

📒 Files selected for processing (20)
  • e2e/specs/calls/calls_functionality.test.ts
  • e2e/specs/focus.test.ts
  • e2e/specs/focus/app_switch_focus.test.ts
  • e2e/specs/menu_bar/clear_all_data.test.ts
  • e2e/specs/menu_bar/devtools_current_server.test.ts
  • e2e/specs/menu_bar/diagnostics.test.ts
  • e2e/specs/menu_bar/edit_menu.test.ts
  • e2e/specs/menu_bar/file_menu.test.ts
  • e2e/specs/menu_bar/full_screen.test.ts
  • e2e/specs/menu_bar/help_menu.test.ts
  • e2e/specs/menu_bar/menu.test.ts
  • e2e/specs/menu_bar/view_menu.test.ts
  • e2e/specs/menu_bar/window_menu.test.ts
  • e2e/specs/notification_trigger/desktop_notification_delivery.test.ts
  • e2e/specs/notification_trigger/dock_bounce.test.ts
  • e2e/specs/notification_trigger/flash_taskbar.test.ts
  • e2e/specs/notification_trigger/notification_badge_in_dock.test.ts
  • e2e/specs/notification_trigger/notification_badge_windows_linux.test.ts
  • e2e/specs/notification_trigger/notification_click.test.ts
  • e2e/specs/permissions/permissions_ipc.test.ts
💤 Files with no reviewable changes (4)
  • e2e/specs/notification_trigger/notification_badge_in_dock.test.ts
  • e2e/specs/menu_bar/menu.test.ts
  • e2e/specs/menu_bar/full_screen.test.ts
  • e2e/specs/notification_trigger/notification_badge_windows_linux.test.ts

Comment thread e2e/specs/calls/calls_functionality.test.ts
Comment thread e2e/specs/menu_bar/edit_menu.test.ts Outdated
Comment thread e2e/specs/menu_bar/help_menu.test.ts
Comment thread e2e/specs/menu_bar/view_menu.test.ts Outdated
Comment thread e2e/specs/notification_trigger/notification_click.test.ts Outdated
@yasserfaraazkhan yasserfaraazkhan changed the title E2E: Notifications, focus, and Calls test(e2e): Notifications, focus, Calls, menu bar, and permissions Jul 1, 2026
…pecs.

Harden test setup/teardown guards, exercise production notification click paths, and extract shared E2E helpers for settings windows and method spies.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 2, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 2, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 3, 2026
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 3, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 3, 2026
@github-actions github-actions Bot added the E2E/Run Run Desktop E2E Tests label Jul 3, 2026
@github-actions github-actions Bot added E2E/Run Run Desktop E2E Tests and removed E2E/Run Run Desktop E2E Tests labels Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Documentation Impact Analysis — no longer needed

A previous automated documentation impact comment exists, but the latest analysis determined that no documentation changes are needed.

The Docs/Needed label may still be present from the earlier analysis. A maintainer can remove it after confirming no docs updates are required.

@yasserfaraazkhan
yasserfaraazkhan enabled auto-merge (squash) July 3, 2026 10:31
@yasserfaraazkhan yasserfaraazkhan added the E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. label Jul 3, 2026

@saturninoabril saturninoabril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @yasserfaraazkhan, looking good. I left few comments for checking on what would be the better approach for conditional test when Calls plugin is not installed.
Also, in general, my observations with the E2E tests approach:

  • The tests seemed to lean more on implementation details (mocks, injection) rather than user behavior where controls (like clicking, typing) and verifications are done and observed via UI interaction.
  • It would be great to have consistent comments on code to easily follow along the test steps/verifications.

Comment thread e2e/fixtures/index.ts
await use(app);

await closeElectronApp(app, userDataDir, FAST_TEARDOWN);
await fs.rm(userDataDir, {recursive: true, force: true}).catch(() => {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curios why need to remove data dir. Maybe would be good to add comment.

Comment thread src/main/e2e/register.ts
* Register Playwright globals and test-only IPC handlers.
* No-op outside NODE_ENV=test.
*/
export function maybeRegisterE2eHooks(): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about rename to registerE2ETestHooks?

Comment on lines +81 to +82
if (!widgetWindow) {
test.skip(true, 'Calls plugin/widget not available on this test server');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This conditional test is non-deterministic. In the beforeEach, should it ensure that the Calls plugin is installed so that this failed when no Calls widget found and no need to put conditional logic?

await serverWin.press('#post_textbox', 'Enter');

const widgetWindow = await waitForCallsWidgetWindow(electronApp, 30_000);
if (!widgetWindow) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here for conditional logic when Calls plugin is not installed.

@yasserfaraazkhan
yasserfaraazkhan merged commit 11e7c7c into master Jul 6, 2026
48 checks passed
@yasserfaraazkhan
yasserfaraazkhan deleted the e2e/08-notifications-focus-calls branch July 6, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E2E/Reset-Servers Destroy E2E server for a fresh Run. Add E2E/Run label to kick off an e2e run. release-note-none

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants