Skip to content

test(shared-ui): add React Testing Library coverage #560

@luxass

Description

@luxass

Summary

Add browser/component tests for packages/shared-ui using Vitest and React Testing Library.

Why

We are starting to lean more heavily on shared UI primitives across the monorepo, and we now have a working browser-test pattern in packages/pipelines/pipeline-server that we can reuse. A small but real test foundation in shared-ui would help us catch regressions in reusable primitives before they land in downstream apps/packages.

Proposed direction

  • Add a Vitest browser/component test setup for packages/shared-ui
  • Use jsdom with React Testing Library
  • Keep the suite focused on behavior and accessibility rather than styling snapshots
  • Follow the same general testing approach already used in pipeline-server

Suggested scope

Start small with a few high-value primitives and compositions, for example:

  • ui/button
  • ui/input
  • ui/dialog
  • ui/sidebar
  • selected shared components under src/components

Expectations

  • Tests should live with clear browser/component structure
  • Prefer semantic queries first
  • Only add data-testid when semantic queries are not stable enough
  • Avoid snapshot-heavy testing
  • Use React Testing Library patterns consistently

Implementation notes

  • packages/shared-ui/package.json currently has no test script or Vitest config
  • We can reuse the React Testing Library dependency set already proven in pipeline-server
  • This is a good place to establish conventions for testing reusable UI primitives across the repo

Nice follow-up

If the setup works well, we can later use the same pattern for other reusable frontend packages too.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions