You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(test): adopt _electron.launch() Playwright API in e2e config (#244)
Closes#188
## Summary
- Rewrites `playwright.config.ts` to use `_electron.launch()` as a dual
Chromium + Electron Playwright project setup, with a
`PLAYWRIGHT_PROJECT` env var to select which project runs
- Adds a `HYVEON_TEST_MODE` gate to the Electron main entry
(`electron-entry.ts`) so the test harness can launch Electron without a
real tfstate/AWS surface, and covers it with a unit test
- Adds an Electron smoke spec (`electron-smoke.spec.ts`) that proves a
BrowserWindow opens and `window.gsd` is defined; wires CI to run
Playwright under `xvfb` for the Electron project
## Changes
```
.github/workflows/e2e.yml | 17 ++++--
.gitignore | 3 ++
CLAUDE.md | 2 +-
app/eslint.config.js | 2 +
app/packages/desktop-main/src/electron-entry.test.ts | 44 ++++++++++++++++
app/packages/desktop-main/src/electron-entry.ts | 21 ++++++--
app/packages/web/e2e/specs/electron-smoke.spec.ts | 38 ++++++++++++++
app/packages/web/package.json | 2 +-
app/packages/web/playwright.config.ts | 60 +++++++++++++++++++---
package-lock.json | 3 +-
10 files changed, 176 insertions(+), 16 deletions(-)
```
## Test plan
- [ ] `npm run app:test` — all unit tests pass, including the new
`electron-entry.test.ts` covering `HYVEON_TEST_MODE`
- [ ] `npm run app:lint` — 0 errors
- [ ] `PLAYWRIGHT_PROJECT=electron npm run app:test:e2e` (with
`desktop:build` run first) — Electron smoke spec passes: BrowserWindow
opens and `window.gsd` is defined
- [ ] `PLAYWRIGHT_PROJECT=chromium npm run app:test:e2e` — existing
Chromium e2e specs continue to pass unaffected
- [ ] CI e2e job runs Playwright under `xvfb-run` for the Electron
project without failure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|**Unit / integration**|`npm run app:test`| Vitest. Server-side logic, hooks, helpers run under the `node` environment; React component specs in `@hyveon/web` run under `jsdom` via `environmentMatchGlobs`. No real network — AWS SDK mocked via `aws-sdk-client-mock`; the `@hyveon/web` API client is stubbed via `vi.mock`. | Pure logic, hook behaviour, server controllers, **per-component React behaviour** (rendering, callbacks, internal state transitions). |
185
-
|**E2E (tier 1 — #74)**|`npm run app:test:e2e`| Playwright against `vite build` + `vite preview`. Nest server never runs; every `/api/*` call is stubbed at the network layer via `page.route()`. |User-visible flows: routing, auth gate, button interactions, status-badge rendering, optimistic updates. |
185
+
|**E2E (tier 1 — #74)**|`npm run app:test:e2e`| Playwright with **two projects** (Epic F #140 migration in progress). `electron` launches the packaged Electron app via `_electron.launch()`against `out/main/index.js` (built by `desktop:build`, with `HYVEON_TEST_MODE=1` in the launch env). `chromium` still runs the existing stub-based specs against `vite build` + `vite preview`, stubbing every `/api/*` call via `page.route()`. |New Electron-shell smoke/launch checks → `electron` project (`electron-smoke.spec.ts`). Existing browser-stub flows stay in `chromium` until each migrates to Electron under its own F-child (F.2–F.6, gated on the F.7 `window.gsd.__test.mock()` surface). |
186
186
|**Integration (tier 2 — #75)**|`npm run app:test:integration`| Playwright against `vite build (integration config)` + `vite preview` + real Nest server on `:3002`. AWS SDK intercepted by `aws-sdk-client-mock`. Mock state pushed via `ServerMocks` fixture to `/api/test/mocks/*`. | Real HTTP contract validation, `ApiTokenGuard` behaviour, `ConfigService` tfstate parsing, start/stop flows end-to-end, error propagation from ECS through the API response. |
0 commit comments