Skip to content

Add frontend test infrastructure (Vitest + Playwright) #556

Open

Description

@oleksandr-korin

Summary

The Trinity frontend currently has zero automated test coverage. There is no unit test runner, no E2E tooling, and (until PR #553) no CI workflow that even built the frontend on PRs. This is a project-wide gap that affects every UI change, not a #67-specific concern — surfacing it as a P2 ticket.

Current state

Layer Today Coverage
Tailwind config / tokens npm run check:tokens (added #553) Catches palette-alias drift + token typos
Build smoke frontend-build.yml (added #553) npm ci && npm run build
Unit tests — None
Component tests — None
E2E / visual regression — None
Type checking — None (no tsconfig, no vue-tsc)

src/frontend/package.json lists no vitest, jest, @vue/test-utils, playwright, cypress, or @testing-library/* dependency.

Proposed additions

Phase 1 — Vitest for unit + component tests

  • Add vitest, @vue/test-utils, jsdom (or happy-dom)
  • Configure vitest.config.js co-located with vite.config.js
  • Cover the most leverage-y units first:
    • composables/useFormatters.js (formatters, color helpers)
    • utils/syncHealth.js (status classification)
    • Pinia stores (stores/agents.js, stores/auth.js)
    • Critical components (StatusIndicator.vue, CapacityMeter.vue, status badges)
  • Add npm run test and npm run test:watch scripts
  • Wire into CI (frontend-build.yml)

Phase 2 — Playwright for E2E + visual regression

  • Add @playwright/test
  • e2e/ directory with smoke flows: login, agent list, agent detail, schedule create
  • Optional: visual snapshots for the migrated design-system components (issue Add centralized design system with semantic color tokens #67 follow-up)
  • Run against dockerized stack in CI (separate job, allowed-to-fail initially)

Phase 3 — Type checking

  • Add vue-tsc
  • Strict mode opt-in per file/directory
  • npm run typecheck script in CI

Acceptance

  • Phase 1 minimum: Vitest installed, ≥10 representative unit/component tests, runs in CI on every frontend PR
  • Phase 2 minimum: Playwright installed, ≥3 smoke E2E flows passing in CI
  • Phase 3 minimum: vue-tsc passes on at least the new test files and tailwind.config.js
  • All three runners wired into frontend-build.yml (or sibling workflows)
  • Brief contributor docs in src/frontend/README.md explaining how to run each layer

Why P2 not P1

  • No production incidents from missing frontend tests yet (mitigated by manual review + small contributor pool).
  • Backend tests are comprehensive (~2,000+ pytest tests).
  • Adding test infra is a commitment — flaky tests, snapshot maintenance, CI time. Worth doing well, not rushed.

Cross-references

Activity

  1. added
    enhancement
    priority-p2
    type-feature
    on Apr 28, 2026
  2. oleksandr-korin commented on Apr 28, 2026

    @oleksandr-korin
    ContributorAuthor

    /claim

  3. github-actions commented on Apr 28, 2026

    @github-actions

    @oleksandr-korin This issue is already assigned to oleksandr-korin. Use /unclaim first if you want to take over.

  4. 3 remaining items

  5. added
    complexity-medium
    theme-devex
    on Jun 3, 2026
  6. added
    status-incubating
    on Jun 14, 2026
  7. AndriiPasternak31 commented on Jun 29, 2026

    @AndriiPasternak31
    Contributor

    Fresh evidence this gap bites, from #1376 / PR #1377 (severed-turn Session reconcile):

    That fix added genuinely intricate branching to the sessions Pinia store — pre-send assistant/user baselines, a 429 concurrency short-circuit, a success-before-handoff ordering rule, and a wall-clock poll deadline routing to a neutral notice. All of it is logic that wants unit-level pinning, but the frontend has no unit runner, so the only available coverage was the Playwright e2e suite (T1–T8). The e2e tests are good, but they're heavier and slower than a store unit test would be, and they can't cheaply exercise every internal branch the way vitest could.

    This is the second recent Session-tab store fix (#779/#789 earlier) where complex reconcile/poll logic shipped e2e-only. The recurrence suggests the missing unit runner is now actively costing review/verification effort, not just a theoretical gap.

    Not touching the priority label — this is your call and your zone — but flagging it as a candidate for a P1 bump / de-incubation given the pattern. vitest for the stores (sessions.js, agents.js, …) would have the highest immediate payoff.

  8. added
    status-ready
    and removed
    status-incubating
    on Jul 3, 2026
  9. removed
    enhancement
    on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

complexity-mediumpriority-p2status-readytheme-devextype-feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions