cypress
БесплатноБез исполняемых скриптовНе проверенAssists with end-to-end testing of web applications using Cypress. Use when writing E2E tests, setting up component testing, configuring CI pipelines with…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Cypress
Overview
Cypress is an end-to-end testing framework for web applications that runs tests directly in the browser for fast, reliable feedback. It provides element selection, network interception, component testing, and CI integration with parallelization and video recording. This skill targets Cypress 16 (16.2.0 at the time of writing); notes mark what changed from 13-15.
Instructions
Install and configure
npm install --save-dev cypress
npx cypress open # first run: pick E2E or Component Testing, the launchpad creates the files
// cypress.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.cy.{js,ts}',
setupNodeEvents(on, config) {
on('task', {
// runs in Node: use it for DB seeding instead of cy.exec (removed in 16)
'db:seed': (name: string) => seedDatabase(name),
})
return config
},
},
expose: { apiVersion: 'v2' }, // public values, read with Cypress.expose('apiVersion')
video: false, // default; set true to record cypress run videos
})
- Cypress 16 needs Node.js 22, 24 or 26+ (Node 18 and 20 were dropped in 15 and 16). Install through a package manager; the direct-download installer was removed in 15.
Cypress.env()and theallowCypressEnvoption were removed in 16. Put public values in the top-levelexposeblock and read them withCypress.expose('apiVersion'). Read secrets (tokens, passwords) with the asynchronouscy.env(['apiToken']).then(({ apiToken }) => ...). The Command Log shows only the variable names, never the values.cy.exec()andexecTimeoutwere removed in 16: register acy.task()insetupNodeEventsand usetaskTimeout.cy.end()was also removed; delete those calls.testIsolationis on by default: the page, cookies and storage are cleared before every test, so each test must visit and log in itself.
Write tests
- Select with
data-cyordata-testidattributes:cy.get("[data-cy='submit']"). Since 16.2 you can also query by accessible role:cy.getByRole('tab', { name: 'Billing' }). - Use
.type(),.click(),.select(),.check()for actions and chain.should()for outcomes; assertions retry until they pass or time out (default 4000 ms). - Stub or spy with
cy.intercept()andcy.wait('@alias'); nevercy.wait(ms). Chrome, Chromium and Edge use native network interception in 16 (req.httpVersionis no longer reported; setforceHttp1to fall back). - Cache logins with
cy.session()inside a custom command rather than logging in through the UI before every test. - Add custom commands with
Cypress.Commands.add()incypress/support/commands.tsand declare them in theChainableinterface for TypeScript.
Component testing
Cypress ships its own mount adapters, so you do not install @cypress/react or @cypress/vue separately (@cypress/react18 is deprecated). React 18/19 with Vite 8+, Webpack or Next.js 15.0.4+ is supported (Vite 5-7 and Next.js 14 were dropped in 16).
// cypress/support/component.ts
import { mount } from 'cypress/react'
import './commands'
declare global {
namespace Cypress {
interface Chainable { mount: typeof mount }
}
}
Cypress.Commands.add('mount', mount)
// cypress.config.ts (component part)
component: { devServer: { framework: 'react', bundler: 'vite' } },
For Vue import mount from cypress/vue; for Angular import it from cypress/angular, which needs Angular 21+ in Cypress 16.
CI
npx cypress run --browser chrome # headless, all specs
npx cypress run --component # component specs
npx cypress run --record --key "$CYPRESS_RECORD_KEY" --parallel --ci-build-id "$GITHUB_RUN_ID"
--record, --parallel and --ci-build-id need a Cypress Cloud project; without Cloud, split specs across jobs with --spec. Use the official cypress-io/github-action on GitHub Actions to install, cache the binary and start the server.
Examples
Example 1: Write E2E tests for a checkout flow
User request: "Add Cypress tests for our e-commerce checkout process"
// cypress/e2e/checkout.cy.ts
describe('checkout', () => {
beforeEach(() => {
cy.intercept('POST', '/api/cart', { statusCode: 201, fixture: 'cart.json' }).as('addToCart')
cy.intercept('POST', '/api/orders', { statusCode: 201, body: { id: 'ord_1042' } }).as('placeOrder')
cy.visit('/products/trail-runner-2')
})
it('places an order and shows the confirmation', () => {
cy.get("[data-cy='add-to-cart']").click()
cy.wait('@addToCart')
cy.visit('/checkout')
cy.get("[data-cy='email']").type('[email protected]')
cy.get("[data-cy='address']").type('18 Harbor Street, Portland')
cy.get("[data-cy='place-order']").click()
cy.wait('@placeOrder').its('request.body').should('have.property', 'email')
Установить cypress в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cypress?
Assists with end-to-end testing of web applications using Cypress. Use when writing E2E tests, setting up component testing, configuring CI pipelines with parallelization, or building custom test commands. Trigger words: cypress, e2e testing, end-to-end, cypress run, cy.get, integration testing, browser testing.
Как установить скилл cypress?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cypress запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic