cypress について
cypressは、ドキュメントの例やAPIリファレンスを使ってCypressの利用を支援するスキルです。E2Eテストとコンポーネントテストの導入、作成、設定、デバッグ、移行を扱います。
主な機能
- 01Cypressの導入と設定
- 02E2Eテストの作成
- 03コンポーネントテストの案内
- 04CI/CD連携の案内
- 05デバッグと性能改善の助言
- 06他のテストフレームワークからの移行
活用シーン
- 01プロジェクトへのCypress導入
- 02ブラウザーE2Eテストの作成
- 03対応フレームワークでのコンポーネントテスト
- 04失敗したテストの原因調査
- 05他のフレームワークからのテスト移行
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ full-stack-skills/ testing-skills --skill cypressインストール後、Claude Code で/cypressを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
agents/openai.yamlapi/commands/and.mdas.mdblur.mdcheck.mdchildren.mdclear.mdclearallcookies.mdclearalllocalstorage.mdclearallsessionstorage.mdclearcookie.mdclearcookies.mdclearlocalstorage.mdclick.mdclock.mdclosest.mdcontains.mddblclick.mddebug.mddocument.mdeach.mdend.mdeq.mdexec.mdfilter.mdfind.mdfirst.mdfixture.mdfocus.mdfocused.md詳細
このスキルを使用する場面
次のような要望がある場合は、いつでもこのスキルを使用してください。
- エンドツーエンドテスト用に Cypress をセットアップする
- Cypress のテストケースを作成する
- コンポーネントテスト用に Cypress を設定する
- Cypress を CI/CD パイプラインに統合する
- Cypress のコマンドとアサーションを使用する
- Cypress のテストをデバッグする
- Cypress のテストパフォーマンスを最適化する
- 他のテストフレームワークから Cypress に移行する
- さまざまなフレームワーク(React、Vue、Angular、Svelte)で Cypress を使用する
- さまざまな環境用に Cypress を設定する
このスキルの使用方法
このスキルは、Cypress の公式ドキュメントの構成(https://docs.cypress.io/app/get-started/why-cypress、https://docs.cypress.io/api/table-of-contents)に合わせて整理されています。Cypress を使用する場合:
-
ユーザーのリクエストからトピックを特定します。
- はじめに →
examples/get-started/ - コアコンセプト →
examples/core-concepts/ - コンポーネントテスト →
examples/component-testing/ - エンドツーエンドテスト →
examples/end-to-end-testing/ - 継続的インテグレーション →
examples/continuous-integration/ - ガイド →
examples/guides/ - リファレンス →
examples/references/ - API リファレンス →
api/
- はじめに →
-
examples/ディレクトリから適切なサンプルファイルを読み込みます。はじめに -
examples/get-started/:examples/get-started/install-cypress.mdexamples/get-started/open-the-app.mdexamples/get-started/why-cypress.md
コアコンセプト -
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
コンポーネントテスト -
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
エンドツーエンドテスト -
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
継続的インテグレーション -
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ガイド(指南) -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
リファレンス(参考) -
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
その他のセクション:
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
-
必要に応じて、
api/ディレクトリの API リファレンスドキュメントを参照してください。 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- ... その他 43 個のコマンドファイル
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
目次 -
api/table-of-contents/: -
構文、構造、ベストプラクティスについては、そのサンプルファイル内の具体的な指示に従ってください
重要な注意事項:
- すべてのサンプルは Cypress のベストプラクティスに従っています
- サンプルには、該当する場合は JavaScript 版と TypeScript 版の両方が含まれます
- 各サンプルファイルには、パラメーター、戻り値、一般的なエラー、ベストプラクティス、シナリオが含まれています
- ベストプラクティスと一般的なパターンについては、必ずサンプルファイルを確認してください
-
必要に応じて公式ドキュメントを参照してください:
ベストプラクティス
- data-cy 属性を使用する:安定したテスト向けのセレクターには、data-cy 属性を使用します
- 固定の待機を避ける:cy.wait() を使う代わりに、Cypress に組み込まれたリトライ機能を活用します
- テストを分離する:各テストは独立して実行でき、ほかのテストに依存しないようにします
- カスタムコマンドを使用する:再利用可能なテストロジックには、カスタムコマンドを作成します
- アサーションのパターンに従う:エラーメッセージを分かりやすくするため、Cypress に組み込まれたアサーションを使用します
- 適切に設定する:プロジェクトに合わせて cypress.config.js を正しく設定します
- フィクスチャを使用する:値をハードコーディングする代わりに、テストデータにはフィクスチャを使用します
- コンポーネントテスト:コンポーネントを個別にテストするには、コンポーネントテストを使用します
- CI/CD との統合:CI/CD 環境に合わせて Cypress を適切に設定します
- 効果的にデバッグする:Cypress のデバッグツールとコマンドを使用します
リソース
- 公式ドキュメント:https://docs.cypress.io/
- はじめに:https://docs.cypress.io/app/get-started/why-cypress
- API リファレンス:https://docs.cypress.io/api/table-of-contents
- GitHub リポジトリ:https://github.com/cypress-io/cypress
キーワード
Cypress、エンドツーエンドテスト、E2E テスト、コンポーネントテスト、テスト自動化、ブラウザテスト、テストフレームワーク、アサーション、コマンド、フィクスチャ、CI/CD、継続的インテグレーション、テストランナー、端から端までのテスト、E2E テスト、コンポーネントテスト、テスト自動化、ブラウザテスト、テストフレームワーク、アサーション、コマンド、固定データ、継続的インテグレーション、テストランナー