desktop-testing-electron

Installation
SKILL.md

Electron Testing Patterns

Quick Guide: Use Playwright's _electron.launch() for E2E tests -- it controls the full app via CDP. Unit test main process code (IPC handlers, business logic) with your test runner by mocking the electron module. Test preload scripts by mocking contextBridge and ipcRenderer. Spectron is dead since Electron 24 -- Playwright and WebDriverIO are the replacements. Run Electron tests on headless Linux CI with xvfb-run or the xvfb-maybe wrapper.


<critical_requirements>

CRITICAL: Before Using This Skill

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST await electronApp.close() in test teardown -- leaked Electron processes break CI and consume resources)

(You MUST mock the electron module in unit tests -- Electron APIs are only available inside the Electron runtime)

(You MUST use xvfb-run or xvfb-maybe for headless Linux CI -- Electron requires a display server)

(You MUST stub native dialogs in E2E tests -- showOpenDialog/showSaveDialog block the process and cannot be interacted with by Playwright)

Installs
8
GitHub Stars
23
First Seen
Jul 25, 2026
desktop-testing-electron — agents-inc/skills