cypress-testing
БесплатноБез исполняемых скриптовНе проверенUse for any question or task about Cypress tests, including quick how-to questions and one pasted test to fix: stubbing API calls with cy.intercept, replacing…
от testland★ 18 звёзд на GitHubОб этом скилле
cypress-testing
Overview
Per cy-overview:
"Cypress is described as 'a next generation front end testing tool built for the modern web.'"
Differentiators (cy-overview):
- Time Travel Debugging: "Cypress takes snapshots as your tests run. Hover over commands in the Command Log to see exactly what happened at each step."
- Automatic Waiting: "Never add waits or sleeps to your tests. Cypress automatically waits for commands and assertions before moving on."
- Reliability: "The testing approach avoids Selenium/WebDriver architecture, resulting in fast, consistent and reliable tests that are flake-free."
When to use
- The team has invested in Cypress; a migration is unlikely.
- The test author values the time-travel debugger / GUI experience.
- Component testing is needed (Cypress supports React / Angular / Vue / Svelte component testing).
- Single-browser focus is acceptable (Chromium-first; Firefox / Edge supported but secondary).
For cross-browser including WebKit, see
playwright-testing.
How to use
- Install Cypress and scaffold the project (
npm install --save-dev cypress,npx cypress open). - Set
baseUrl,specPattern, andretriesincypress.config.ts. - Add
@testing-library/cypressso specs select by role / label, not by CSS class. - Author each flow as a
describe/itblock; lean on auto-waiting assertions instead ofcy.wait(ms). - Extract repeated auth into a
cy.session-backed custom command called frombeforeEach. - Stub or wait on network calls with
cy.intercept+cy.wait('@alias')instead of fixed sleeps. - Seed data with
cy.task, load canned responses with fixtures, freeze time withcy.clock. - Drive a login on another origin (SSO, auth subdomain) inside
cy.origin. - Run headless in CI (
npx cypress run); debug failures by replaying commands in the time-travel GUI. - For scale, record + parallelize via Cypress Cloud and upload screenshot artifacts on failure (see references/ci-and-cloud.md).
Step 1 - Install
npm install --save-dev cypress
npx cypress open # first run scaffolds the project
The interactive setup creates cypress.config.ts + cypress/
directory.
Per the changelog, Cypress 16.0.0 (Sep 1, 2026) "requires Node.js 22.x, 24.x, or >=26.x". Upgrading a 15.x suite? See "Upgrading to Cypress 16" below before bumping the version.
Step 2 - Configure
// cypress.config.ts
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.cy.{ts,tsx}',
video: true,
screenshotOnRunFailure: true,
retries: { runMode: 2, openMode: 0 },
},
component: {
devServer: {
framework: 'react',
bundler: 'vite',
},
},
});
Step 3 - Author E2E tests
// cypress/e2e/checkout.cy.ts
describe('Checkout flow', () => {
beforeEach(() => {
cy.visit('/login');
cy.get('[data-testid="email"]').type('[email protected]');
cy.env(['USER_PASSWORD']).then(({ USER_PASSWORD }) => {
cy.get('[data-testid="password"]').type(USER_PASSWORD, { log: false });
});
cy.get('[data-testid="signin-btn"]').click();
cy.contains('Welcome').should('be.visible');
});
it('completes checkout end-to-end', () => {
cy.visit('/products/BOOK-001');
cy.contains('button', /add to cart/i).click();
cy.get('[data-testid="cart-count"]').should('have.text', '1');
cy.visit('/checkout');
cy.env(['TEST_CARD_NUMBER']).then(({ TEST_CARD_NUMBER }) => {
cy.get('[name="card"]').type(TEST_CARD_NUMBER, { log: false });
});
cy.contains('button', /place order/i).click();
cy.contains('Order confirmed', { timeout: 10000 }).should('be.visible');
});
});
Per cy-overview, assertions auto-wait - no cy.wait(2000)
needed.
Never type a password or card number as a literal. Per cy-env,
cy.env() (Cypress 15.10+) yields the requested keys, and per
cy-env-guide Cypress strips the CYPRESS_ prefix, so CI
sets CYPRESS_USER_PASSWORD from its secret store. { log: false }
keeps the value out of the Command Log.
Step 4 - Use cypress-testing-library
For accessibility-first selectors:
npm install --save-dev @testing-library/cypress
// cypress/support/commands.ts
import '@testing-library/cypress/add-commands';
// Now in tests:
cy.findByRole('button', { name: /sign in/i }).click();
cy.findByLabelText('Email').type('[email protected]');
findByRole (from cypress-testing-library) is the Cypress
equivalent of Playwright's getByRole - preferred for
Установить cypress-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cypress-testing?
Use for any question or task about Cypress tests, including quick how-to questions and one pasted test to fix: stubbing API calls with cy.intercept, replacing cy.wait sleeps with assertions, tests that pass locally but fail in CI, fixtures and cy.task, cy.clock, cy.origin and cy.session logins, cypress.config.ts, the Cypress 16 upgrade and Cloud parallel runs.
Как установить скилл cypress-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cypress-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic