End-to-end testing focused on real user behavior, minimal mocking, and avoiding component unit tests.
Works with
Prioritizes E2E tests over unit tests; reserves unit tests for pure functions only
Emphasizes accessible selectors (role-based, label-based) over CSS selectors and test IDs in E2E tests
Recommends writing E2E tests instead of heavily mocked unit tests; suggests 3+ mocks as a signal to switch approaches
Includes rules for test structure, selector strategy, and when to apply each te
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionfrontend-testing-best-practicesExecute the skills CLI command in your project's root directory to begin installation:
Fetches frontend-testing-best-practices from sergiodxa/agent-skills 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 frontend-testing-best-practices. Access via /frontend-testing-best-practices 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
1
total installs
1
this week
82
GitHub stars
0
upvotes
Run in your terminal
1
installs
1
this week
82
stars
Guidelines for writing effective, maintainable tests that provide real confidence. Contains 6 rules focused on preferring E2E tests, minimizing mocking, and testing behavior over implementation.
Reference these guidelines when:
Default to E2E tests. Only write unit tests for pure functions.
// E2E test (PREFERRED) - tests real user flow
test("user can place an order", async ({ page }) => {
await createTestingAccount(page, { account_status: "active" });
await page.goto("/catalog");
await page.getByRole("heading", { name: "Example Item" }).click();
await page.getByRole("link", { name: "Buy" }).click();
// ... complete flow
await expect(page.getByAltText("Thank you")).toBeVisible();
});
// Unit test - ONLY for pure functions
test("formatCurrency formats with two decimals", () => {
expect(formatCurrency(1234.5)).toBe("$1,234.50");
});
Don't unit test React components. Test them through E2E or not at all.
// BAD: Component unit test
describe("OrderCard", () => {
test("renders amount", () => {
render(<OrderCard amount={100} />);
expect(screen.getByText("$100")).toBeInTheDocument();
});
});
// GOOD: E2E test covers the component naturally
test("order history shows orders", async ({ page }) => {
await page.goto("/orders");
await expect(page.getByText("$100")).toBeVisible();
});
Keep mocks simple. If you need 3+ mocks, write an E2E test instead.
// BAD: Too many mocks = write E2E test
vi.mock("~/lib/auth");
vi.mock("~/lib/transactions");
vi.mock("~/hooks/useAccount");
// GOOD: Simple MSW mock for loader test
mockServer.use(
http.get("/api/user", () => HttpResponse.json({ name: "John" })),
);
E2E tests go in e2e/tests/, not frontend/.
// e2e/tests/order.spec.ts
import { test, expect } from "@playwright/test";
import { addAccountBalance, createTestingAccount } from "./utils";
test.describe("Orders", () => {
test.beforeEach(async ({ page, context }) => {
await createTestingAccount(page, { account_status: "active" });
let cookies = await context.cookies();
let account_id = cookies.find((c) => c.name === "account_id").value;
await addAccountBalance({ account_id, amount: 10000, replaceBalance: true });
});
test("place order with default values", async ({ page }) => {
await page.goto("/catalog");
// ... user flow
});
});
Use accessible selectors: role > label > text > testid.
// GOOD: Role-based (preferred)
await page.getByRole("button", { name: "Submit" }).click();
await page.getByRole("heading", { name: "Dashboard" });
// GOOD: Label-based
await page.getByLabel("Email").fill("[email protected]");
// OK: Test ID when no accessible selector exists
await expect(page.getByTestId("balance")).toHaveText("$1,234");
// BAD: CSS selectors
await page.locator(".btn-primary").click();
Unit tests for pure functions only. Co-locate with source files.
// app/utils/format.test.ts
import { describe, test, expect } from "vitest";
import { formatCurrency } from "./format";
describe("formatCurrency", () => {
test("formats positive amounts", () => {
expect(formatCurrency(1234.5)).toBe("$1,234.50")Implementation Guide
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
- 1Install skill using provided installation command
- 2Test with simple use case relevant to your work
- 3Evaluate output quality and relevance
- 4Iterate on prompts to improve results
- 5Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This
✓ 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.
Learning Path
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Related Skills
react-vite-best-practices
58asyrafhussin/agent-skills
Frontend2 shared tagstypescript-best-practices
164jwynia/agent-skills
Backend2 shared tagsnestjs-best-practices
76kadajett/agent-nestjs-skills
Productivity2 shared tagsfrontend-design
662anthropics/claude-code
Frontendtag: frontendpremium-frontend-ui
236github/awesome-copilot
Frontendtag: frontendfrontend-ui-ux
99code-yeongyu/oh-my-opencode
Frontendtag: frontendReviews
4.8★★★★★52 reviews- LLucas Rahman★★★★★Dec 28, 2024
frontend-testing-best-practices fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- AAisha Sethi★★★★★Dec 28, 2024
Keeps context tight: frontend-testing-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.
- CCamila Johnson★★★★★Dec 24, 2024
frontend-testing-best-practices has been reliable in day-to-day use. Documentation quality is above average for community skills.
- GGanesh Mohane★★★★★Dec 20, 2024
Solid pick for teams standardizing on skills: frontend-testing-best-practices is focused, and the summary matches what you get after install.
- LLayla Reddy★★★★★Dec 16, 2024
Registry listing for frontend-testing-best-practices matched our evaluation — installs cleanly and behaves as described in the markdown.
- MMaya Martin★★★★★Dec 16, 2024
We added frontend-testing-best-practices from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- AAisha Shah★★★★★Nov 19, 2024
frontend-testing-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- IIsabella Garcia★★★★★Nov 19, 2024
We added frontend-testing-best-practices from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- MMaya White★★★★★Nov 7, 2024
Useful defaults in frontend-testing-best-practices — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- DDiego White★★★★★Oct 26, 2024
I recommend frontend-testing-best-practices for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
showing 1-10 of 52
1 / 6Discussion
Comments — not star reviews- No comments yet — start the thread.