When to use this skill
Use this skill whenever the user wants to:
- Set up Cypress for end-to-end testing
- Write Cypress test cases
- Configure Cypress for component testing
- Integrate Cypress with CI/CD pipelines
- Use Cypress commands and assertions
- Debug Cypress tests
- Optimize Cypress test performance
- Migrate from other testing frameworks to Cypress
- Use Cypress with different frameworks (React, Vue, Angular, Svelte)
- Configure Cypress for different environments
How to use this skill
This skill is organized to match the Cypress official documentation structure (https://docs.cypress.io/app/get-started/why-cypress, https://docs.cypress.io/api/table-of-contents). When working with Cypress:
-
Identify the topic from the user's request:
- Getting Started/快速开始 →
examples/get-started/ - Core Concepts/核心概念 →
examples/core-concepts/ - Component Testing/组件测试 →
examples/component-testing/ - End-to-End Testing/E2E测试 →
examples/end-to-end-testing/ - Continuous Integration/持续集成 →
examples/continuous-integration/ - Guides/指南 →
examples/guides/ - References/参考 →
examples/references/ - API Reference/API 参考 →
api/
- Getting Started/快速开始 →
-
Load the appropriate example file from the
examples/directory:Getting Started (快速开始) -
examples/get-started/:examples/get-started/install-cypress.mdexamples/get-started/open-the-app.mdexamples/get-started/why-cypress.md
Core Concepts (核心概念) -
examples/core-concepts/:examples/core-concepts/best-practices.mdexamples/core-concepts/interacting-with-elements.mdexamples/core-concepts/introduction-to-cypress.mdexamples/core-concepts/open-mode.mdexamples/core-concepts/retry-ability.mdexamples/core-concepts/test-isolation.mdexamples/core-concepts/testing-types.mdexamples/core-concepts/variables-and-aliases.mdexamples/core-concepts/writing-and-organizing-tests.md
Component Testing (组件测试) -
examples/component-testing/:examples/component-testing/angular/api.mdexamples/component-testing/angular/examples.mdexamples/component-testing/angular/overview.mdexamples/component-testing/component-framework-configuration.mdexamples/component-testing/custom-frameworks.mdexamples/component-testing/get-started.mdexamples/component-testing/react/api.mdexamples/component-testing/react/examples.mdexamples/component-testing/react/overview.mdexamples/component-testing/styling-components.mdexamples/component-testing/svelte/api.mdexamples/component-testing/svelte/examples.mdexamples/component-testing/svelte/overview.mdexamples/component-testing/vue/api.mdexamples/component-testing/vue/examples.mdexamples/component-testing/vue/overview.md
End-to-End Testing (E2E测试) -
examples/end-to-end-testing/:examples/end-to-end-testing/testing-your-app.mdexamples/end-to-end-testing/writing-your-first-end-to-end-test.md
Continuous Integration (持续集成) -
examples/continuous-integration/:examples/continuous-integration/aws-codebuild.mdexamples/continuous-integration/bitbucket-pipelines.mdexamples/continuous-integration/circleci.mdexamples/continuous-integration/github-actions.mdexamples/continuous-integration/gitlab-ci.mdexamples/continuous-integration/overview.md
Guides (指南) -
examples/guides/:examples/guides/accessibility-testing.mdexamples/guides/authentication-testing/amazon-cognito-authentication.mdexamples/guides/authentication-testing/auth0-authentication.mdexamples/guides/authentication-testing/azure-active-directory-authentication.mdexamples/guides/authentication-testing/google-authentication.mdexamples/guides/authentication-testing/okta-authentication.mdexamples/guides/authentication-testing/social-authentication.mdexamples/guides/conditional-testing.mdexamples/guides/cross-browser-testing.mdexamples/guides/cross-origin-testing.mdexamples/guides/cypress-studio.mdexamples/guides/debugging.mdexamples/guides/migration/protractor-to-cypress.mdexamples/guides/migration/selenium-to-cypress.mdexamples/guides/network-requests.mdexamples/guides/screenshots-and-videos.mdexamples/guides/stubs-spies-and-clocks.mdexamples/guides/test-retries.md
References (参考) -
examples/references/:examples/references/advanced-installation.mdexamples/references/assertions.mdexamples/references/bundled-libraries.mdexamples/references/changelog.mdexamples/references/client-certificates.mdexamples/references/command-line.mdexamples/references/configuration.mdexamples/references/content-security-policy.mdexamples/references/environment-variables.mdexamples/references/error-messages.mdexamples/references/experiments.mdexamples/references/launching-browsers.mdexamples/references/migration-guide.mdexamples/references/module-api.mdexamples/references/proxy-configuration.mdexamples/references/recipes.mdexamples/references/roadmap.mdexamples/references/trade-offs.mdexamples/references/troubleshooting.md
Other Sections:
examples/faq.mdexamples/plugins/plugins-guide.mdexamples/plugins/plugins-list.mdexamples/tooling/IDE-integration.mdexamples/tooling/code-coverage.mdexamples/tooling/reporters.mdexamples/tooling/typescript-support.mdexamples/tooling/visual-testing.md
-
Reference API documentation in the
api/directory when needed:Commands API -
api/commands/:api/commands/and.mdapi/commands/as.mdapi/commands/blur.mdapi/commands/check.mdapi/commands/children.mdapi/commands/clear.mdapi/commands/clearallcookies.mdapi/commands/clearalllocalstorage.mdapi/commands/clearallsessionstorage.mdapi/commands/clearcookie.mdapi/commands/clearcookies.mdapi/commands/clearlocalstorage.mdapi/commands/click.mdapi/commands/clock.mdapi/commands/closest.mdapi/commands/contains.mdapi/commands/dblclick.mdapi/commands/debug.mdapi/commands/document.mdapi/commands/each.mdapi/commands/end.mdapi/commands/eq.mdapi/commands/exec.mdapi/commands/filter.mdapi/commands/find.mdapi/commands/first.mdapi/commands/fixture.mdapi/commands/focus.mdapi/commands/focused.mdapi/commands/get.mdapi/commands/getallcookies.mdapi/commands/getalllocalstorage.mdapi/commands/getallsessionstorage.mdapi/commands/getcookie.mdapi/commands/getcookies.mdapi/commands/go.mdapi/commands/hash.mdapi/commands/hover.mdapi/commands/intercept.mdapi/commands/invoke.mdapi/commands/its.mdapi/commands/last.mdapi/commands/location.mdapi/commands/log.mdapi/commands/mount.mdapi/commands/next.mdapi/commands/nextall.mdapi/commands/nextuntil.mdapi/commands/not.mdapi/commands/origin.md- ... and 43 more command files
Cypress API -
api/cypress-api/:api/cypress-api/arch.mdapi/cypress-api/browser.mdapi/cypress-api/catalog-of-events.mdapi/cypress-api/config.mdapi/cypress-api/cookies.mdapi/cypress-api/currentretry.mdapi/cypress-api/currenttest.mdapi/cypress-api/custom-commands.mdapi/cypress-api/custom-queries.mdapi/cypress-api/cypress-log.mdapi/cypress-api/dom.mdapi/cypress-api/element-selector-api.mdapi/cypress-api/ensure.mdapi/cypress-api/env.mdapi/cypress-api/isbrowser.mdapi/cypress-api/iscy.mdapi/cypress-api/keyboard-api.mdapi/cypress-api/platform.mdapi/cypress-api/require.mdapi/cypress-api/screenshot-api.mdapi/cypress-api/session.mdapi/cypress-api/spec.mdapi/cypress-api/stop.mdapi/cypress-api/testing-type.mdapi/cypress-api/version.md
Node Events API -
api/node-events/:api/node-events/after-run-api.mdapi/node-events/after-screenshot-api.mdapi/node-events/after-spec-api.mdapi/node-events/before-run-api.mdapi/node-events/before-spec-api.mdapi/node-events/browser-launch-api.mdapi/node-events/configuration-api.mdapi/node-events/overview.mdapi/node-events/preprocessors-api.md
Utilities API -
api/utilities/:api/utilities/$.mdapi/utilities/_.mdapi/utilities/blob.mdapi/utilities/buffer.mdapi/utilities/minimatch.mdapi/utilities/promise.mdapi/utilities/sinon.md
Table of Contents -
api/table-of-contents/: -
Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- All examples follow Cypress best practices
- Examples include both JavaScript and TypeScript versions where applicable
- Each example file includes parameters, returns, common errors, best practices, and scenarios
- Always check the example file for best practices and common patterns
-
Reference the official documentation when needed:
- Getting Started: https://docs.cypress.io/app/get-started/why-cypress
- API Reference: https://docs.cypress.io/api/table-of-contents
Best Practices
- Use data-cy attributes: Use data-cy attributes for stable, test-friendly selectors
- Avoid hard-coded waits: Leverage Cypress's built-in retry-ability instead of cy.wait()
- Keep tests isolated: Each test should be independent and not rely on other tests
- Use custom commands: Create custom commands for reusable test logic
- Follow assertion patterns: Use Cypress's built-in assertions for better error messages
- Configure properly: Set up cypress.config.js correctly for your project
- Use fixtures: Use fixtures for test data instead of hard-coding values
- Component testing: Use component testing for isolated component testing
- CI/CD integration: Configure Cypress properly for CI/CD environments
- Debug effectively: Use Cypress's debugging tools and commands
Resources
- Official Documentation: https://docs.cypress.io/
- Getting Started: https://docs.cypress.io/app/get-started/why-cypress
- API Reference: https://docs.cypress.io/api/table-of-contents
- GitHub Repository: https://github.com/cypress-io/cypress
Keywords
Cypress, end-to-end testing, E2E testing, component testing, test automation, browser testing, test framework, assertions, commands, fixtures, CI/CD, continuous integration, test runner, 端到端测试, E2E测试, 组件测试, 测试自动化, 浏览器测试, 测试框架, 断言, 命令, 固定数据, 持续集成, 测试运行器