agents-inc/skills/src/skills/web-testing-cypress-e2e/SKILL.md
web-testing-cypress-e2e
Cypress E2E testing patterns - test structure, data-cy selectors, cy.intercept() mocking, custom commands, fixtures, component testing, accessibility testing with cypress-axe, and CI/CD integration
- Source repository stars
- 23
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-08-09
- Source checked
- 2026-08-28
Decision brief
What it does: where it fits
Quick Guide: Use Cypress for end-to-end tests that verify complete user workflows. Use data-cy attributes for resilient selectors, cy.intercept() with aliases for deterministic API mocking (never arbitrary cy.wait(ms)), and cy.session() to cache authentication. Each it() block m…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/agents-inc/skills --skill "src/skills/web-testing-cypress-e2e"Inspect the Agent Skill "web-testing-cypress-e2e" from https://github.com/agents-inc/skills/blob/81d43a51211aca12c85dcc16085fa99014ec548e/src/skills/web-testing-cypress-e2e/SKILL.md at commit 81d43a51211aca12c85dcc16085fa99014ec548e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)
Testing critical user-facing workflows (login, checkout, form submission)Multi-step user journeys that span multiple pagesCross-browser compatibility testing - 02
Philosophy
Cypress E2E tests verify that your application works correctly from the user's perspective. They run in the same run-loop as your application, providing reliable, fast feedback on user-visible behavior.
Test user-visible behavior - Focus on what end users see and interact with, not implementation detailsUse resilient selectors - data-cy attributes are isolated from CSS/JS changes and won't break on refactoringIsolate tests completely - Each it() block must be independent; use beforeEach for common setup - 03
Core Patterns
Use describe to group related tests, context for different scenarios, and it for individual test cases. Named constants prevent magic strings. Each test starts fresh via beforeEach.
Use describe to group related tests, context for different scenarios, and it for individual test cases. Named constants prevent magic strings. Each test starts fresh via beforeEach.Why good: Logical grouping with describe/context, beforeEach ensures isolation, named constants, data-cy selectorsSee examples/core.md Pattern 1-2 for complete login flow and grouped test examples. - 04
Pattern 1: Test Structure and Organization
Use describe to group related tests, context for different scenarios, and it for individual test cases. Named constants prevent magic strings. Each test starts fresh via beforeEach.
Use describe to group related tests, context for different scenarios, and it for individual test cases. Named constants prevent magic strings. Each test starts fresh via beforeEach.Why good: Logical grouping with describe/context, beforeEach ensures isolation, named constants, data-cy selectorsSee examples/core.md Pattern 1-2 for complete login flow and grouped test examples. - 05
Pattern 2: Selector Strategies
Use data-cy attributes for reliable element selection. They survive CSS refactoring and make test intent clear.
Use data-cy attributes for reliable element selection. They survive CSS refactoring and make test intent clear.Use cy.getBySel() custom command to reduce boilerplate. See examples/core.md Pattern 3 and examples/custom-commands.md Pattern 1 for implementation.
Permission review
Static risk signals and limitations
Network access
The documentation includes network, browsing, or remote request actions.
"https://auth.provider.com",Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 23 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- agents-inc/skills
- Skill path
- src/skills/web-testing-cypress-e2e/SKILL.md
- Commit
- 81d43a51211aca12c85dcc16085fa99014ec548e
- License
- MIT
- Collected
- 2026-08-28
- Default branch
- main
View the original SKILL.md
Cypress E2E Testing Patterns
Quick Guide: Use Cypress for end-to-end tests that verify complete user workflows. Use data-cy attributes for resilient selectors, cy.intercept() with aliases for deterministic API mocking (never arbitrary cy.wait(ms)), and cy.session() to cache authentication. Each it() block must be independent. Cypress 15 is current stable; cy.origin() is mandatory for multi-origin tests.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST use data-cy attributes as your primary selector strategy - they are isolated from CSS/JS changes)
(You MUST use cy.intercept() with aliases and cy.wait("@alias") - NEVER use arbitrary cy.wait(ms) delays)
(You MUST isolate tests - each it() block runs independently without depending on other tests)
(You MUST use cy.origin() for any test that navigates across different origins - required since Cypress 14)
</critical_requirements>
Auto-detection: Cypress, cy.visit, cy.get, cy.intercept, cy.origin, cy.session, data-cy, describe, it, beforeEach, cy.fixture, cy.mount, cypress-axe, cy.env
When to use:
- Testing critical user-facing workflows (login, checkout, form submission)
- Multi-step user journeys that span multiple pages
- Cross-browser compatibility testing
- Testing real integration with backend APIs
- Component testing in isolation with cy.mount()
When NOT to use:
- Testing pure utility functions (use unit tests)
- API-only testing without UI (use direct API tests)
- Testing implementation details (tests become brittle on refactoring)
Key patterns covered:
- Test structure and organization (describe, context, it)
- Selector strategies with data-cy attributes
- Custom commands with TypeScript support
- Network mocking with cy.intercept()
- Fixtures and test data management
- Component testing with cy.mount()
- Accessibility testing with cypress-axe
- Multi-origin testing with cy.origin()
Detailed Resources:
- examples/core.md - User flows, test structure, selectors, assertions, aliases, sessions
- examples/intercept.md - API mocking, error states, request verification, response modification
- examples/custom-commands.md - Custom commands, TypeScript types, child/dual commands
- examples/fixtures-data.md - Fixtures, factories, test data constants
- examples/component-testing.md - Component testing with cy.mount()
- examples/accessibility.md - Accessibility testing with cypress-axe
- examples/ci-cd.md - GitHub Actions, Docker, parallel execution
- reference.md - Decision frameworks, anti-patterns, Cypress 14/15 changes
Philosophy
Cypress E2E tests verify that your application works correctly from the user's perspective. They run in the same run-loop as your application, providing reliable, fast feedback on user-visible behavior.
Core Principles:
- Test user-visible behavior - Focus on what end users see and interact with, not implementation details
- Use resilient selectors - data-cy attributes are isolated from CSS/JS changes and won't break on refactoring
- Isolate tests completely - Each it() block must be independent; use beforeEach for common setup
- Trust Cypress retry-ability - Commands automatically retry; never use arbitrary cy.wait(ms)
- Mock external dependencies - Use cy.intercept() for third-party APIs to ensure reliability
When E2E tests provide the most value:
- Critical business workflows (authentication, payments, core features)
- User journeys spanning multiple pages or components
- Testing real backend integration with one "true" E2E test per feature
- Cross-browser compatibility verification
When E2E tests may not be the best choice:
- Testing pure utility functions (unit tests are faster and more precise)
- Testing every edge case (balance with unit tests; use mocks for edge cases)
- Testing implementation details (tests become brittle and break on refactoring)
Core Patterns
Pattern 1: Test Structure and Organization
Use describe to group related tests, context for different scenarios, and it for individual test cases. Named constants prevent magic strings. Each test starts fresh via beforeEach.
const LOGIN_URL = "/login";
const DASHBOARD_URL = "/dashboard";
const VALID_EMAIL = "[email protected]";
describe("Login Flow", () => {
beforeEach(() => {
cy.visit(LOGIN_URL);
});
context("with valid credentials", () => {
it("redirects to dashboard after successful login", () => {
cy.get("[data-cy=email-input]").type(VALID_EMAIL);
// ...
cy.url().should("include", DASHBOARD_URL);
});
});
});
Why good: Logical grouping with describe/context, beforeEach ensures isolation, named constants, data-cy selectors
See examples/core.md Pattern 1-2 for complete login flow and grouped test examples.
Pattern 2: Selector Strategies
Use data-cy attributes for reliable element selection. They survive CSS refactoring and make test intent clear.
// BEST: data-cy attributes
cy.get("[data-cy=submit-button]").click();
// ACCEPTABLE: cy.contains() when text change should fail the test
cy.contains("button", "Submit").click();
// AVOID: CSS classes, IDs, DOM structure - all fragile
cy.get(".btn-primary").click(); // Breaks on styling changes
cy.get("div > button:nth-child(2)").click(); // Breaks on markup changes
Use cy.getBySel() custom command to reduce boilerplate. See examples/core.md Pattern 3 and examples/custom-commands.md Pattern 1 for implementation.
Pattern 3: Network Mocking with cy.intercept()
Mock API responses for deterministic, fast tests. Always alias intercepts and wait on the alias.
cy.intercept("GET", "/api/users", {
statusCode: 200,
body: MOCK_USER,
}).as("getUser");
cy.visit("/profile");
cy.wait("@getUser");
cy.getBySel("user-name").should("contain", MOCK_USER.name);
Why good: Tests are deterministic, alias + wait ensures request completed, no arbitrary delays
Test error states with status codes and forceNetworkError: true. See examples/intercept.md for error state testing, request verification, response modification, and pagination patterns.
Pattern 4: Custom Commands with TypeScript
Wrap common flows (login, selectors) in custom commands with type declarations for IDE autocomplete.
// cypress/support/commands.ts
Cypress.Commands.add("login", (email: string, password: string) => {
cy.session([email, password], () => {
cy.visit("/login");
cy.getBySel("email-input").type(email);
cy.getBySel("password-input").type(password);
cy.getBySel("submit-button").click();
cy.url().should("include", "/dashboard");
});
});
Type declarations go in cypress/support/index.d.ts. See examples/custom-commands.md for selector commands, auth commands with cacheAcrossSpecs, form commands, child/dual commands, database task commands, and cy.origin() commands.
Pattern 5: Fixtures and Test Data
Use fixtures for reusable test data, factories for dynamic data.
// Fixture: cy.intercept with fixture file
cy.intercept("GET", "/api/products", { fixture: "products.json" }).as(
"getProducts",
);
// Factory: dynamic data for specific scenarios
const users = createUsers(5);
cy.intercept("GET", "/api/users", { body: users }).as("getUsers");
Why good: Separates test data from test logic, fixtures are reusable, factories generate scenario-specific data
See examples/fixtures-data.md for organized fixture directories, factory patterns, and centralized test constants.
Pattern 6: Multi-Origin Testing with cy.origin()
Cypress 14+ requires cy.origin() for any test that navigates across different origins (scheme + hostname + port). This is mandatory for OAuth, SSO, and cross-domain workflows.
cy.visit("/login");
cy.getBySel("oauth-button").click();
cy.origin(
"https://auth.provider.com",
{ args: { email, password } },
({ email, password }) => {
cy.get("#email").type(email);
cy.get("#password").type(password);
cy.get("#submit").click();
},
);
cy.url().should("include", "/dashboard"); // Back on original origin
Why required: Chrome deprecated document.domain, which Cypress previously used for cross-origin testing.
See examples/custom-commands.md Pattern 7 for reusable OAuth command with session caching.
<red_flags>
RED FLAGS
High Priority Issues:
- Using
cy.wait(5000)with arbitrary milliseconds - causes flaky or slow tests, use cy.intercept() aliases instead - Using CSS selectors like
.btn-primaryor#submit-btn- fragile and break on refactoring, use data-cy - Tests that depend on previous tests - coupled tests fail randomly, each it() must be independent
- Storing values in
constfor later use - Cypress commands are async, use aliases with.as()instead - Not using
cy.origin()for multi-origin tests - required since Cypress 14 due to Chrome's deprecation of document.domain - Using deprecated
Cypress.env()- usecy.env()for secrets,Cypress.expose()for public values (deprecated in v15.10.0, removed in 16)
Medium Priority Issues:
- Not using beforeEach for common setup - leads to duplicated code and inconsistent state
- Overusing cy.contains() for selectors - text changes may not warrant test failure, prefer data-cy
- No network mocking for external APIs - third-party flakiness affects your tests
- Running only in one browser - cross-browser issues go undetected
- Using
Cypress.Commands.overwrite()for queries - useCypress.Commands.overwriteQuery()since Cypress 14
Common Mistakes:
- Hardcoded test data scattered throughout files - use fixtures and named constants
- Testing implementation details instead of user behavior - tests break on refactoring
- Using
after/afterEachfor cleanup - no guarantee it runs, put cleanup in beforeEach - Starting web server within tests with cy.exec() - server process never exits properly
Gotchas & Edge Cases:
- Cypress commands are chainable and async but don't return Promises - use
.then()for values - Fixture files are cached and won't reflect file changes during test - use cy.readFile() for dynamic files
cy.session()caches login state but clears on spec file change - usecacheAcrossSpecs: true(Cypress 12.4+)- cy.intercept() routes are global to test - reset in beforeEach to prevent pollution
- Parallel tests cannot share state - use fixtures and beforeEach for per-test setup
- Chrome 137+ no longer supports
--load-extensionin branded Chrome - use Electron, Chrome for Testing, or Chromium for extensions
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md
(You MUST use data-cy attributes as your primary selector strategy - they are isolated from CSS/JS changes)
(You MUST use cy.intercept() with aliases and cy.wait("@alias") - NEVER use arbitrary cy.wait(ms) delays)
(You MUST isolate tests - each it() block runs independently without depending on other tests)
(You MUST use cy.origin() for any test that navigates across different origins - required since Cypress 14)
Failure to follow these rules will result in flaky tests, false positives, and maintenance nightmares.
</critical_reminders>
Frequently asked questions
What to verify before installation and use
What does the web-testing-cypress-e2e source document cover?
Quick Guide: Use Cypress for end-to-end tests that verify complete user workflows. Use data-cy attributes for resilient selectors, cy.intercept() with aliases for deterministic API mocking (never arbitrary cy.wait(ms)), and cy.session() to cache authentication. Each it() block m…
How do I install web-testing-cypress-e2e?
The source record exposes this install command: npx skills add https://github.com/agents-inc/skills --skill "src/skills/web-testing-cypress-e2e". Inspect the command and pinned source before running it.
Which permission-related actions were detected?
Static rules flagged network in the source; the page lists the matching lines and excerpts.
Alternatives
Compare before choosing
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
narrative-io/narrative-skills-marketplace
design-analysis
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "
vasilyu1983/AI-Agents-public
qa-testing-ios
Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.
vasilyu1983/AI-Agents-public
foundations-consumer-neuroscience
Consumer-neuroscience primitives for attention, arousal, bonding, narrative, memory, and reward. Use when shaping ethical UX, neuro study design, or DMCC/AI Act gates.