502
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill citypaul/.dotfiles --skill front-end-testing- SKILL.md20.2 KB
Overview
This skill teaches framework-agnostic DOM Testing Library patterns for behavior-driven UI testing across React, Vue, Svelte, and plain DOM apps. It focuses on testing what users see and do, not implementation details, so tests survive refactors and catch real bugs. Use the patterns to write accessible, reliable, and maintainable front-end tests.
How this skill works
The skill describes query selection priority (role, label, placeholder, text, etc.), async utilities (findBy, waitFor, waitForElementToBeRemoved), and realistic user simulation with userEvent.setup(). It also covers MSW integration for network-level API mocking and when to prefer fireEvent. Examples show concrete patterns to assert user-visible behavior and avoid brittle implementation-based assertions.
When to use it
- Testing interactive UI behavior (clicks, typing, keyboard navigation)
- Verifying async flows like loading states and API-driven renders
- Ensuring accessible markup and ARIA-backed components
- Mocking network responses consistently across tests with MSW
- When you want tests that survive refactors of state or implementation
Best practices
- Query by accessibility first: getByRole, getByLabelText, then fallbacks
- Use userEvent.setup() per test to simulate realistic user interactions
- Prefer findBy for waiting for elements and waitFor for complex assertions
- Avoid getByTestId except as last resort; don’t assert non-existence with getBy*
- Keep waitFor callbacks as pure assertions (no side effects)
Example use cases
- Submit a form by typing into labeled inputs and clicking the submit role button
- Wait for an API-driven list to render using MSW and assert listitem count
- Test a debounced search input by typing and awaiting suggestion items with findBy
- Assert a modal opens/closes by querying dialog role and using waitForElementToBeRemoved
- Validate keyboard interactions using userEvent.keyboard for accessibility tests
FAQ
Use findBy when waiting for a single element to appear after an async change. Use waitFor for more complex conditions or assertions involving multiple elements or non-queryable state.
Why prefer userEvent over fireEvent?
userEvent simulates the full interaction sequence (focus, input, click, blur) and timing, catching issues fireEvent can miss. Use fireEvent only when userEvent lacks support for a specific low-level event.