- Tests must cover application code + UI only
- No need to test bddgen nor playwright (so command execution must be mocked)
- GitHub connection included, but GitHub is mocked (no real login)
- Electron (Node main process)
- Nuxt (renderer, SPA) + PrimeVue
- IPC (renderer ↔ main) via
ipcRenderer.invoke/ipcMain.handle - Settings + token storage: JSON file + OS keychain via
keytar(recommended)
- Device Flow (suited for desktop/headless apps)
- On GitHub side, Enable Device Flow in the app configuration (OAuth App or GitHub App)
apps/
desktop/
electron/ (main)
renderer/ (nuxt + primevue)
packages/
shared/ (types + IPC contracts)
main.ts: create window + load Nuxt (dev server) or built files- Enable
contextIsolation: true+ preload
Expose a single object:
window.api = {
workspace: { get, set },
features: { list, read, write },
steps: { export },
validate: { scenario },
runner: { runHeadless, runUI },
git: { pull, commitPush, status },
github: { startDeviceFlow, pollDeviceFlow, logout, status }
}Goal: build testable and mockable services.
This allows not testing bddgen/playwright/git directly.
exec(cmd, args, cwd, env)→{ code, stdout, stderr }- Prod: real
child_process - Tests: fake runner returning predefined outputs
- Store
workspacePathin internal settings - Validate presence of
package.json,features/, etc.
list()→features/**/*.featureread(path)/write(path, content)- Security: relative paths only, whitelist under
features/
exportSteps()viaCommandRunner.exec("npx", ["bddgen","export"])- Minimal parsing: steps list + patterns
- In-memory cache + “refresh” button
-
Input: scenario JSON (builder) or generated Gherkin
-
Checks:
- required args present
- ambiguities (multiple patterns match)
- missing steps (no match)
runHeadless()→npx playwright test ...runUI()→npx playwright test --ui ...- MVP: do not parse Playwright results; only status + logs + report paths
Two modes:
- Real mode:
git pull,git status,git add,git commit,git push - Mock mode for tests (via CommandRunner)
startDeviceFlow()→ POST to GitHub → returnsuser_code,verification_uri,device_code,intervalpollDeviceFlow(device_code)→ loop/polling controlled by UI
- Store
access_tokenin OS keychain viakeytar - In settings: only
connected=true+ optional user info
- Use HTTPS + token (not SSH)
- MVP: token may only be used for API or later git auth integration
- For now: Git local may still rely on system credentials
- Workspace selector
- Features list
- Buttons “Pull / Commit+Push”
-
Scenario name
-
Given/When/Then rows:
- Step dropdown (from
bddgen export) - Auto-generated arg fields
- Add/remove/reorder buttons
- Step dropdown (from
-
Gherkin preview (read-only, optional)
- Validation (warnings)
- Run Headless / Run UI
- Logs (scrollable area)
- Select workspace
- Load steps + features
- Select feature → load scenario into builder (or “create new”)
- Save → write
.feature - Run → call runner service
Two test levels.
- Step parser
- ValidationService
- FeatureService (with temp filesystem)
- GithubAuthService (with fetch mock)
- GitService (with CommandRunner mock)
-
Mock HTTP via
nock(Node) or equivalent -
Scenarios:
- startDeviceFlow OK
- poll:
authorization_pending - poll: success (
access_token) - poll: errors (
slow_down,expired_token) No real network calls.
Playwright can launch and drive Electron using _electron.launch.
- App launches, window visible
- Workspace selection (fixture)
- Features displayed
- Steps displayed (CommandRunner mocked)
- Builder: add step + fill args
- Save: file written (temp fixture)
- Validation warnings displayed
- Run: clicking “Run headless” calls your CommandRunner with correct args (mocked)
- Git: pull/push calls (mocked)
Launch app with env flags:
APP_TEST_MODE=1WORKSPACE_PATH=fixtures/workspace-basicMOCK_COMMANDS=1
In test mode, main process uses FakeCommandRunner.
- Use
electron-builderor equivalent - Ensure
keytaris bundled correctly (Linux can be sensitive) - Sign macOS/Windows builds if public distribution
-
Electron app (Win/Linux/macOS) with one Nuxt/PrimeVue page
-
Selectable local workspace
-
Feature list + step list (export mockable)
-
Given/When/Then builder +
.featuresave -
Simple validation (warnings)
-
Run headless/UI (mockable commands)
-
GitHub Device Flow implemented and tested via mocks
-
Test suite:
- unit tests for services
- UI e2e tests on Electron