Skip to content

[Bug] Notifications not working; add E2E coverage #932

Closed

Description

@senamakel

Summary

Desktop notifications are effectively broken (no OS toasts / no reliable in-app notification pipeline in real use). We need a root-cause fix across the stack (permissions, Tauri / CEF bridge, socket events from core, Redux, UI) and a proper E2E regression so this cannot ship broken again.

Problem

  • User-visible: Users do not get expected native and/or in-app notifications for events that should surface (e.g. core-originated core_notification, chat completion policies, or other product-defined triggers).
  • Engineering risk: The path touches multiple layers — app/src/lib/nativeNotifications/ (e.g. core_notification subscription on socketService), Tauri tauri-plugin-notification in app/src-tauri/, CEF notification wiring in app/src-tauri/src/webview_accounts/mod.rs, and core src/openhuman/notifications/ (e.g. bus.rs → socket). Without a working E2E, regressions are likely.

Product ask: “Notifications do not work at all” — treat as P0/P1 until a minimal happy path is proven on CI (Linux) and documented for macOS local.

Scope of the fix (non-exhaustive; triage to define)

  1. OS permissions — Request and verify notification permission on supported platforms; fail gracefully with visible UX when denied.
  2. Tauri / webview — Ensure showNativeNotification / plugin paths actually fire in the built app (CEF + notification plugin; no silent no-ops).
  3. Core → UI — Confirm core_notification (or the canonical event name) is emitted from core and received in the renderer; fix any break in socketService subscription or bus wiring.
  4. In-app list — If the product also requires the Notifications page / notificationSlice to update, align with the same event source of truth.
  5. Document the supported notification types in one place (what is expected to toast vs in-app only).

E2E requirements (must ship with the fix)

Add an E2E spec (WDIO) that proves at least one end-to-end path, for example:

  • Option A (preferred if automatable in CI): Drive the app, trigger a known code path that should emit a notification (e.g. via mock server / admin behavior, or a dev-only E2E hook that dispatches the same payload nativeNotifications expects), then assert a verifiable outcome:
    • DOM / Redux — e.g. a new item in the in-app notification list, or a specific data-testid / text on /notifications or
    • Instrumented check — browser.execute (when supportsExecuteScript() on tauri-driver) to read Redux state or a test-only global the build exposes only under a test flag.
  • Option B (macOS-only supplement): If native OS toasts are not assertable in Linux CI, document that and add a smoke step for macOS or keep CI focused on in-app guarantees plus a unit/integration test for the native bridge.

Harness alignment (see docs/E2E-TESTING.md):

  • Spec lives under app/test/e2e/specs/, e.g. notifications.spec.ts.
  • Run with bash app/scripts/e2e-run-spec.sh test/e2e/specs/<file>.ts <id>; use waitForWebView / helpers from app/test/e2e/helpers/element-helpers.ts as in other flows.
  • Use the shared mock backend and isolated OPENHUMAN_WORKSPACE per e2e-run-spec.sh defaults.

Avoid: E2E that only mocks Vitest; we need desktop coverage.

Acceptance criteria

  • Repro / root cause documented in the PR (what was broken: permission, event name, dead subscription, Tauri init, etc.).
  • Fix merged — At least one reliable notification path works for shipped desktop (define which events in the PR).
  • E2E — New or extended WDIO spec committed; CI (Linux) passes; instructions in PR for macOS if different.
  • No secrets / flakes — Deterministic waits, mock-only network, no wall-clock flakiness beyond documented harness limits.
  • Short doc — Update docs/E2E-TESTING.md or a line in the spec README listing the notifications flow and how to run it.

Related code (starting points)

  • app/src/lib/nativeNotifications/service.ts — core_notification listener, socket wiring
  • app/src/lib/nativeNotifications/tauriBridge.ts — native showNativeNotification
  • app/src-tauri/src/lib.rs — tauri-plugin-notification
  • src/openhuman/notifications/bus.rs — core → socket emission
  • app/src/pages/Notifications.tsx / app/src/store/notificationSlice.ts — in-app list
  • app/test/e2e/ — new spec + helpers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

testTest additions, fixes, or harness work.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions