Install: npm install --save-dev @testing-library/react @testing-library/dom. Recommended extras: @testing-library/user-event and @testing-library/jest-dom. React 19 requires v16.1.0+.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionreact-testing-libraryExecute the skills CLI command in your project's root directory to begin installation:
Fetches react-testing-library from itechmeat/llm-code and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate react-testing-library. Access via /react-testing-library in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
12
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
12
stars
| Topic | Link |
|---|---|
| Queries | references/queries.md |
| User Events | references/user-events.md |
| API | references/api.md |
| Async | references/async.md |
| Debugging | references/debugging.md |
| Config | references/config.md |
Install: npm install --save-dev @testing-library/react @testing-library/dom. Recommended extras: @testing-library/user-event and @testing-library/jest-dom. React 19 requires v16.1.0+.
"The more your tests resemble the way your software is used, the more confidence they can give you."
Avoid testing:
Test instead:
Use queries in this order of preference:
// Best — by ARIA role
getByRole("button", { name: /submit/i });
getByRole("textbox", { name: /email/i });
// Form fields — by label
getByLabelText("Email");
// Non-interactive content — by text
getByText("Welcome back!");
// Images
getByAltText("Company logo");
// Title attribute (less reliable)
getByTitle("Close");
// Only when other queries don't work
getByTestId("custom-element");
| Type | No Match | 1 Match | >1 Match | Async |
|---|---|---|---|---|
getBy... |
throw | return | throw | No |
queryBy... |
null | return | throw | No |
findBy... |
throw | return | throw | Yes |
getAllBy... |
throw | array | array | No |
queryAllBy... |
[] | array | array | No |
findAllBy... |
throw | array | array | Yes |
When to use:
getBy* — element existsqueryBy* — element may not exist (assertions like expect(...).not.toBeInTheDocument())findBy* — element appears asynchronouslyimport { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
test("shows greeting after login", async () => {
const user = userEvent.setup();
render(<App />);
// Act — simulate user interactions
await user.type(screen.getByLabelText(/username/i), "john");
await user.click(screen.getByRole("button", { name: /login/i }));
// Assert — verify outcome
expect(await screen.findByText(/welcome, john/i)).toBeInTheDocument();
});
Always use @testing-library/user-event over fireEvent:
import userEvent from "@testing-library/user-event";
test("user interactions", async () => {
const user = userEvent.setup();
// Click
await user.click(element);
await user.dblClick(element);
await user.tripleClick(element);
// Type
await user.type(input, "Hello");
await user.clear(input);
// Select
await user.selectOptions(select, ["option1", "option2"]);
// Keyboard
await user.keyboard("{Enter}");
await user.keyboard("[ShiftLeft>]a[/ShiftLeft]"); // Shift+A
// Clipboard
await user.copy();
await user.paste();
// Pointer
await user.hover(element);
await user.unhover(element);
});
await waitFor(() => {
expect(screen.getByText("Loaded")).toBeInTheDocument();
});
// With options
await waitFor(() => expect(callback).toHaveBeenCalled(), {
timeout: 5000,
interval: 100,
});
// Equivalent to: await waitFor(() => getByText('Loaded'))
const element = await screen.findByText("Loaded");
await waitForElementToBeRemoved(() => screen.queryByText("Loading..."));
// test-utils.tsx
import { render } from "@testing-library/react";
import { ThemeProvider } from "./ThemeProvider";
import { AuthProvider } from "./AuthProvider";
function AllProviders({ children }) {
return (
<ThemeProvider>
<AuthProvider>{children}Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
asyrafhussin/agent-skills
anthropics/claude-code
mblode/agent-skills
github/awesome-copilot
leonxlnx/taste-skill
sickn33/antigravity-awesome-skills
Keeps context tight: react-testing-library is the kind of skill you can hand to a new teammate without a long onboarding doc.
Registry listing for react-testing-library matched our evaluation — installs cleanly and behaves as described in the markdown.
react-testing-library is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Useful defaults in react-testing-library — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
react-testing-library reduced setup friction for our internal harness; good balance of opinion and flexibility.
Keeps context tight: react-testing-library is the kind of skill you can hand to a new teammate without a long onboarding doc.
I recommend react-testing-library for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Keeps context tight: react-testing-library is the kind of skill you can hand to a new teammate without a long onboarding doc.
Useful defaults in react-testing-library — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Registry listing for react-testing-library matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 49