test(ui): add Vitest + RTL component test infrastructure#1249
test(ui): add Vitest + RTL component test infrastructure#1249kovtcharov-amd wants to merge 2 commits into
Conversation
|
This PR delivers exactly what the Agent UI needed: a real test stack with 15 well-structured tests covering utilities, rendering, and user interaction — and Issues🟡 No CI step — tests won't run on PRsThe new Add a job or step to Or, inline into the existing 🟡 Version jump in lockfile looks unintended
🟢
|
|
Solid infrastructure addition — test runner, DOM assertions, and future API-mocking layer are all wired up correctly. Fifteen tests pass, CI is integrated into the summary gate, and the existing build is unaffected. Nothing blocking; a couple of small observations below. Issues Found🟢
🟢
Strengths
VerdictApprove. No blocking issues. The |
|
The 6 Electron test failures (, , , etc.) are pre-existing broken assertions from the #606 UX rework — not caused by this PR's Vitest changes. They trigger because this PR touches \ which is in the Electron workflow's path filter. PR #1255 fixes the remaining stale Electron assertions — once it merges and this PR rebases, the failures will resolve. |
itomek
left a comment
There was a problem hiding this comment.
The stack is wired up correctly: test-webui-vitest runs npm ci && npm test and feeds the Test Summary gate, vitest.config.ts uses globals: false with an explicit afterEach(cleanup) in setup.ts, and APP_VERSION is defined so getEnvironmentInfo() won't throw under jsdom. The 15 tests assert real rendered output and user interaction against the actual exported component API — not tautologies. Verified the imported symbols (getUnsupportedCategory, isExtensionSupported, UnsupportedFeatureBanner, UploadErrorToast) all exist and are exported. Two non-blocking items inline (the 0.17.6->0.19.0 lockfile bump riding along; ErrorReportBanner untested). Approving.
Generated by Claude Code
There was a problem hiding this comment.
package.json/package-lock.json carry a 0.17.6 -> 0.19.0 version bump (skipping 0.18.x) in a test-infra PR. Confirm it's intentional / rebased from a release bump, or split it out, so the lockfile churn isn't mis-attributed to this PR. Non-blocking.
Generated by Claude Code
There was a problem hiding this comment.
ErrorReportBanner is a fourth exported component with no coverage. A one-line smoke test (renders the message + the "Report it on GitHub" link) would round out the suite while the stack is fresh. Optional.
Generated by Claude Code
The Agent UI had zero component test infrastructure — no test runner, no DOM assertions, no API mocking. This adds the full foundation so future component tests can be written: - vitest + jsdom + @testing-library/react + user-event + jest-dom + msw - vitest.config.ts with jsdom environment and CSS support - src/test/setup.ts for jest-dom matcher registration - 15 passing tests against UnsupportedFeature (utility + render + interaction)
- Add test-webui-vitest job to test_electron.yml so Vitest tests gate PRs - Switch globals: true → globals: false (explicit imports are already used) - Register afterEach cleanup in setup.ts (required when globals are off)
44c0c5a to
46d8417
Compare
The Agent UI frontend had zero component-level test infrastructure — no test runner, no DOM assertions, no API mocking layer. Contributors adding or modifying React components had no way to write automated tests. Now
npm testruns 15 passing tests in under 5 seconds, and the full Vitest + React Testing Library + MSW stack is ready for future component coverage.Test plan
cd src/gaia/apps/webui && npm install && npm test— 15 tests passnpm run test:watch— watch mode starts correctlynpm run build— production build still works (no test deps leak into bundle)Closes #882