Files
commitea/apps/desktop/e2e/smoke.spec.ts
Croissant Le Doux a04714bfa6 Kill screen fixtures: live/empty screens + one demo snapshot for e2e
The app is now fixture-free. All product screens render live data (via the
reconcile bridge + view builders) or an EmptyState — no hardcoded demo data,
metrics, or prose anywhere in the UI.

- Removed the `?? FIXTURE` fallbacks and embedded fake strings (fixed dates,
  'reconcile 3.2s', 'ahead of forecast', mock forecast prose) from all 10 product
  screens; each now shows an EmptyState when its live data is absent.
- directives-screen: fully live off pmstate.directives() (was seeded from a
  fixture with a fake consequence-diff card) — loading + empty states, no seed.
- use-chat: drop the CHAT seed (the model-status effect already sets the greeting).
- data/fixtures.ts → data/view-types.ts: stripped every const design fixture,
  kept only the view-model TYPES (the builder↔screen contract). Repointed imports.

Testing fixture (no live gitea), per the user's call:
- New apps/desktop/src/main/demo-snapshot.ts — one deterministic, gitea-shaped
  snapshot (issues/milestones/deps/timelines + capacity + directives + collaborators).
  Served by the reconcile/boot/collaborators/capacity/directives handlers when
  COMMITEA_E2E=1, so e2e renders it through the REAL builders with no token.
- smoke.spec rewritten to assert on the demo snapshot through the live render path;
  onboarding/offline-toggle assertions dropped (wizard is live → live-onboarding;
  offline is real state now). 12/12 smoke pass.

Verify: core tsc clean · desktop tsc clean · 12/12 smoke green (perf#32 benchmark
flakes under machine load — unrelated, passes in isolation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 13:21:47 -04:00

111 lines
5.0 KiB
TypeScript

import { expect, test } from './fixtures.js'
/**
* Smoke suite — runs in demo mode (COMMITEA_E2E=1), where the main process serves
* the fixed demo snapshot (apps/desktop/src/main/demo-snapshot.ts) with NO live
* gitea. The app renders it through the exact same view builders as real data, so
* these assertions exercise the real render path against deterministic input.
* Full onboarding + agent flows live in the GITEA_LIVE-gated live-*.spec files.
*/
test('boots into the shell with the Focus screen', async ({ app, window }) => {
await app.expectLoaded()
await expect(window.getByText('Reginald', { exact: true })).toBeVisible()
await expect(window.getByRole('heading', { name: 'Morning service' })).toBeVisible()
await app.screenshot('shell-light')
})
test('Focus shows the Now/Next/Later cards from the scheduler', async ({ window }) => {
for (const slot of ['Now', 'Next', 'Later']) {
await expect(window.getByText(slot, { exact: true })).toBeVisible()
}
// the cards link to real demo issues (which specific one is scheduler-dependent)
await expect(window.getByRole('main').getByRole('link').first()).toBeVisible()
})
test('Standup renders the drift / plan letter', async ({ app, window }) => {
await app.nav('Standup').click()
await expect(window.getByRole('heading', { name: 'Morning standup' })).toBeVisible()
await expect(window.getByText("Today's plan")).toBeVisible()
await app.screenshot('standup')
})
test('Board: lifecycle columns, a demo issue, and the search filter', async ({ app, window }) => {
await app.nav('The pot').click()
await expect(window.getByRole('heading', { name: 'The pot' })).toBeVisible()
// lifecycle columns populated by the demo snapshot's event stream
await expect(window.getByText('Steeping', { exact: true })).toBeVisible()
await expect(window.getByText('Done', { exact: true })).toBeVisible()
await expect(window.getByText('Fix lifecycle inference on merge events')).toBeVisible()
await app.screenshot('board')
await window.getByPlaceholder(/Search the pot/).fill('monte carlo')
await expect(window.getByText('Monte Carlo forecast bands on the runway')).toBeVisible()
await expect(window.getByText('Fix lifecycle inference on merge events')).toBeHidden()
await window.getByPlaceholder(/Search the pot/).fill('')
// the Gantt + Dependencies tabs render from the same snapshot
await window.getByRole('tab', { name: 'Gantt' }).click()
await app.screenshot('gantt')
await window.getByRole('tab', { name: 'Dependencies' }).click()
await app.screenshot('deps')
})
test('Runway shows the demo milestones', async ({ app, window }) => {
await app.nav('Runway').click()
await expect(window.getByRole('heading', { name: 'Runway' })).toBeVisible()
await expect(window.getByText('Beta', { exact: true })).toBeVisible()
await app.screenshot('runway')
})
test('Inbox renders', async ({ app, window }) => {
await app.nav('Inbox').click()
await expect(window.getByRole('heading', { name: 'Inbox' })).toBeVisible()
await app.screenshot('inbox')
})
test('Capture: braindump prompt', async ({ app, window }) => {
await app.nav('Capture').click()
await expect(window.getByText("Tell me what you're planning")).toBeVisible()
await app.screenshot('capture')
})
test('Directives: the live ledger from pm-state', async ({ app, window }) => {
await app.nav('Directives').click()
await expect(window.getByRole('heading', { name: 'Directives' })).toBeVisible()
await expect(window.getByText(/append-only · JSONL in pm-state/)).toBeVisible()
// a demo directive quote from the snapshot
await expect(window.getByText(/Beta ships the 12th, hard/)).toBeVisible()
await app.screenshot('directives')
})
test('Settings: connection + appearance, theme sync', async ({ app, window }) => {
await app.nav('Settings').click()
await expect(window.getByRole('heading', { name: 'Settings' })).toBeVisible()
await expect(window.getByRole('heading', { name: 'Connection' })).toBeVisible()
await app.screenshot('settings')
await window.getByText('Evening (dark)').click()
await expect(window.locator('html')).toHaveAttribute('data-theme', 'dark')
})
test('issue drill-in from a Focus card and back', async ({ app, window }) => {
// Focus cards render the issue title as a link; open the first and come back.
await window.getByRole('main').getByRole('link').first().click()
await expect(window.getByRole('button', { name: 'Back' })).toBeVisible()
await app.screenshot('issue')
await window.getByRole('button', { name: 'Back' }).click()
await expect(window.getByRole('heading', { name: 'Morning service' })).toBeVisible()
})
test('Evening service toggle flips the document theme', async ({ app, window }) => {
await window.getByText('Evening service', { exact: true }).click()
await expect(window.locator('html')).toHaveAttribute('data-theme', 'dark')
await app.screenshot('shell-dark')
})
test('exposes the commitea preload API', async ({ app }) => {
const api = await app.preloadApi()
expect(api).toBeDefined()
expect(api).toHaveProperty('platform')
})