Skip to content

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

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-react-testing-library-coverage
Draft

test(shared-ui): add React Testing Library coverage#563
Copilot wants to merge 3 commits intomainfrom
copilot/add-react-testing-library-coverage

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

packages/shared-ui had no test infrastructure despite being a shared primitive library consumed across the monorepo. This adds a jsdom/RTL browser-test setup mirroring the pattern already established in pipeline-server.

Setup

  • Added vitest, @testing-library/react, @testing-library/jest-dom, @testing-library/user-event, jsdom to devDependencies (all from existing catalog:test)
  • vitest.config.ts defines a single shared-ui-browser project using jsdom, auto-discovered by the root workspace config
  • test/browser/setup.ts registers jest-dom matchers, cleanup, matchMedia polyfill, and IS_REACT_ACT_ENVIRONMENT

Tests (38 total)

  • button — render, click, disabled, all 6 variants, 4 sizes
  • input — render, type, onChange, disabled, password type, placeholder, custom attributes
  • badge — render, default span tag, render prop polymorphism, all 6 variants
  • dialog — closed state, open via trigger, close button, footer children, showCloseButton={false}

Tests use semantic queries throughout (getByRole, getByLabelText, getByPlaceholderText); data-testid is not used in any of these components.

Original prompt

This section details on the original issue you should resolve

<issue_title>test(shared-ui): add React Testing Library coverage</issue_title>
<issue_description>## 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.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add React Testing Library coverage for shared-ui test(shared-ui): add React Testing Library coverage Mar 21, 2026
Copilot AI requested a review from luxass March 21, 2026 11:03
@github-actions
Copy link
Contributor

🌏 Preview Deployments

Application Status Preview URL
API ⏳ In Progress N/A
Store ⏳ In Progress N/A
Website ⏳ In Progress N/A
Documentation ⏳ In Progress N/A

Built from commit: edac74ea69354cf0d772eeacc4a1b3fff74d02eb


🤖 This comment will be updated automatically when you push new commits to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants