electron-spectron
Legacy reference for Spectron - Electron's original ChromeDriver-based testing framework, officially deprecated 2022-02-01 at v19.0.0. Documents what Spectron was, the architectural reason it became unmaintainable, the migration path to Playwright `_electron`, and the residual support contract for projects still on Spectron. Use only when auditing a legacy suite or planning a migration off Spectron - for new work use `electron-playwright` in this plugin.
electron-spectron
Overview
Spectron was a Node.js library that drove Electron applications through ChromeDriver + the legacy WebDriverIO API. It shipped from the official electron-userland org and was - for several years - the only sanctioned end-to-end driver for Electron apps.
Per the Spectron repository:
"Spectron is officially deprecated as of February 1, 2022."
The final release was v19.0.0 (published 2022-02-02), pinned to Electron ^19.0.0 (spectronrepo). The repository is archived read-only with 233 open issues and 31 unmerged pull requests as of the deprecation snapshot (spectronrepo).
This skill is a pure reference. There are no "run these commands" steps because no new project should start on Spectron.
When to use
For new projects: stop here and read electron-playwright in this plugin instead.
Why Spectron was deprecated
The Spectron repository announcement itself does not enumerate reasons (spectronrepo), but the architectural context is observable from the surrounding ecosystem at the deprecation moment:
Per Electron's official tutorial, the three current recommendations are:
| Tool | Approach |
|---|---|
| Playwright | _electron.launch() returns an ElectronApp handle; expose main-process modules via electronApp.evaluate(...) |
| WebdriverIO (WDIO) | npm init wdio@latest ./ → wizard asks "Desktop Testing - of Electron Applications" |
| Selenium | WebDriver API bindings; lower-level than the above |
Playwright is the de-facto replacement most projects migrate to - see electron-playwright in this plugin for the implementation SKILL.
What Spectron looked like
For pattern-recognition during a migration audit, Spectron tests followed this shape:
// Legacy Spectron — DO NOT use for new code
const Application = require('spectron').Application;
const app = new Application({
path: '/path/to/electron/MyApp.app/Contents/MacOS/MyApp',
});
before(async () => {
await app.start();
});
after(async () => {
if (app && app.isRunning()) {
await app.stop();
}
});
it('opens a window', async () => {
const count = await app.client.getWindowCount();
assert.strictEqual(count, 1);
});The equivalent in modern Playwright _electron (per electrontest):
// Modern replacement
const { _electron: electron } = require('playwright');
let electronApp;
beforeAll(async () => {
electronApp = await electron.launch({ args: ['.'] });
});
afterAll(async () => {
await electronApp.close();
});
test('opens a window', async () => {
const windowCount = electronApp.windows().length;
expect(windowCount).toBe(1);
});See electron-playwright in this plugin for the full Playwright _electron authoring + running + CI workflow.
Migration shopping list
A Spectron-to-Playwright migration touches:
| Spectron concept | Playwright _electron replacement |
|---|---|
new Application({ path }) | electron.launch({ args: ['.'] }) (electrontest) |
app.start() / app.stop() | electronApp.launch() / electronApp.close() |
app.client.<webdriver-method> | page = await electronApp.firstWindow(); then standard page.<method> (electrontest) |
app.browserWindow.<method> (sync RPC into main process) | electronApp.evaluate(({ BrowserWindow }) => { … }) - typed handle (electrontest) |
Window counting via app.client.getWindowCount() | electronApp.windows().length |
| ChromeDriver binary lifecycle | Implicit - Playwright bundles Chromium and exposes packaged-app launch directly |
Plan migration test-file-by-test-file, not big-bang. Per Step 7 of the migration playbook (kept implicit here - see your project's test-strategy doc): tag each file as migrated, run both suites in CI until the Spectron set is empty, then delete spectron from package.json.
Residual support contract
If a project must remain on Spectron in the short term:
Anti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Starting a new Electron test project on Spectron in 2026 | Archived; no Electron 20+ support | Use electron-playwright |
| "Just upgrade Electron" without migrating off Spectron | Spectron pinned to Electron 19; newer Electron breaks Spectron's ChromeDriver bridge | Migrate to Playwright _electron |
| Big-bang Spectron → Playwright migration in one PR | High risk; no fall-back if behaviour differs | File-by-file migration with both suites green |
| Patching the archived Spectron repository upstream | Repository is read-only; PRs aren't being merged (spectronrepo) | Fork; or invest the same effort into migration |
| Citing Spectron's deprecation as the only reason to migrate | Stakeholders ask "but it still works" | Cite (1) Electron-version lock, (2) no security updates, (3) no support - all in the deprecation notice (spectronrepo) |