Skip to content

test(e2e): Electron IPC coverage — floating, braindump, settings - #96

Merged
ryota-murakami merged 4 commits into
mainfrom
feat/e2e-coverage-improvements
Jun 16, 2026
Merged

test(e2e): Electron IPC coverage — floating, braindump, settings#96
ryota-murakami merged 4 commits into
mainfrom
feat/e2e-coverage-improvements

Conversation

@ryota-murakami

@ryota-murakami ryota-murakami commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Electron E2E coverage for three IPC namespaces that had zero automated test coverage:

New E2E specs

  • e2e/electron/floating-window.spec.ts — 5 ordered tests covering window.toggleFloatingNavigator, showFloatingNavigator, hideFloatingNavigator, and getAuxVisibility (verifies that toggle creates a window, idempotent show doesn't duplicate, hide reports as hidden, and aux window count stays exact after hide)
  • e2e/electron/braindump-window.spec.ts — 7 ordered tests covering brainDump.toggle, opacity read/write, sync mode read/write, and getAuxVisibility cross-check (including an exact 0.75 opacity round-trip assertion)
  • e2e/electron/settings-popover.spec.ts — 4 independent tests covering setShowInMenuBar, getStartupConfig, setStartupConfig, and setHideAppIcon IPC round-trips

Documentation

  • CLAUDE.md — expanded Electron Native QA section with a comprehensive Dev vs Production comparison table (bundle ID, app name, renderer URL, app.isPackaged, NODE_ENV, and computer-use grantability), explaining exactly why native QA must run on the packaged build

Review fixes

  • All test names rewritten to observable-behavior format (e.g. "setting braindump opacity to 0.75 persists the exact value")
  • Expected values hard-coded instead of type ranges where possible
  • Window-count assertion after hide tightened from .toBeLessThanOrEqual to .toBe (stricter — catches count increases that the previous assertion silently missed)

Test Coverage

Test-only PR — 16 new Electron E2E tests across 3 spec files. No new application code paths.

Electron IPC surfaces now covered by E2E:

  • window.electronAPI.window.*toggleFloatingNavigator, showFloatingNavigator, hideFloatingNavigator, getAuxVisibility
  • window.electronAPI.brainDump.*toggle, getOpacity, setOpacity, getSyncMode, setSyncMode, getShortcut
  • window.electronAPI.settings.*getStartupConfig, setStartupConfig, setShowInMenuBar, setHideAppIcon

Note: MenuBar/tray tests cannot run in CI (ELECTRON_E2E_DISABLE_SYSTEM_INTEGRATION=true disables tray in E2E env). Native Cocoa surfaces are covered by local macOS native QA per CLAUDE.md.

Pre-Landing Review

6 informational findings from Testing specialist (0 critical):

  • [AUTO-FIXED] floating-window.spec.ts:113toBeLessThanOrEqual(windowCountBefore) was too loose; changed to toBe(windowCountBefore) so a window count increase after hide is caught
  • braindump-window.spec.ts:68 — coverage gap: braindump toggle-to-close path not tested (SKIPPED — non-blocking)
  • braindump-window.spec.ts:100 — coverage gap: opacity clamping at out-of-range values not tested (SKIPPED)
  • settings-popover.spec.ts:51 — readback test after setStartupConfig would be stronger (SKIPPED — IPC wire test is sufficient)
  • settings-popover.spec.ts:43typeof boolean assertion could be tighter (SKIPPED — medium confidence)
  • _helpers/launch.ts:11 — CDP port sharing concern if workers > 1 (SKIPPED — config enforces workers: 1)

PR Quality Score: 7.0/10

Design Review

No frontend files changed — design review skipped.

Scope Drift

Scope Check: CLEAN
Intent: Add Electron E2E specs for floating window, braindump, and settings IPC
Delivered: exactly that + CLAUDE.md dev/prod comparison table (directly supports E2E testing context)

Plan Completion

No plan file detected.

TODOS

No TODO items completed in this PR.

Test plan

  • 622 unit tests pass (pnpm test)
  • Electron E2E passes on CI — local runner unavailable (Playwright webServer localhost IPv6 issue per CLAUDE.md; verified on CI)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Enhanced QA and release governance documentation with stricter testing requirements and Electron environment clarification.
  • Tests

    • Added E2E test coverage for BrainDump window IPC operations and visibility management.
    • Added E2E test coverage for floating navigator window toggle and display behavior.
    • Added E2E test coverage for application settings interface and persistence.

- Add 'QA after implementing, before ship' to Industry Standards table
- Add 'Ship before QA passes' to Violations table
- Add Definition of Done section (QA non-negotiable policy)
- Rename 'smoke test/smoke' → 'QA' throughout (2 occurrences)
- Add Dev vs Production Electron comparison table (bundle ID, app name,
  renderer URL, app.isPackaged, NODE_ENV, computer-use grantability)
…and braindump

- settings-popover.spec.ts: settings namespace IPC (setShowInMenuBar, getStartupConfig,
  setStartupConfig, setHideAppIcon)
- floating-window.spec.ts: toggleFloatingNavigator creates window; getAuxVisibility
  reflects visibility state; showFloatingNavigator is no-op when already visible;
  hideFloatingNavigator hides without destroying
- braindump-window.spec.ts: brainDump.getOpacity/getSyncMode/getShortcut return valid
  values; brainDump.toggle creates window; getAuxVisibility reflects braindump state;
  setOpacity/setSyncMode persist values

All tests pass typecheck and lint.
… values

- Rename all test descriptions to observable behavior (no 'returns XXX' pattern)
- Hard-code expected values where deterministic: setStartupConfig→true,
  setSyncMode→true, setOpacity(0.75)→0.75
- Add note explaining intentional shared-state coupling in floating/braindump
  (expensive app launch; toggle sequence is the feature path itself)
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
corelive Ready Ready Preview, Comment Jun 16, 2026 3:40pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Three new Playwright Electron end-to-end specs are added covering the BrainDump window IPC surface, Floating Navigator window lifecycle, and Settings IPC round-trips. CLAUDE.md is expanded with a QA governance section (implement→QA→ship ordering, E2E gate commands, macOS requirements) and a new dev-vs-production Electron identification guide.

Changes

QA Docs and Electron E2E Specs

Layer / File(s) Summary
QA governance and dev/production docs
CLAUDE.md
Adds a QA-before-ship directive at line 20, expands the Definition of Done section with E2E gate commands and fallback rules, revises the Linux+xvfb coverage note to specify uncovered macOS Cocoa paths, and introduces a section on distinguishing electron:dev from packaged production instances (bundle ID, app name, renderer URL, app.isPackaged, NODE_ENV) for native screenshot QA.
BrainDump window IPC e2e spec
e2e/electron/braindump-window.spec.ts
Boots a shared Electron app, asserts IPC getters for opacity bounds (0.30–1.00), sync mode type (boolean), and shortcut type (string), invokes brainDump.toggle and asserts getAuxVisibility reports braindump visible, then validates setOpacity(0.75) and setSyncMode(false) IPC writes.
Floating Navigator window lifecycle e2e spec
e2e/electron/floating-window.spec.ts
Ordered stateful tests: asserts auxiliary windows hidden on fresh launch, calls toggleFloatingNavigator and verifies a second Electron window is created, checks getAuxVisibility reports floating: true, confirms showFloatingNavigator is a no-op when already open (no duplicate window), and confirms hideFloatingNavigator hides without destroying the window.
Settings IPC round-trip e2e spec
e2e/electron/settings-popover.spec.ts
Validates renderer→preload→main IPC round-trips for settings.setShowInMenuBar, settings.getStartupConfig (three boolean flags), settings.setStartupWindowFlags, and settings.setHideAppIcon, asserting boolean result types and expected config shape.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • laststance/corelive#28: Directly shares the window.electronAPI.settings.setHideAppIcon IPC surface that settings-popover.spec.ts tests for dock icon visibility.
  • laststance/corelive#79: Changes BrainDump/Floating Navigator shortcut defaults and global shortcut registration that the new braindump-window.spec.ts getShortcut IPC assertion would reflect.
  • laststance/corelive#51: Introduces waitForMainWindow-based window selection stabilization used by the setupElectronTest harness that all three new specs depend on.

Poem

🐇 Hop, hop, the tests are here at last,
IPC rounds trip lightning fast,
BrainDump toggles, windows hide,
Settings flip from every side,
No smoke test words — just QA pride!
The rabbit checks before the ship sets sail. 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(e2e): Electron IPC coverage — floating, braindump, settings' accurately summarizes the main changes: adding Electron end-to-end tests for three IPC namespaces (floating navigator, brain dump, and settings).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/e2e-coverage-improvements

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.35%. Comparing base (8ebfe05) to head (713a159).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage   69.35%   69.35%           
=======================================
  Files         125      125           
  Lines        4004     4004           
  Branches     1039     1042    +3     
=======================================
  Hits         2777     2777           
  Misses       1058     1058           
  Partials      169      169           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 1

🧹 Nitpick comments (2)
e2e/electron/braindump-window.spec.ts (2)

100-125: ⚡ Quick win

Shared root cause: write-path tests validate IPC acknowledgements but not persisted state.

  • e2e/electron/braindump-window.spec.ts#L100-L125: after setOpacity(0.75) and setSyncMode(false), call getOpacity() / getSyncMode() and assert exact expected values.
  • e2e/electron/settings-popover.spec.ts#L51-L68: after setStartupConfig(newConfig), call getStartupConfig() and assert deep equality against newConfig.
🤖 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/electron/braindump-window.spec.ts` around lines 100 - 125, The tests
validate that IPC handlers return acknowledgements but do not verify that the
values are actually persisted. In e2e/electron/braindump-window.spec.ts (lines
100-125), after calling setOpacity(0.75) in the first test, add a follow-up call
to getOpacity() and assert it returns exactly 0.75; similarly, after calling
setSyncMode(false) in the second test, add a follow-up call to getSyncMode() and
assert it returns false. In e2e/electron/settings-popover.spec.ts (lines 51-68),
after calling setStartupConfig(newConfig), add a follow-up call to
getStartupConfig() and assert it deeply equals the newConfig object that was
set. These getter calls verify that the write operations persist the correct
values in the main process state, not just that the IPC calls succeed.

9-11: Add explicit serial mode to three Electron E2E specs that share state.

These three files have order-dependent tests with shared Electron app instances but lack explicit serial configuration. When workers: 1 is removed (per the temporary workaround note in playwright.config.ts), these specs will fail unless serial mode is declared at file scope:

  • e2e/electron/braindump-window.spec.ts: Add test.describe.configure({ mode: 'serial' }) before the beforeAll hook.
  • e2e/electron/floating-window.spec.ts: Add test.describe.configure({ mode: 'serial' }) before the beforeAll hook.
  • e2e/electron/settings-popover.spec.ts: Add test.describe.configure({ mode: 'serial' }) before the beforeAll hook.

This pattern already exists in e2e/web/skill-tree.spec.ts and prevents race conditions when shared state (window visibility, settings mutations) changes across test boundaries.

🤖 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/electron/braindump-window.spec.ts` around lines 9 - 11, Three Electron
E2E spec files have order-dependent tests with shared Electron app instances but
lack explicit serial configuration. Add test.describe.configure({ mode: 'serial'
}) before the beforeAll hook in all three affected files to ensure tests run
serially and prevent race conditions: in e2e/electron/braindump-window.spec.ts
(before line 9 where the comment begins), in
e2e/electron/floating-window.spec.ts (before line 9 where the comment section
starts), and in e2e/electron/settings-popover.spec.ts (before line 17 where the
comment begins). This ensures that when workers: 1 is removed from
playwright.config.ts, these specs will maintain proper test execution order for
their shared window visibility and settings state.
🤖 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 `@CLAUDE.md`:
- Line 40: The heading "Definition of Done — QA before ship" currently includes
non-English Japanese text "(必須 / NON-NEGOTIABLE)" which violates the
repository's coding guidelines requiring all markdown documentation to be
written in English only. Remove the Japanese characters and parenthetical
content from this heading, keeping only the English text "Definition of Done —
QA before ship" to maintain consistency with repository documentation standards.

---

Nitpick comments:
In `@e2e/electron/braindump-window.spec.ts`:
- Around line 100-125: The tests validate that IPC handlers return
acknowledgements but do not verify that the values are actually persisted. In
e2e/electron/braindump-window.spec.ts (lines 100-125), after calling
setOpacity(0.75) in the first test, add a follow-up call to getOpacity() and
assert it returns exactly 0.75; similarly, after calling setSyncMode(false) in
the second test, add a follow-up call to getSyncMode() and assert it returns
false. In e2e/electron/settings-popover.spec.ts (lines 51-68), after calling
setStartupConfig(newConfig), add a follow-up call to getStartupConfig() and
assert it deeply equals the newConfig object that was set. These getter calls
verify that the write operations persist the correct values in the main process
state, not just that the IPC calls succeed.
- Around line 9-11: Three Electron E2E spec files have order-dependent tests
with shared Electron app instances but lack explicit serial configuration. Add
test.describe.configure({ mode: 'serial' }) before the beforeAll hook in all
three affected files to ensure tests run serially and prevent race conditions:
in e2e/electron/braindump-window.spec.ts (before line 9 where the comment
begins), in e2e/electron/floating-window.spec.ts (before line 9 where the
comment section starts), and in e2e/electron/settings-popover.spec.ts (before
line 17 where the comment begins). This ensures that when workers: 1 is removed
from playwright.config.ts, these specs will maintain proper test execution order
for their shared window visibility and settings state.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 861bb3ae-c737-4b75-8daa-a65910a94f59

📥 Commits

Reviewing files that changed from the base of the PR and between 8ebfe05 and 713a159.

📒 Files selected for processing (4)
  • CLAUDE.md
  • e2e/electron/braindump-window.spec.ts
  • e2e/electron/floating-window.spec.ts
  • e2e/electron/settings-popover.spec.ts

Comment thread CLAUDE.md
@ryota-murakami
ryota-murakami merged commit 08f7d8b into main Jun 16, 2026
24 checks passed
@ryota-murakami
ryota-murakami deleted the feat/e2e-coverage-improvements branch June 16, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants