jpskill.com
🛠️ 開発・MCP コミュニティ

cypress

Cypressを使ったWebアプリケーションのE2Eテストを支援し、テスト作成、CIパイプライン構築、カスタムコマンド作成などを通して、効率的なブラウザテスト環境を構築するSkill。

📜 元の英語説明(参考)

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を使ったWebアプリケーションのE2Eテストを支援し、テスト作成、CIパイプライン構築、カスタムコマンド作成などを通して、効率的なブラウザテスト環境を構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o cypress.zip https://jpskill.com/download/14808.zip && unzip -o cypress.zip && rm cypress.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14808.zip -OutFile "$d\cypress.zip"; Expand-Archive "$d\cypress.zip" -DestinationPath $d -Force; ri "$d\cypress.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して cypress.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → cypress フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Cypress

概要

Cypress は、高速で信頼性の高いフィードバックを得るために、ブラウザで直接テストを実行する Web アプリケーション向けのエンドツーエンドテストフレームワークです。要素の選択、ネットワーク傍受、コンポーネントテスト、並列化とビデオ録画による CI 統合を提供します。

手順

  • 要素を選択する際は、CSS クラスや ID の代わりに、data-testid または data-cy 属性を cy.get("[data-testid='submit']") のように使用して、回復力のあるセレクターを実現します。
  • インタラクションをテストする際は、ユーザーアクションに対して cy.get().type().click().select().check() を使用し、期待される結果に対して .should() アサーションをチェーンします。
  • API 呼び出しを処理する際は、cy.intercept() を使用して、fixture で外部 API をスタブ化するか、リクエストをスパイし、cy.wait(ms) の代わりに、呼び出しをトリガーするアクションの後に cy.wait("@alias") を使用します。
  • カスタムコマンドを作成する際は、ログイン、データベースのシーディング、一般的なワークフローなどの再利用可能なパターンに対して Cypress.Commands.add() を使用し、IntelliSense のために TypeScript 宣言を追加します。
  • コンポーネントをテストする際は、フレームワーク固有のマウントライブラリ (@cypress/react@cypress/vue) と共に cy.mount() を使用して、コンポーネントを分離してテストします。
  • CI を構成する際は、Cypress Cloud 統合のために cypress run --record --key を使用し、マシン間でテストを分割するために --parallel を、ブラウザを指定するために --browser を使用します。
  • プロジェクトをセットアップする際は、cypress.config.tsbaseUrl、viewport の寸法、タイムアウト、および環境変数で構成します。

例 1: チェックアウトフローの E2E テストを作成する

ユーザーリクエスト: "E コマースのチェックアウトプロセスの Cypress テストを追加してください"

アクション:

  1. cy.visit("/products") でテストをセットアップし、製品を選択します
  2. cy.intercept("POST", "/api/cart") でカート API を傍受し、エイリアスを設定します
  3. cy.get("[data-testid='email']").type(...) を使用して配送フォームに入力します
  4. cy.url().should("include", "/confirmation") で注文確認をアサートします

出力: スタブ化された API レスポンスを使用して、完全なチェックアウトフローをカバーする信頼性の高い E2E テスト。

例 2: React のコンポーネントテストをセットアップする

ユーザーリクエスト: "React プロジェクトの Cypress コンポーネントテストを構成してください"

アクション:

  1. @cypress/react をインストールし、cypress.config.ts でコンポーネントテストを構成します
  2. cy.mount(<Component />) を使用して、主要なコンポーネントのストーリーを作成します
  3. cy.get().click() でインタラクションをテストし、DOM の変更をアサートします
  4. E2E テストと共に CI パイプラインに追加します

出力: 完全な Cypress API を備えた実際のブラウザで実行される分離されたコンポーネントテスト。

ガイドライン

  • テストセレクターには data-testid 属性を使用します。CSS クラス、テキストコンテンツ、または DOM 構造に決して依存しないでください。
  • テストを独立させてください。各テストは、独自の状態 (ログイン、シードデータ) をセットアップする必要があります。
  • 外部 API をスタブ化するには cy.intercept() を使用します。テストがサードパーティサービスの可用性に依存しないようにしてください。
  • API 呼び出しをトリガーするアクションの後に cy.wait("@alias") を追加します。タイミングのために cy.wait(ms) を使用しないでください。
  • ユーザーの視点からテストを作成します: 「フォームに入力し、送信をクリックし、確認を表示する」。
  • 大量の API レスポンスデータには fixture を使用します。cy.intercept() で小さなレスポンスをインライン化します。
  • テストの再生、スクリーンショット、および失敗時のビデオのために、--record を指定して CI で Cypress を実行します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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.

Instructions

  • When selecting elements, use data-testid or data-cy attributes with cy.get("[data-testid='submit']") instead of CSS classes or IDs for resilient selectors.
  • When testing interactions, use cy.get().type(), .click(), .select(), and .check() for user actions, and chain .should() assertions for expected outcomes.
  • When handling API calls, use cy.intercept() to stub external APIs with fixtures or spy on requests, and cy.wait("@alias") after actions that trigger calls instead of cy.wait(ms).
  • When writing custom commands, use Cypress.Commands.add() for reusable patterns like login, database seeding, and common workflows, with TypeScript declarations for IntelliSense.
  • When testing components, use cy.mount() with framework-specific mounting libraries (@cypress/react, @cypress/vue) to test components in isolation.
  • When configuring CI, use cypress run --record --key for Cypress Cloud integration with --parallel to split tests across machines, and --browser to specify the browser.
  • When setting up the project, configure cypress.config.ts with baseUrl, viewport dimensions, timeouts, and environment variables.

Examples

Example 1: Write E2E tests for a checkout flow

User request: "Add Cypress tests for our e-commerce checkout process"

Actions:

  1. Set up test with cy.visit("/products") and select a product
  2. Intercept the cart API with cy.intercept("POST", "/api/cart") and alias it
  3. Fill in shipping form using cy.get("[data-testid='email']").type(...)
  4. Assert order confirmation with cy.url().should("include", "/confirmation")

Output: A reliable E2E test covering the full checkout flow with stubbed API responses.

Example 2: Set up component testing for React

User request: "Configure Cypress component testing for our React project"

Actions:

  1. Install @cypress/react and configure component testing in cypress.config.ts
  2. Create stories for key components using cy.mount(<Component />)
  3. Test interactions with cy.get().click() and assert DOM changes
  4. Add to CI pipeline alongside E2E tests

Output: Isolated component tests running in a real browser with full Cypress API.

Guidelines

  • Use data-testid attributes for test selectors; never rely on CSS classes, text content, or DOM structure.
  • Keep tests independent: each test should set up its own state (login, seed data).
  • Use cy.intercept() to stub external APIs; do not let tests depend on third-party service availability.
  • Add cy.wait("@alias") after actions that trigger API calls; do not use cy.wait(ms) for timing.
  • Write tests from the user's perspective: "fill in the form, click submit, see confirmation."
  • Use fixtures for large API response data; inline small responses in cy.intercept().
  • Run Cypress in CI with --record for test replay, screenshots, and video on failure.