From 99bfbf4dca322bc041261c8fc9ca839055f06dd4 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 21:09:47 +0000 Subject: [PATCH 01/15] =?UTF-8?q?refactor:=20playwright-scenario-test=20?= =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=AB=E3=82=926=E3=81=A4=E3=81=AE?= =?UTF-8?q?=E5=B0=82=E9=96=80=E3=82=B9=E3=82=AD=E3=83=AB=E3=81=AB=E5=88=86?= =?UTF-8?q?=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 巨大な単一スキル (playwright-scenario-test) を責務別に分割し、 必要な知識だけをコンテキストに読み込めるようにした。 - playwright-test-planning: テスト計画・page role・チェックリスト - playwright-evidence: テスト実行 + エビデンス収集 - playwright-overlay: Playwright オーバーレイ操作 - playwright-quality: a11y / Core Web Vitals / body_check - playwright-report: Markdown レポート + Google Drive 共有 - playwright-kit-ops: playwright_kit パッケージ・スクリプト管理 旧 playwright-scenario-test はオーケストレーターとして残存。 plugin.json を v4.8.0 に更新 (39 → 45 skills)。 Co-Authored-By: Claude Opus 4.7 (1M context) --- issues/PLAN23_playwright-skill-split.md | 47 ++++++++ plugins/ndf/.claude-plugin/plugin.json | 10 +- .../ndf/skills/playwright-evidence/SKILL.md | 105 +++++++++++++++++ .../.gitignore | 0 .../ndf/skills/playwright-kit-ops/SKILL.md | 109 ++++++++++++++++++ .../playwright_kit/__init__.py | 0 .../playwright_kit/accessibility.py | 0 .../playwright_kit/body_check.py | 0 .../playwright_kit/config.py | 0 .../playwright_kit/fixtures/__init__.py | 0 .../playwright_kit/fixtures/accessibility.py | 0 .../playwright_kit/fixtures/auth.py | 0 .../playwright_kit/fixtures/body_check.py | 0 .../playwright_kit/fixtures/evidence.py | 0 .../playwright_kit/fixtures/web_vitals.py | 0 .../playwright_kit/overlay.py | 0 .../playwright_kit/pytest_plugin.py | 0 .../playwright_kit/pytest_report.py | 0 .../playwright_kit/uploaders/__init__.py | 0 .../playwright_kit/video.py | 0 .../playwright_kit/web_vitals.py | 0 .../pyproject.toml | 0 .../scripts/_drive_auth.py | 0 .../scripts/build_gdoc_with_drive_links.py | 0 .../scripts/check_cwv.py | 0 .../scripts/classify_page_role.py | 0 .../scripts/gdrive_upload_dir.py | 0 .../scripts/init_project.bat | 0 .../scripts/init_project.sh | 4 +- .../scripts/record_scenario.py | 0 .../scripts/run_a11y_scan.py | 0 .../scripts/upload_evidence.py | 0 .../scripts/upload_md_as_gdoc.py | 0 .../templates/conftest.py.template | 0 .../templates/pyproject.toml.runtime | 0 .../templates/run.bat | 0 .../templates/run.sh | 0 .../templates/runtime-README.md | 0 .../templates/runtime-gitignore | 0 .../templates/scenario.config.yaml | 0 .../templates/test_auth.py.template | 0 .../templates/test_dashboard.py.template | 0 .../templates/test_form.py.template | 0 .../templates/test_list.py.template | 0 .../tests/__init__.py | 0 .../tests/conftest.py | 0 .../tests/test_a11y_cwv_routing.py | 0 .../tests/test_auth_cache.py | 0 .../tests/test_body_check.py | 0 .../tests/test_config_basic_auth.py | 0 .../tests/test_evidence_fixture.py | 0 .../tests/test_makereport_user_properties.py | 0 .../tests/test_pytest_plugin_bootstrap.py | 0 .../tests/test_pytest_report.py | 0 .../tests/test_pytest_terminal_summary.py | 0 .../tests/test_pytester_integration.py | 0 .../tests/test_same_origin.py | 0 .../tests/test_upload_evidence.py | 0 .../uv.lock | 0 .../ndf/skills/playwright-overlay/SKILL.md | 77 +++++++++++++ .../ndf/skills/playwright-quality/SKILL.md | 109 ++++++++++++++++++ plugins/ndf/skills/playwright-report/SKILL.md | 76 ++++++++++++ .../skills/playwright-scenario-test/SKILL.md | 34 +++--- .../skills/playwright-test-planning/SKILL.md | 92 +++++++++++++++ .../docs/01-methodology.md | 2 +- .../docs/02-page-roles.md | 2 +- .../docs/03-test-techniques.md | 0 .../docs/04-playwright-mapping.md | 6 +- .../docs/05-bug-report.md | 2 +- .../docs/06-pytest-playwright.md | 2 +- .../docs/README.md | 2 +- .../docs/checklists/checklist-auth.md | 0 .../checklists/checklist-cart-checkout.md | 0 .../docs/checklists/checklist-common.md | 6 +- .../docs/checklists/checklist-dashboard.md | 0 .../docs/checklists/checklist-edit.md | 0 .../docs/checklists/checklist-form.md | 0 .../docs/checklists/checklist-item.md | 0 .../docs/checklists/checklist-list.md | Bin .../docs/checklists/checklist-lp.md | 4 +- .../docs/checklists/checklist-modal-wizard.md | 0 .../docs/checklists/checklist-search.md | 0 82 files changed, 659 insertions(+), 30 deletions(-) create mode 100644 issues/PLAN23_playwright-skill-split.md create mode 100644 plugins/ndf/skills/playwright-evidence/SKILL.md rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/.gitignore (100%) create mode 100644 plugins/ndf/skills/playwright-kit-ops/SKILL.md rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/__init__.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/accessibility.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/body_check.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/config.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/__init__.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/accessibility.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/auth.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/body_check.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/evidence.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/fixtures/web_vitals.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/overlay.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/pytest_plugin.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/pytest_report.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/uploaders/__init__.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/video.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/playwright_kit/web_vitals.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/pyproject.toml (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/_drive_auth.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/build_gdoc_with_drive_links.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/check_cwv.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/classify_page_role.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/gdrive_upload_dir.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/init_project.bat (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/init_project.sh (97%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/record_scenario.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/run_a11y_scan.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/upload_evidence.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/scripts/upload_md_as_gdoc.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/conftest.py.template (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/pyproject.toml.runtime (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/run.bat (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/run.sh (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/runtime-README.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/runtime-gitignore (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/scenario.config.yaml (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/test_auth.py.template (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/test_dashboard.py.template (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/test_form.py.template (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/templates/test_list.py.template (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/__init__.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/conftest.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_a11y_cwv_routing.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_auth_cache.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_body_check.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_config_basic_auth.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_evidence_fixture.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_makereport_user_properties.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_pytest_plugin_bootstrap.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_pytest_report.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_pytest_terminal_summary.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_pytester_integration.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_same_origin.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/tests/test_upload_evidence.py (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-kit-ops}/uv.lock (100%) create mode 100644 plugins/ndf/skills/playwright-overlay/SKILL.md create mode 100644 plugins/ndf/skills/playwright-quality/SKILL.md create mode 100644 plugins/ndf/skills/playwright-report/SKILL.md create mode 100644 plugins/ndf/skills/playwright-test-planning/SKILL.md rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/01-methodology.md (98%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/02-page-roles.md (98%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/03-test-techniques.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/04-playwright-mapping.md (97%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/05-bug-report.md (98%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/06-pytest-playwright.md (99%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/README.md (98%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-auth.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-cart-checkout.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-common.md (96%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-dashboard.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-edit.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-form.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-item.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-list.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-lp.md (96%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-modal-wizard.md (100%) rename plugins/ndf/skills/{playwright-scenario-test => playwright-test-planning}/docs/checklists/checklist-search.md (100%) diff --git a/issues/PLAN23_playwright-skill-split.md b/issues/PLAN23_playwright-skill-split.md new file mode 100644 index 00000000..4e59ccda --- /dev/null +++ b/issues/PLAN23_playwright-skill-split.md @@ -0,0 +1,47 @@ +# PLAN23: playwright-scenario-test を 6 機能 skill + 統括 skill に分割 + +**Issue**: https://github.com/devbasex/ai-plugins/issues/17 +**Status**: 実装済み (未コミット) + +## Context + +`playwright-scenario-test` は 73 ファイル / 760KB の大型 skill。SKILL.md (315行, ~5,000 tokens) が skill 発動時にコンテキストに全量ロードされ、エージェントのコンテキストを圧迫していた。 + +## 実施内容 + +機能を 6 つの独立 skill に分割し、`playwright-scenario-test` を統括オーケストレータに改修。 + +### 新規 6 skill + +| # | Skill 名 | 責務 | +|---|---|---| +| 1 | `playwright-test-planning` | テスト計画 (HTSM/ISTQB/FEW HICCUPPS、page role、チェックリスト) | +| 2 | `playwright-evidence` | エビデンス収集 (video/trace/screenshot/HAR) | +| 3 | `playwright-overlay` | 動画装飾 (赤丸カーソル + 字幕) | +| 4 | `playwright-quality` | 品質計測 (accessibility/Web Vitals/body_check) | +| 5 | `playwright-report` | Markdown レポート + Drive 共有 | +| 6 | `playwright-kit-ops` | スクリプト実行 (init_project/スキャン/アップロード) | + +### 統括 skill (既存改修) + +`playwright-scenario-test` → トリガーを絞り、冒頭に 6 skill への案内テーブルを追加。 + +### スクリプト移動 + +`playwright-scenario-test/scripts/` → `playwright-kit-ops/scripts/` に全スクリプトを移動。 +`init_project.sh` は `SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)"` で自身の親ディレクトリ (`playwright-kit-ops/`) を解決するため、移動先でそのまま動作する。 + +### plugin.json + +- skills 配列に 6 skill を追加 (計 45 skills) +- version: 4.7.5 → 4.8.0 + +## 変更ファイル一覧 + +- 新規 6 ファイル: `skills/playwright-{test-planning,evidence,overlay,quality,report,kit-ops}/SKILL.md` +- 移動 11 ファイル: `scripts/*.py`, `scripts/init_project.{sh,bat}` → `playwright-kit-ops/scripts/` +- 修正 2 ファイル: `playwright-scenario-test/SKILL.md`, `.claude-plugin/plugin.json` + +## 将来の対応 (別 issue) + +- `playwright_kit` Python パッケージの内部サブディレクトリ化 diff --git a/plugins/ndf/.claude-plugin/plugin.json b/plugins/ndf/.claude-plugin/plugin.json index c5f51ed4..8d30f339 100644 --- a/plugins/ndf/.claude-plugin/plugin.json +++ b/plugins/ndf/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ndf", - "version": "4.7.5", - "description": "Integrated plugin with 8 specialized agents (model-tiered: opus/sonnet/haiku), 39 skills including official mcp-builder, on-demand loader for Anthropic official skills, generic workflow/principle skills, skill usage statistics, pytest-playwright based scenario E2E testing (v0.5.0: BREAKING — package renamed scenario_test → playwright_kit, fixtures/CLI ndf_*/--ndf-* → pwk_*/--pwk-*, all-in-one runtime layout enabling Skill-independent operation via init_project.sh + run.sh, accessibility/web vitals autouse, overlay (formerly HUD), report.md, Drive integration, body_check autouse enabled by default to detect server-rendered PHP/SSR errors leaked into HTML), Google Drive/Chat integration, and Codex CLI integration via /ndf:codex skill. Transcript retention is automatically kept at >= 90 days. BREAKING (v4.0.0): Codex MCP server is removed (use /ndf:codex skill); legacy CLAUDE.ndf.md detection hook and /ndf:cleanup skill are removed (obsolete since v3.0.0). Serena MCP is a separate plugin (mcp-serena).", + "version": "4.8.0", + "description": "Integrated plugin with 8 specialized agents (model-tiered: opus/sonnet/haiku), 45 skills including official mcp-builder, on-demand loader for Anthropic official skills, generic workflow/principle skills, skill usage statistics, pytest-playwright E2E testing split into 6 focused skills (test-planning, evidence, overlay, quality, report, kit-ops) + orchestrator, Google Drive/Chat integration, and Codex CLI integration via /ndf:codex skill. Transcript retention is automatically kept at >= 90 days. Serena MCP is a separate plugin (mcp-serena).", "author": { "name": "takemi-ohama", "url": "https://github.com/takemi-ohama" @@ -61,6 +61,12 @@ "./skills/browser-test", "./skills/codex", "./skills/skill-stats", + "./skills/playwright-test-planning", + "./skills/playwright-evidence", + "./skills/playwright-overlay", + "./skills/playwright-quality", + "./skills/playwright-report", + "./skills/playwright-kit-ops", "./skills/playwright-scenario-test", "./skills/google-drive", "./skills/google-chat", diff --git a/plugins/ndf/skills/playwright-evidence/SKILL.md b/plugins/ndf/skills/playwright-evidence/SKILL.md new file mode 100644 index 00000000..2f3e46ce --- /dev/null +++ b/plugins/ndf/skills/playwright-evidence/SKILL.md @@ -0,0 +1,105 @@ +--- +name: playwright-evidence +description: "Playwright E2E テスト実行時のエビデンス収集 (video / trace / screenshot / HAR) を標準化する軽量スキル。pytest-playwright / Playwright Test いずれの環境でも対応。" +when_to_use: "E2E テストの実行 / エビデンス収集 / 動画・トレース・スクリーンショットの保存が必要なとき。Triggers: 'E2E テスト', 'シナリオテスト', '動画エビデンス', 'Playwright', 'テスト実行', 'リリース前確認', '回帰テスト', 'エビデンス収集', 'テスト証跡'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(npx *) + - Bash(playwright *) +--- + +# Playwright Evidence (エビデンス収集) + +E2E テスト実行時に **video / trace / screenshot / HAR** を確実に収集するための標準設定ガイド。 + +## エビデンスデフォルト設定 + +| 種別 | 推奨設定 | 説明 | +|---|---|---| +| video | `retain-on-failure` | 失敗テストの動画を保持 (全テスト: `on`) | +| trace | `retain-on-failure` | 失敗テストの Playwright Trace を保持 | +| screenshot | `only-on-failure` | 失敗時のスクリーンショットを自動取得 | + +## pytest-playwright 環境 + +### セットアップ済みプロジェクト (playwright_kit 使用) + +`scenario.config.yaml` のエビデンス関連設定: + +```yaml +playwright: + headless: true + viewport: { width: 1280, height: 720 } + video_size: { width: 1280, height: 720 } + enable_trace: true + video_format: mp4 +``` + +実行: + +```bash +./scenario-test/run.sh # 全テスト +./scenario-test/run.sh -k test_login # 特定テスト +./scenario-test/run.sh --pwk-no-evidence # エビデンス収集 OFF +``` + +### 素の pytest-playwright + +```bash +uv run pytest \ + --video=retain-on-failure \ + --tracing=retain-on-failure \ + --screenshot=only-on-failure \ + --output=reports/ +``` + +## Playwright Test (TypeScript) 環境 + +`playwright.config.ts`: + +```typescript +export default defineConfig({ + use: { + video: 'retain-on-failure', + trace: 'retain-on-failure', + screenshot: 'only-on-failure', + }, + outputDir: 'test-results/', + reporter: [['html', { open: 'never' }]], +}); +``` + +実行: + +```bash +npx playwright test # 全テスト +npx playwright test --ui # UI モード +npx playwright show-trace test-results/*/trace.zip # Trace Viewer +``` + +## 成果物 + +``` +reports// # pytest-playwright (playwright_kit) +├── report.md # Markdown テスト結果サマリ +├── / +│ ├── video.mp4 # テスト動画 +│ ├── trace.zip # Playwright Trace +│ ├── har.json # ネットワーク通信ログ +│ ├── console.log # console.error / console.warn +│ └── screenshot-*.png # スクリーンショット + +test-results/ # Playwright Test (TypeScript) +├── / +│ ├── video.webm # テスト動画 +│ └── trace.zip # Playwright Trace +``` + +## 関連 Skill + +- `/ndf:playwright-overlay` — 動画に字幕 + カーソルを追加 +- `/ndf:playwright-quality` — accessibility / Web Vitals 自動計測 +- `/ndf:playwright-report` — Markdown レポート生成 + Drive 共有 +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-scenario-test/.gitignore b/plugins/ndf/skills/playwright-kit-ops/.gitignore similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/.gitignore rename to plugins/ndf/skills/playwright-kit-ops/.gitignore diff --git a/plugins/ndf/skills/playwright-kit-ops/SKILL.md b/plugins/ndf/skills/playwright-kit-ops/SKILL.md new file mode 100644 index 00000000..d0c2785c --- /dev/null +++ b/plugins/ndf/skills/playwright-kit-ops/SKILL.md @@ -0,0 +1,109 @@ +--- +name: playwright-kit-ops +description: "playwright_kit の操作に特化した実行エージェント。プロジェクト初期化 (init_project)、テスト実行、page role 分類、a11y/CWV 単発スキャン、エビデンスアップロードなど、playwright_kit のスクリプト群を実行する。" +when_to_use: "playwright_kit のスクリプトを実行するとき / E2E テストプロジェクトの初期化 / page role 自動分類 / 単発 a11y・CWV スキャン / Google Drive エビデンスアップロードが必要なとき。Triggers: 'init_project', 'プロジェクト初期化', 'classify_page_role', 'run_a11y_scan', 'check_cwv', 'upload_evidence', 'record_scenario', 'playwright_kit 実行'" +allowed-tools: + - Read + - Bash(python *) + - Bash(uv *) + - Bash(pytest *) + - Bash(playwright *) + - Bash(./scripts/*) + - Bash(bash *) + - Bash(chmod *) +--- + +# playwright_kit 操作エージェント + +playwright_kit のスクリプト群を実行してテスト環境のセットアップ・テスト実行・エビデンス管理を行う。 + +## スクリプト一覧 + +| スクリプト | 用途 | カテゴリ | +|---|---|---| +| `scripts/init_project.sh` | 利用者プロジェクトに scenario-test ランタイムを埋め込む | セットアップ | +| `scripts/init_project.bat` | 同 (Windows) | セットアップ | +| `scripts/classify_page_role.py` | URL の a11y tree + パターンから page role を自動推定 | テスト計画 | +| `scripts/record_scenario.py` | Playwright codegen で操作を記録しテストコード化 | テスト計画 | +| `scripts/run_a11y_scan.py` | axe-core による単発 accessibility スキャン | 品質 | +| `scripts/check_cwv.py` | Core Web Vitals (LCP/CLS/TTFB) 単発計測 | 品質 | +| `scripts/upload_evidence.py` | エビデンスファイルを Google Drive にアップロード | レポート | +| `scripts/gdrive_upload_dir.py` | ディレクトリごと Drive にバッチアップロード | レポート | +| `scripts/upload_md_as_gdoc.py` | Markdown を Google Doc に変換・アップロード | レポート | +| `scripts/build_gdoc_with_drive_links.py` | Google Doc にエビデンスの Drive リンクを埋め込み | レポート | + +## セットアップ + +### プロジェクト初期化 + +```bash +# SKILL_DIR はこの skill のパス +./scripts/init_project.sh /path/to/your-app + +# ディレクトリ名をカスタマイズ +./scripts/init_project.sh /path/to/your-app --runtime-dir e2e + +# Windows +scripts\init_project.bat C:\path\to\your-app +``` + +→ `your-app/scenario-test/` に all-in-one ランタイムが作成され、Skill 非依存で動作する。 + +### テスト実行 + +```bash +cd /path/to/your-app +./scenario-test/run.sh # 全テスト +./scenario-test/run.sh -k test_admin # フィルタ +./scenario-test/run.sh --pwk-overlay # 字幕 + カーソル付き動画 +./scenario-test/run.sh --pwk-drive-folder= # Drive 自動アップロード +``` + +## テスト計画ツール + +```bash +# page role を自動推定 +python scripts/classify_page_role.py --url https://example.com/products + +# Playwright codegen で操作を記録 +python scripts/record_scenario.py https://example.com/login +``` + +## 品質スキャンツール + +```bash +# axe-core 単発スキャン +python scripts/run_a11y_scan.py --url https://example.com + +# Core Web Vitals 単発計測 +python scripts/check_cwv.py --url https://example.com +``` + +## エビデンスアップロードツール + +```bash +# 単一ファイルを Drive にアップロード +python scripts/upload_evidence.py reports/run-001/test_login/trace.zip --kind trace + +# ディレクトリごとアップロード +python scripts/gdrive_upload_dir.py reports/run-001/ --folder-id + +# Markdown → Google Doc 変換 +python scripts/upload_md_as_gdoc.py reports/run-001/report.md + +# Google Doc にエビデンス Drive リンクを埋め込み +python scripts/build_gdoc_with_drive_links.py reports/run-001/ +``` + +## パッケージ参照 + +playwright_kit Python パッケージ本体・templates・tests はこの skill ディレクトリ内に配置されている。 + +## 関連 Skill + +- `/ndf:playwright-test-planning` — テスト計画 (方法論 + チェックリスト) +- `/ndf:playwright-evidence` — エビデンス収集設定ガイド +- `/ndf:playwright-overlay` — 動画装飾設定ガイド +- `/ndf:playwright-quality` — 品質計測設定ガイド +- `/ndf:playwright-report` — レポート生成設定ガイド +- `/ndf:playwright-scenario-test` — 全機能統括 diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/__init__.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/__init__.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/__init__.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/__init__.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/accessibility.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/accessibility.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/accessibility.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/accessibility.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/body_check.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/body_check.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/body_check.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/body_check.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/config.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/config.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/config.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/config.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/__init__.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/__init__.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/__init__.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/__init__.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/accessibility.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/accessibility.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/accessibility.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/accessibility.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/auth.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/auth.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/auth.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/auth.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/body_check.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/body_check.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/body_check.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/body_check.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/evidence.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/evidence.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/evidence.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/evidence.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/web_vitals.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/web_vitals.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/fixtures/web_vitals.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/fixtures/web_vitals.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/overlay.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/overlay.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/overlay.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/overlay.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/pytest_plugin.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/pytest_plugin.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/pytest_report.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_report.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/pytest_report.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_report.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/uploaders/__init__.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/uploaders/__init__.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/uploaders/__init__.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/uploaders/__init__.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/video.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/video.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/video.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/video.py diff --git a/plugins/ndf/skills/playwright-scenario-test/playwright_kit/web_vitals.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/web_vitals.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/playwright_kit/web_vitals.py rename to plugins/ndf/skills/playwright-kit-ops/playwright_kit/web_vitals.py diff --git a/plugins/ndf/skills/playwright-scenario-test/pyproject.toml b/plugins/ndf/skills/playwright-kit-ops/pyproject.toml similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/pyproject.toml rename to plugins/ndf/skills/playwright-kit-ops/pyproject.toml diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/_drive_auth.py b/plugins/ndf/skills/playwright-kit-ops/scripts/_drive_auth.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/_drive_auth.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/_drive_auth.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/build_gdoc_with_drive_links.py b/plugins/ndf/skills/playwright-kit-ops/scripts/build_gdoc_with_drive_links.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/build_gdoc_with_drive_links.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/build_gdoc_with_drive_links.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/check_cwv.py b/plugins/ndf/skills/playwright-kit-ops/scripts/check_cwv.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/check_cwv.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/check_cwv.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/classify_page_role.py b/plugins/ndf/skills/playwright-kit-ops/scripts/classify_page_role.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/classify_page_role.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/classify_page_role.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/gdrive_upload_dir.py b/plugins/ndf/skills/playwright-kit-ops/scripts/gdrive_upload_dir.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/gdrive_upload_dir.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/gdrive_upload_dir.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/init_project.bat b/plugins/ndf/skills/playwright-kit-ops/scripts/init_project.bat similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/init_project.bat rename to plugins/ndf/skills/playwright-kit-ops/scripts/init_project.bat diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/init_project.sh b/plugins/ndf/skills/playwright-kit-ops/scripts/init_project.sh similarity index 97% rename from plugins/ndf/skills/playwright-scenario-test/scripts/init_project.sh rename to plugins/ndf/skills/playwright-kit-ops/scripts/init_project.sh index e5986d30..080c934e 100755 --- a/plugins/ndf/skills/playwright-scenario-test/scripts/init_project.sh +++ b/plugins/ndf/skills/playwright-kit-ops/scripts/init_project.sh @@ -129,7 +129,7 @@ echo "[init] [1/4] playwright_kit / scripts / uv.lock をコピー" # rsync -n でも failed to read directory で abort するため)。 if [[ $DRY_RUN -eq 1 ]]; then echo " rsync $SKILL_DIR/playwright_kit -> $RUNTIME_DIR/playwright_kit" - echo " rsync $SKILL_DIR/scripts -> $RUNTIME_DIR/scripts" + echo " rsync $SKILL_DIR/scripts -> $RUNTIME_DIR/scripts" echo " cp $SKILL_DIR/uv.lock -> $RUNTIME_DIR/uv.lock" else RSYNC_OPTS=(-a @@ -137,7 +137,7 @@ else --exclude='reports' --exclude='*.egg-info' ) rsync "${RSYNC_OPTS[@]}" "$SKILL_DIR/playwright_kit" "$RUNTIME_DIR/" - rsync "${RSYNC_OPTS[@]}" "$SKILL_DIR/scripts" "$RUNTIME_DIR/" + rsync "${RSYNC_OPTS[@]}" "$SKILL_DIR/scripts" "$RUNTIME_DIR/" cp "$SKILL_DIR/uv.lock" "$RUNTIME_DIR/uv.lock" fi diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/record_scenario.py b/plugins/ndf/skills/playwright-kit-ops/scripts/record_scenario.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/record_scenario.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/record_scenario.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/run_a11y_scan.py b/plugins/ndf/skills/playwright-kit-ops/scripts/run_a11y_scan.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/run_a11y_scan.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/run_a11y_scan.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/upload_evidence.py b/plugins/ndf/skills/playwright-kit-ops/scripts/upload_evidence.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/upload_evidence.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/upload_evidence.py diff --git a/plugins/ndf/skills/playwright-scenario-test/scripts/upload_md_as_gdoc.py b/plugins/ndf/skills/playwright-kit-ops/scripts/upload_md_as_gdoc.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/scripts/upload_md_as_gdoc.py rename to plugins/ndf/skills/playwright-kit-ops/scripts/upload_md_as_gdoc.py diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/conftest.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/conftest.py.template rename to plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/pyproject.toml.runtime b/plugins/ndf/skills/playwright-kit-ops/templates/pyproject.toml.runtime similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/pyproject.toml.runtime rename to plugins/ndf/skills/playwright-kit-ops/templates/pyproject.toml.runtime diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/run.bat b/plugins/ndf/skills/playwright-kit-ops/templates/run.bat similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/run.bat rename to plugins/ndf/skills/playwright-kit-ops/templates/run.bat diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/run.sh b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/run.sh rename to plugins/ndf/skills/playwright-kit-ops/templates/run.sh diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/runtime-README.md b/plugins/ndf/skills/playwright-kit-ops/templates/runtime-README.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/runtime-README.md rename to plugins/ndf/skills/playwright-kit-ops/templates/runtime-README.md diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/runtime-gitignore b/plugins/ndf/skills/playwright-kit-ops/templates/runtime-gitignore similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/runtime-gitignore rename to plugins/ndf/skills/playwright-kit-ops/templates/runtime-gitignore diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/scenario.config.yaml b/plugins/ndf/skills/playwright-kit-ops/templates/scenario.config.yaml similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/scenario.config.yaml rename to plugins/ndf/skills/playwright-kit-ops/templates/scenario.config.yaml diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/test_auth.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/test_auth.py.template similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/test_auth.py.template rename to plugins/ndf/skills/playwright-kit-ops/templates/test_auth.py.template diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/test_dashboard.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/test_dashboard.py.template similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/test_dashboard.py.template rename to plugins/ndf/skills/playwright-kit-ops/templates/test_dashboard.py.template diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/test_form.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/test_form.py.template similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/test_form.py.template rename to plugins/ndf/skills/playwright-kit-ops/templates/test_form.py.template diff --git a/plugins/ndf/skills/playwright-scenario-test/templates/test_list.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/test_list.py.template similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/templates/test_list.py.template rename to plugins/ndf/skills/playwright-kit-ops/templates/test_list.py.template diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/__init__.py b/plugins/ndf/skills/playwright-kit-ops/tests/__init__.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/__init__.py rename to plugins/ndf/skills/playwright-kit-ops/tests/__init__.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/conftest.py b/plugins/ndf/skills/playwright-kit-ops/tests/conftest.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/conftest.py rename to plugins/ndf/skills/playwright-kit-ops/tests/conftest.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_a11y_cwv_routing.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_a11y_cwv_routing.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_a11y_cwv_routing.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_a11y_cwv_routing.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_auth_cache.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_auth_cache.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_auth_cache.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_auth_cache.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_body_check.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_body_check.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_body_check.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_body_check.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_config_basic_auth.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_config_basic_auth.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_config_basic_auth.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_config_basic_auth.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_evidence_fixture.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_evidence_fixture.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_evidence_fixture.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_evidence_fixture.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_makereport_user_properties.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_makereport_user_properties.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_makereport_user_properties.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_makereport_user_properties.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_plugin_bootstrap.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_plugin_bootstrap.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_plugin_bootstrap.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_plugin_bootstrap.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_report.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_report.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_report.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_report.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_terminal_summary.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_terminal_summary.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_pytest_terminal_summary.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_pytest_terminal_summary.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_pytester_integration.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_pytester_integration.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_pytester_integration.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_pytester_integration.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_same_origin.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_same_origin.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_same_origin.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_same_origin.py diff --git a/plugins/ndf/skills/playwright-scenario-test/tests/test_upload_evidence.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_upload_evidence.py similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/tests/test_upload_evidence.py rename to plugins/ndf/skills/playwright-kit-ops/tests/test_upload_evidence.py diff --git a/plugins/ndf/skills/playwright-scenario-test/uv.lock b/plugins/ndf/skills/playwright-kit-ops/uv.lock similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/uv.lock rename to plugins/ndf/skills/playwright-kit-ops/uv.lock diff --git a/plugins/ndf/skills/playwright-overlay/SKILL.md b/plugins/ndf/skills/playwright-overlay/SKILL.md new file mode 100644 index 00000000..a5df4f95 --- /dev/null +++ b/plugins/ndf/skills/playwright-overlay/SKILL.md @@ -0,0 +1,77 @@ +--- +name: playwright-overlay +description: "Playwright テスト動画に赤丸カーソル + 2行字幕 (操作説明) を重ねるオーバーレイ機能。操作内容を視覚的に伝えるエビデンス動画を生成する。" +when_to_use: "テスト動画に字幕やカーソルを追加したいとき / 操作内容を視覚的に説明するエビデンス動画を作りたいとき。Triggers: '字幕', 'カーソル', 'overlay', 'HUD', '動画装飾', 'エビデンス動画', 'pwk-overlay', '赤丸'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(playwright *) +--- + +# Playwright Overlay (動画装飾) + +テスト動画に **赤丸カーソル + 2行字幕** を重ねて、操作内容を視覚的に伝えるエビデンス動画を生成する。 + +## 有効化 + +```bash +./scenario-test/run.sh --pwk-overlay +``` + +`--pwk-overlay` フラグで全テストの動画にオーバーレイが適用される。 + +## overlay API + +テストコード内で以下の関数を呼び出して字幕・カーソルを制御する: + +```python +from playwright_kit.overlay import set_caption, flash_click, hide_cursor +``` + +| 関数 | 説明 | +|---|---| +| `set_caption(page, previous="", next_action="")` | 2行字幕を更新 (上段: 直前の操作、下段: 次の操作) | +| `flash_click(page, x, y, settle_ms=250)` | 赤丸カーソルを (x, y) に移動 + リップルアニメーション | +| `hide_cursor(page)` | カーソルを非表示 (ナビゲーション後など) | + +## テストコード例 + +```python +from playwright.sync_api import Page, expect +from playwright_kit.overlay import set_caption, flash_click + +def test_login_scenario(page: Page, pwk_role_admin): + set_caption(page, next_action="ログインページを開く") + page.goto("/admin/login") + + set_caption(page, previous="ログインページを表示", next_action="メールアドレスを入力") + email = page.get_by_label("メールアドレス") + box = email.bounding_box() + flash_click(page, box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) + email.fill("admin@example.com") + + set_caption(page, previous="メールアドレスを入力", next_action="ログインボタンをクリック") + btn = page.get_by_role("button", name="ログイン") + box = btn.bounding_box() + flash_click(page, box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) + btn.click() + + set_caption(page, previous="ログイン成功", next_action="") + expect(page).to_have_url(lambda u: "/admin/dashboard" in u) +``` + +## 動画フォーマット + +`scenario.config.yaml` で mp4 を指定すると Drive プレビュアとの互換性が高い: + +```yaml +playwright: + video_format: mp4 # mp4 推奨 (webm も可) + video_size: { width: 1280, height: 720 } +``` + +## 関連 Skill + +- `/ndf:playwright-evidence` — 基本エビデンス収集 (overlay なし) +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-quality/SKILL.md b/plugins/ndf/skills/playwright-quality/SKILL.md new file mode 100644 index 00000000..8eb63e1f --- /dev/null +++ b/plugins/ndf/skills/playwright-quality/SKILL.md @@ -0,0 +1,109 @@ +--- +name: playwright-quality +description: "Playwright テスト実行時の品質自動計測。accessibility (axe-core / WCAG)、Core Web Vitals (LCP/CLS/TTFB)、body_check (PHP/SSR エラー検出) を page role marker に連動して自動実行する。" +when_to_use: "accessibility チェック / Core Web Vitals 計測 / PHP エラー検出が必要なとき。Triggers: 'a11y テスト', 'accessibility テスト', 'axe-core', 'WCAG', 'Core Web Vitals', 'Web Vitals', 'LCP', 'CLS', 'body_check', 'PHP エラー検出'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(python *) +--- + +# Playwright Quality (品質自動計測) + +E2E テスト実行時に **accessibility / Core Web Vitals / body_check** を自動計測する。 + +## accessibility (axe-core) + +`@pytest.mark.page_role` marker が付いたテストで、auto_roles にマッチする role の場合に axe-core を自動実行。 + +### 設定 (scenario.config.yaml) + +```yaml +accessibility: + enabled: true + auto_roles: [lp, list, form, dashboard, cart, checkout, settings, auth] + tags: [wcag2a, wcag2aa, wcag21aa, wcag22aa] + fail_on_violations: true +``` + +### テストコードでの手動実行 + +```python +def test_form_accessibility(page, pwk_accessibility_scan): + page.goto("/contact") + violations = pwk_accessibility_scan() + assert len(violations) == 0, f"{len(violations)} violations found" +``` + +### 単発スキャン (テスト外) + +> スクリプトの実行は `/ndf:playwright-kit-ops` skill を参照。 + +```bash +# playwright-kit-ops/ ディレクトリ内で実行 +python scripts/run_a11y_scan.py --url https://example.com +``` + +## Core Web Vitals + +`@pytest.mark.page_role` marker + auto_roles マッチで LCP / CLS / TTFB / longest_task を自動計測。 + +### 設定 (scenario.config.yaml) + +```yaml +web_vitals: + enabled: true + auto_roles: [lp, list, dashboard, search] + observe_ms: 5000 + fail_on_poor: true +``` + +### テストコードでの手動計測 + +```python +def test_dashboard_performance(page, pwk_web_vitals_measure): + page.goto("/dashboard") + metrics = pwk_web_vitals_measure() + assert metrics["lcp"]["rating"] != "poor" +``` + +### 単発計測 (テスト外) + +> スクリプトの実行は `/ndf:playwright-kit-ops` skill を参照。 + +```bash +# playwright-kit-ops/ ディレクトリ内で実行 +python scripts/check_cwv.py --url https://example.com +``` + +## body_check (PHP/SSR エラー検出) + +`page.on("response")` で全 HTML レスポンスを監視し、`Fatal error` / `Warning:` 等の文字列パターンを検出する。**デフォルトで有効** (PHP 系パターン内蔵)。 + +### 設定 (scenario.config.yaml) + +```yaml +body_check: + enabled: true + fatal_patterns: ["Fatal error", "Uncaught", "Parse error"] + warning_patterns: ["STRICT:", "Warning:", "Notice:", "Deprecated:"] + warning_head_chars: 300 + fail_on_match: true +``` + +### Opt-out + +```python +@pytest.mark.no_body_check +def test_known_warning_page(page): + page.goto("/legacy") +``` + +非 PHP プロジェクトで誤検出する場合は `body_check.enabled: false` で無効化。 + +## 関連 Skill + +- `/ndf:playwright-evidence` — 基本エビデンス収集 +- `/ndf:playwright-report` — 品質計測結果を含むレポート生成 +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-report/SKILL.md b/plugins/ndf/skills/playwright-report/SKILL.md new file mode 100644 index 00000000..916aab4f --- /dev/null +++ b/plugins/ndf/skills/playwright-report/SKILL.md @@ -0,0 +1,76 @@ +--- +name: playwright-report +description: "Playwright テスト結果の Markdown レポート自動生成 + Google Drive 共有。テスト結果サマリ・エビデンスリンク・失敗詳細を report.md にまとめる。" +when_to_use: "テストレポートの生成 / テスト結果の共有 / Google Drive へのエビデンスアップロードが必要なとき。Triggers: 'テストレポート', 'report.md', 'テスト結果', 'テスト報告書', 'Drive 共有', 'Drive アップロード', 'エビデンス共有'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(python *) +--- + +# Playwright Report (レポート生成) + +テスト実行後に **Markdown レポート** を自動生成し、Google Drive で共有する。 + +## 自動生成 + +`pytest_terminal_summary` hook で `reports//report.md` が自動生成される。特別な設定は不要。 + +```bash +./scenario-test/run.sh +# → reports//report.md が生成される +``` + +## レポート内容 + +| セクション | 内容 | +|---|---| +| サマリ表 | nodeid, role, page_role, 結果, 実行時間, エラー数 | +| 失敗詳細 | FAIL/ERROR のテストごとの詳細情報 | +| body_check 違反 | PHP/SSR エラー検出の詳細 (URL, パターン, スニペット) | +| エビデンスリンク | video, trace, HAR, screenshot へのパス | + +## レポート設定 + +`scenario.config.yaml` の `report` セクション: + +```yaml +report: + title: "シナリオ E2E テスト 実施報告書" + test_plan_link: "./test-plan.md" + phase_labels: {} +``` + +## Google Drive アップロード + +### テスト実行時に自動アップロード + +```bash +./scenario-test/run.sh --pwk-drive-folder= +``` + +`--pwk-drive-folder` を指定すると、テスト終了後に report.md + エビデンスファイルが Drive にアップロードされる。 + +### 手動アップロード + +```bash +# エビデンスファイルを Drive にアップロード +python playwright-kit-ops/scripts/upload_evidence.py --kind trace + +# ディレクトリごとアップロード +python playwright-kit-ops/scripts/gdrive_upload_dir.py reports// --folder-id + +# report.md を Google Doc として変換・アップロード +python playwright-kit-ops/scripts/upload_md_as_gdoc.py reports//report.md + +# Google Doc にエビデンスの Drive リンクを埋め込み +python playwright-kit-ops/scripts/build_gdoc_with_drive_links.py reports// +``` + +## 関連 Skill + +- `/ndf:playwright-evidence` — 基本エビデンス収集 +- `/ndf:playwright-quality` — レポートに含まれる品質計測 +- `/ndf:google-drive` — Google Drive 操作全般 +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-scenario-test/SKILL.md b/plugins/ndf/skills/playwright-scenario-test/SKILL.md index fe888b04..faed4ceb 100644 --- a/plugins/ndf/skills/playwright-scenario-test/SKILL.md +++ b/plugins/ndf/skills/playwright-scenario-test/SKILL.md @@ -1,7 +1,7 @@ --- name: playwright-scenario-test -description: "pytest-playwright 上の Web シナリオ E2E テスト実施フレームワーク。HTSM / ISTQB / FEW HICCUPPS に基づき page role 別の checklist + 必須技法マッピングを内蔵し、accessibility (axe-core) / Core Web Vitals 自動計測 + Playwright trace / HAR / 動画 / Markdown レポート + Google Drive 共有を pytest fixture / hook として提供する。v0.5.0 で利用者プロジェクトに all-in-one ディレクトリを埋め込む Skill 非依存構成へ移行。" -when_to_use: "E2E テスト計画立案 / 不具合エビデンス収集 / 動画レポート / Google Drive 共有が必要なとき。LP / 一覧 / 詳細 / 編集 / 申込フォーム / 検索 / ダッシュボード / 認証 / カート / チェックアウト / モーダル / ウィザード / 設定 / エラーページ など page role 別の理論ベースチェックを行う。Triggers: 'E2E テスト', 'シナリオテスト', '動画エビデンス', 'Playwright', 'pytest-playwright', 'リリース前確認', '回帰テスト', 'a11y テスト', 'accessibility テスト', 'Core Web Vitals', 'Web Vitals', 'page role', 'pwk_role', 'pwk_evidence'" +description: "pytest-playwright ベースのフル E2E テストフレームワーク統括。テスト計画・エビデンス収集・動画装飾・品質計測・レポート生成の 5 機能を組み合わせた包括的なテストワークフローを提供する。個別機能のみ必要な場合は各専門 skill を直接参照。" +when_to_use: "フル E2E テストワークフロー (計画→実行→エビデンス→品質→レポート) を一貫して行うとき / pytest-playwright 拡張 fixture (pwk_*) の全体像を把握したいとき / init_project.sh でプロジェクトをセットアップするとき。Triggers: 'pytest-playwright', 'pwk_role', 'pwk_evidence', 'init_project', 'シナリオテスト一式', 'フル E2E'" allowed-tools: - Read - Bash(uv *) @@ -14,6 +14,21 @@ allowed-tools: Web アプリの E2E シナリオを **理論ベース** で計画し、**pytest-playwright** 上で実行、**動画 + Markdown レポート + accessibility / web vitals** を自動収集する一式の Skill。 +## 機能別 Skill + +個別機能のみ必要な場合は、以下の専門 skill を直接参照: + +| Skill | 機能 | +|---|---| +| `/ndf:playwright-test-planning` | テスト計画 (HTSM / page role / チェックリスト) | +| `/ndf:playwright-evidence` | エビデンス収集 (video / trace / screenshot) | +| `/ndf:playwright-overlay` | 動画装飾 (字幕 + カーソル) | +| `/ndf:playwright-quality` | 品質計測 (accessibility / Web Vitals / body_check) | +| `/ndf:playwright-report` | レポート生成 + Drive 共有 | +| `/ndf:playwright-kit-ops` | スクリプト実行 (init_project / スキャン / アップロード) | + +以下は全機能を組み合わせたフルワークフローの案内。 + **v0.5.0 の方針**: 本 Skill は「テストを書き始めるためのスキャフォルダ」であり、`scripts/init_project.sh` で利用者プロジェクトに **all-in-one ディレクトリ** を埋め込んだ後は、Skill ディレクトリの存在に依存せず単独で動作する (CI / 別マシン / Skill 非導入のメンバー環境でも完結)。 ## 用語集 @@ -55,11 +70,8 @@ playwright-scenario-test/ ← Skill 自体 (この Skill ディレクトリ) │ ├── video.py ← webm → mp4 変換 │ └── config.py ← scenario.config.yaml ローダ ├── docs/ ← テスト方法論 (HTSM / ISTQB / FEW HICCUPPS) -├── scripts/ -│ ├── init_project.sh ← all-in-one 初期化 (rsync ベース) -│ ├── init_project.bat ← 同 Windows 版 (xcopy ベース) -│ ├── classify_page_role.py / run_a11y_scan.py / check_cwv.py / record_scenario.py -│ └── upload_evidence.py / gdrive_upload_dir.py / build_gdoc_with_drive_links.py +├── (scripts/ は playwright-kit-ops/ skill に移動) +│ └── → /ndf:playwright-kit-ops を参照 └── templates/ ← 利用者プロジェクト用雛形 ├── pyproject.toml.runtime — runtime 用 pyproject (dev 用 deps を排除) ├── runtime-gitignore — .venv / __pycache__ / reports/ @@ -226,7 +238,7 @@ pytest 標準と組み合わせて使える: ``` [A] 対象 URL を渡される │ -[B] page role を判定 scripts/classify_page_role.py --url +[B] page role を判定 playwright-kit-ops/scripts/classify_page_role.py --url ▼ [C] 該当 checklist を開く docs/checklists/checklist-{role}.md │ 全項目を「適用」or「不適用 (理由付き)」で判定 @@ -250,11 +262,7 @@ pytest 標準と組み合わせて使える: | Script | 用途 | |---|---| -| `scripts/classify_page_role.py --url ` | a11y tree + URL pattern + role 集計から page role 推定 | -| `scripts/record_scenario.py ` | Playwright codegen を起動し操作を Python コードで取得 | -| `scripts/run_a11y_scan.py --url ` | axe-core 単発スキャン | -| `scripts/check_cwv.py --url ` | Web Vitals (LCP/CLS/TTFB) 単発計測 | -| `scripts/upload_evidence.py --kind trace --public` | Drive アップロード + Playwright Trace Viewer URL 生成 | +| → `/ndf:playwright-kit-ops` | スクリプト群は playwright-kit-ops skill に移動。詳細はそちらを参照 | ## docs/ 配下 (理論ベース知識) diff --git a/plugins/ndf/skills/playwright-test-planning/SKILL.md b/plugins/ndf/skills/playwright-test-planning/SKILL.md new file mode 100644 index 00000000..1eabde57 --- /dev/null +++ b/plugins/ndf/skills/playwright-test-planning/SKILL.md @@ -0,0 +1,92 @@ +--- +name: playwright-test-planning +description: "HTSM / ISTQB / FEW HICCUPPS に基づく E2E テスト計画立案。page role 分類 + role 別チェックリストでテスト項目を網羅的に洗い出す。" +when_to_use: "E2E テストの計画立案 / page role 分類 / テスト技法の選定 / チェックリスト活用が必要なとき。Triggers: 'テスト計画', 'テスト計画立案', 'page role', 'HTSM', 'ISTQB', 'FEW HICCUPPS', 'チェックリスト', 'テスト技法', 'テスト設計'" +allowed-tools: + - Read + - Bash(python *) +--- + +# E2E テスト計画 (理論ベース) + +HTSM / ISTQB / FEW HICCUPPS に基づいて E2E テストシナリオを計画する。 + +## 計画ワークフロー + +``` +[A] 対象 URL を渡される + │ +[B] page role を判定 → scripts/classify_page_role.py --url + ▼ +[C] 該当チェックリストを開く → docs/checklists/checklist-{role}.md + │ 全項目を「適用」or「不適用 (理由付き)」で判定 + ▼ +[D] 必須テスト技法を確定 → docs/03-test-techniques.md § 11 + ▼ +[E] pytest テストを書く → templates/test_.py.template を起点に +``` + +## page role 一覧 + +| role | 説明 | 例 | +|---|---|---| +| lp | ランディングページ | トップ、LP | +| list | 一覧ページ | 商品一覧、記事一覧 | +| item | 詳細ページ | 商品詳細、記事詳細 | +| edit | 編集ページ | プロフィール編集 | +| form | 申込・入力フォーム | 会員登録、問い合わせ | +| search | 検索ページ | サイト内検索 | +| dashboard | ダッシュボード | 管理画面トップ | +| auth | 認証ページ | ログイン、パスワードリセット | +| cart-checkout | カート・決済 | ショッピングカート | +| modal-wizard | モーダル・ウィザード | ステップ型入力 | + +## チェックリスト + +`playwright-test-planning/docs/checklists/` 配下に role 別チェックリストがある: + +``` +docs/checklists/ +├── checklist-common.md # 全 role 共通項目 +├── checklist-lp.md +├── checklist-list.md +├── checklist-item.md +├── checklist-edit.md +├── checklist-form.md +├── checklist-search.md +├── checklist-dashboard.md +├── checklist-auth.md +├── checklist-cart-checkout.md +└── checklist-modal-wizard.md +``` + +## 方法論ドキュメント + +`playwright-test-planning/docs/` 配下: + +| ファイル | 内容 | +|---|---| +| `01-methodology.md` | HTSM / FEW HICCUPPS / ISO 29119-3 の概要 | +| `02-page-roles.md` | page role 分類の詳細定義 | +| `03-test-techniques.md` | テスト技法 (EP/BVA/Decision Table/Pairwise) + role 必須マッピング | +| `04-playwright-mapping.md` | Playwright API → role / 観点 マッピング | +| `05-bug-report.md` | 不具合報告書の仕様 (ISO 29119-3 + FEW HICCUPPS oracle) | + +## 補助スクリプト + +スクリプトの実行は `/ndf:playwright-kit-ops` skill を参照。主なコマンド: + +```bash +# page role を自動推定 (playwright-kit-ops/scripts/ 配下) +python scripts/classify_page_role.py --url + +# Playwright codegen で操作を記録 → テストコードに変換 +python scripts/record_scenario.py +``` + +> 上記は `playwright-kit-ops/` ディレクトリ内での実行を想定。詳細は `/ndf:playwright-kit-ops` を参照。 + +## 関連 Skill + +- `/ndf:playwright-evidence` — テスト実行 + エビデンス収集 +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/01-methodology.md b/plugins/ndf/skills/playwright-test-planning/docs/01-methodology.md similarity index 98% rename from plugins/ndf/skills/playwright-scenario-test/docs/01-methodology.md rename to plugins/ndf/skills/playwright-test-planning/docs/01-methodology.md index 2879b9d4..9c6e0df9 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/01-methodology.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/01-methodology.md @@ -105,7 +105,7 @@ James Bach の **Heuristic Test Strategy Model** (v6.3) は、テスト戦略を │ Playwright: page.accessibility.snapshot() or page.evaluate(getRoleSummary) ▼ [2] page role を判定 → docs/02-page-roles.md の識別ヒューリスティック - │ scripts/classify_page_role.py が補助 (DOM の role 集計) + │ playwright-kit-ops/scripts/classify_page_role.py が補助 (DOM の role 集計) ▼ [3] 該当 checklist を開く → docs/checklists/checklist-{role}.md │ 全項目を「適用」または「不適用 (理由付き)」と判定 diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/02-page-roles.md b/plugins/ndf/skills/playwright-test-planning/docs/02-page-roles.md similarity index 98% rename from plugins/ndf/skills/playwright-scenario-test/docs/02-page-roles.md rename to plugins/ndf/skills/playwright-test-planning/docs/02-page-roles.md index 6f6a8039..f3ccc627 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/02-page-roles.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/02-page-roles.md @@ -166,7 +166,7 @@ ## 識別の自動化 -`scripts/classify_page_role.py` は次のヒューリスティックで role を推定する: +`playwright-kit-ops/scripts/classify_page_role.py` は次のヒューリスティックで role を推定する: ``` 入力: target_url, [既ログイン storage_state] diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/03-test-techniques.md b/plugins/ndf/skills/playwright-test-planning/docs/03-test-techniques.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/03-test-techniques.md rename to plugins/ndf/skills/playwright-test-planning/docs/03-test-techniques.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/04-playwright-mapping.md b/plugins/ndf/skills/playwright-test-planning/docs/04-playwright-mapping.md similarity index 97% rename from plugins/ndf/skills/playwright-scenario-test/docs/04-playwright-mapping.md rename to plugins/ndf/skills/playwright-test-planning/docs/04-playwright-mapping.md index 02b2a2bc..24abddcb 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/04-playwright-mapping.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/04-playwright-mapping.md @@ -121,7 +121,7 @@ playwright codegen --save-storage=auth.json example.com playwright codegen --load-storage=auth.json example.com ``` -本 Skill では `scripts/record_scenario.py` がラッパーを提供し、codegen の Python 出力をそのまま pytest テスト関数として利用する。 +本 Skill では `playwright-kit-ops/scripts/record_scenario.py` がラッパーを提供し、codegen の Python 出力をそのまま pytest テスト関数として利用する。 **「経験で書く」を「録画→生成→pytest テスト」に置換** する。 ### Trace Viewer @@ -137,7 +137,7 @@ playwright show-trace test-results//trace.zip https://trace.playwright.dev/?trace= ``` -bug report に **trace.zip の playwright.dev リンク** を必ず付与する (`scripts/upload_evidence.py --kind trace --public`)。 +bug report に **trace.zip の playwright.dev リンク** を必ず付与する (`playwright-kit-ops/scripts/upload_evidence.py --kind trace --public`)。 ### page.pause() @@ -186,7 +186,7 @@ def measure_lcp(page): })""") ``` -`scripts/check_cwv.py` が LCP/INP/CLS を一括計測. +`playwright-kit-ops/scripts/check_cwv.py` が LCP/INP/CLS を一括計測. ### モバイル / メディア diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/05-bug-report.md b/plugins/ndf/skills/playwright-test-planning/docs/05-bug-report.md similarity index 98% rename from plugins/ndf/skills/playwright-scenario-test/docs/05-bug-report.md rename to plugins/ndf/skills/playwright-test-planning/docs/05-bug-report.md index 8567ea48..074f2b1b 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/05-bug-report.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/05-bug-report.md @@ -94,7 +94,7 @@ addopts = "--tracing retain-on-failure --video retain-on-failure --screenshot on ### trace.zip の閲覧 URL 化 -`scripts/upload_evidence.py --kind trace --public` が trace.zip を Google Drive に +`playwright-kit-ops/scripts/upload_evidence.py --kind trace --public` が trace.zip を Google Drive に アップロードし、`https://trace.playwright.dev/?trace=` 形式の閲覧 URL を 生成する (HAR / video の Drive アップロードも同スクリプトで可能、`--kind har/video`)。 bug report に必ずこの URL を貼る (zip 単体だと開発者の手元で展開が必要)。 diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/06-pytest-playwright.md b/plugins/ndf/skills/playwright-test-planning/docs/06-pytest-playwright.md similarity index 99% rename from plugins/ndf/skills/playwright-scenario-test/docs/06-pytest-playwright.md rename to plugins/ndf/skills/playwright-test-planning/docs/06-pytest-playwright.md index a76f0eeb..d9378183 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/06-pytest-playwright.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/06-pytest-playwright.md @@ -157,7 +157,7 @@ v0.5.0 から、利用者プロジェクトに `init_project.sh` で埋め込ん ```bash # 1) 初期化 (Skill ディレクトリ内で 1 度だけ) -cd .claude/plugins/ndf/skills/playwright-scenario-test +cd .claude/plugins/ndf/skills/playwright-kit-ops ./scripts/init_project.sh /path/to/your-app # → /path/to/your-app/scenario-test/ 一式が作成される # (--runtime-dir e2e で配置先名カスタマイズ可) diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/README.md b/plugins/ndf/skills/playwright-test-planning/docs/README.md similarity index 98% rename from plugins/ndf/skills/playwright-scenario-test/docs/README.md rename to plugins/ndf/skills/playwright-test-planning/docs/README.md index 1ab18dea..31b7f712 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/README.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/README.md @@ -33,7 +33,7 @@ AI/人間どちらが計画書を書く場合も、まず該当 page role のチ ``` 1. 対象 URL を見て page_role を判定 → docs/02-page-roles.md の識別ヒューリスティックを使用 - → スクリプト: scripts/classify_page_role.py + → スクリプト: playwright-kit-ops/scripts/classify_page_role.py 2. 該当 role の checklist を開く → docs/checklists/checklist-{role}.md を全項目走査 diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-auth.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-auth.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-auth.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-auth.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-cart-checkout.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-cart-checkout.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-cart-checkout.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-cart-checkout.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-common.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-common.md similarity index 96% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-common.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-common.md index c6315dac..6466da43 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-common.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-common.md @@ -9,7 +9,7 @@ | # | 観点 | 技法 | oracle | 検査方法 | |---|------|------|--------|---------| -| C1.1 | axe-core 違反 0 件 | Automatic Checking | Statutes (WCAG) | `scripts/run_a11y_scan.py {url}` (axe-playwright-python). タグ `wcag2a`, `wcag2aa`, `wcag21aa`, `wcag22aa` | +| C1.1 | axe-core 違反 0 件 | Automatic Checking | Statutes (WCAG) | `playwright-kit-ops/scripts/run_a11y_scan.py {url}` (axe-playwright-python). タグ `wcag2a`, `wcag2aa`, `wcag21aa`, `wcag22aa` | | C1.2 | キーボードのみで全主要操作可能 | User Testing | Statutes (WCAG 2.1.1) | Tab で操作要素を順に踏破。手順 YAML で記録 | | C1.3 | フォーカス可視性 | User Testing | Statutes (WCAG 2.4.7, 2.4.11 New 2.2) | フォーカス時の outline / 背景色変化を確認 | | C1.4 | 見出し階層 (h1 単一 / h2 → h3 順) | Automatic | Statutes (WCAG 1.3.1) | `page.locator("h1").count() == 1` + axe `heading-order` | @@ -26,8 +26,8 @@ LCP / INP / CLS は **field metric** だが、本 Skill では Lab 計測で代 | # | 観点 | 技法 | oracle | 検査方法 / 閾値 | |---|------|------|--------|----------------| -| C2.1 | LCP ≤ 2.5s | Claims | Claims (web.dev) | `scripts/check_cwv.py --metric lcp` | -| C2.2 | CLS ≤ 0.1 | Automatic | Claims | `scripts/check_cwv.py --metric cls` | +| C2.1 | LCP ≤ 2.5s | Claims | Claims (web.dev) | `playwright-kit-ops/scripts/check_cwv.py --metric lcp` | +| C2.2 | CLS ≤ 0.1 | Automatic | Claims | `playwright-kit-ops/scripts/check_cwv.py --metric cls` | | C2.3 | INP ≤ 200ms | User Testing | Claims | INP は field 主体。Lab で `pointer-down → next paint` を計測 | | C2.4 | TTFB (server response) ≤ 800ms | Automatic | Performance | `page.expect_response` の経過時間 | diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-dashboard.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-dashboard.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-dashboard.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-dashboard.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-edit.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-edit.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-edit.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-edit.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-form.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-form.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-form.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-form.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-item.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-item.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-item.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-item.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-list.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-list.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-list.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-list.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-lp.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-lp.md similarity index 96% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-lp.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-lp.md index 44f7d046..030507e7 100644 --- a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-lp.md +++ b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-lp.md @@ -8,7 +8,7 @@ ## 必須テスト観点 ### LP1: ヒーロー領域レンダリング `[Claims / Claims]` -- LCP < 2.5s (`scripts/check_cwv.py --metric lcp`) +- LCP < 2.5s (`playwright-kit-ops/scripts/check_cwv.py --metric lcp`) - ヒーロー画像/動画の poster が空白でない - WebP / AVIF fallback が動作 @@ -59,7 +59,7 @@ ### LP10: スクロール時の CLS `[Claims / Image]` - 画像 / iframe / web font の遅延差し替えで layout shift しない (`width/height` 属性 + aspect-ratio CSS) -- CLS < 0.1 (`scripts/check_cwv.py --metric cls`) +- CLS < 0.1 (`playwright-kit-ops/scripts/check_cwv.py --metric cls`) ### LP11: 内部 anchor link `[Functional / Product]` - `#section1` の click で smooth scroll diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-modal-wizard.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-modal-wizard.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-modal-wizard.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-modal-wizard.md diff --git a/plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-search.md b/plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-search.md similarity index 100% rename from plugins/ndf/skills/playwright-scenario-test/docs/checklists/checklist-search.md rename to plugins/ndf/skills/playwright-test-planning/docs/checklists/checklist-search.md From 2938b2a3390c91c085bdf1293ce3cc90d61811d6 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 22:54:20 +0000 Subject: [PATCH 02/15] =?UTF-8?q?test:=20--pwk-no-video=20=E3=82=AA?= =?UTF-8?q?=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=A8=E5=8B=95=E7=94=BB?= =?UTF-8?q?=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=20ON=20=E3=81=AE?= =?UTF-8?q?=20failing=20tests=20=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_video_default.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py diff --git a/plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py b/plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py new file mode 100644 index 00000000..4bb9ebcb --- /dev/null +++ b/plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py @@ -0,0 +1,63 @@ +"""--pwk-no-video オプションと動画デフォルト ON の検証。 + +pytest-playwright の --video オプションが playwright_kit plugin 経由で +デフォルト 'on' に設定されること、および --pwk-no-video で 'off' に +切り替わることを pytester 経由で検証する。 +""" + +from __future__ import annotations + +import textwrap + + +def test_pwk_no_video_option_registered(pytester): + """--pwk-no-video が pytest -h に出ること。""" + pytester.makepyfile("def test_dummy(): pass\n") + res = pytester.runpytest("--help") + out = res.stdout.str() + assert "--pwk-no-video" in out + + +def test_video_default_on(pytester): + """--video 未指定時、playwright_kit が video='on' をデフォルト設定すること。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "on", f"expected 'on', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q") + res.assert_outcomes(passed=1) + + +def test_pwk_no_video_sets_off(pytester): + """--pwk-no-video 指定時、video='off' になること。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "off", f"expected 'off', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q", "--pwk-no-video") + res.assert_outcomes(passed=1) + + +def test_explicit_video_flag_takes_precedence(pytester): + """--video=retain-on-failure を明示指定した場合、pwk が上書きしないこと。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "retain-on-failure", f"expected 'retain-on-failure', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q", "--video=retain-on-failure") + res.assert_outcomes(passed=1) From 34c716897539fed551e1499c091703fa38592345 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 22:56:15 +0000 Subject: [PATCH 03/15] =?UTF-8?q?feat:=20--pwk-no-video=20=E3=82=AA?= =?UTF-8?q?=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E8=BF=BD=E5=8A=A0=20+=20?= =?UTF-8?q?=E5=8B=95=E7=94=BB=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88?= =?UTF-8?q?=20ON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playwright_kit/pytest_plugin.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py index 48fe3b02..81d7dffa 100644 --- a/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py +++ b/plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py @@ -74,6 +74,12 @@ def pytest_addoption(parser: pytest.Parser) -> None: "config の playwright.har_mode より優先。" ), ) + group.addoption( + "--pwk-no-video", + action="store_true", + default=False, + help="動画収集を明示的に OFF にする (デフォルトは全テストで動画 ON)", + ) group.addoption( "--pwk-overlay", action="store_true", @@ -136,6 +142,28 @@ def pytest_configure(config: pytest.Config) -> None: # session 中で再利用するためにキャッシュする。 config._pwk_config = cfg # type: ignore[attr-defined] + # 動画デフォルト ON (大原則: エビデンス動画を常に取得) + # ユーザーが --video を CLI で明示指定した場合はそちらを優先する。 + # --pwk-no-video 指定時は video='off' に設定する。 + # --pwk-no-evidence 指定時も video='off' に設定する (全エビデンス OFF)。 + # pytest-playwright の --video デフォルト値は 'off' であるため、 + # getoption() の返り値では明示指定の有無を判別できない。 + # invocation_params.args を走査して明示指定を検出する。 + try: + cli_args = list(config.invocation_params.args) + video_explicitly_set = any( + a == "--video" or a.startswith("--video=") for a in cli_args + ) + no_video = config.getoption("pwk_no_video", default=False) + no_evidence = config.getoption("pwk_no_evidence", default=False) + if not video_explicitly_set: + if no_video or no_evidence: + config.option.video = "off" + else: + config.option.video = "on" + except (ValueError, AttributeError): + pass + # --------------------------------------------------------------------------- # Reports / hooks From 1e859164ec3e4d28a962c32de54e31656940b4e2 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 22:57:56 +0000 Subject: [PATCH 04/15] =?UTF-8?q?feat:=20conftest=20=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=BC=E3=83=88=E3=81=AB=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ndf/skills/playwright-evidence/SKILL.md | 105 ----------------- .../templates/conftest.py.template | 11 ++ .../ndf/skills/playwright-overlay/SKILL.md | 77 ------------- .../ndf/skills/playwright-quality/SKILL.md | 109 ------------------ 4 files changed, 11 insertions(+), 291 deletions(-) delete mode 100644 plugins/ndf/skills/playwright-evidence/SKILL.md delete mode 100644 plugins/ndf/skills/playwright-overlay/SKILL.md delete mode 100644 plugins/ndf/skills/playwright-quality/SKILL.md diff --git a/plugins/ndf/skills/playwright-evidence/SKILL.md b/plugins/ndf/skills/playwright-evidence/SKILL.md deleted file mode 100644 index 2f3e46ce..00000000 --- a/plugins/ndf/skills/playwright-evidence/SKILL.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -name: playwright-evidence -description: "Playwright E2E テスト実行時のエビデンス収集 (video / trace / screenshot / HAR) を標準化する軽量スキル。pytest-playwright / Playwright Test いずれの環境でも対応。" -when_to_use: "E2E テストの実行 / エビデンス収集 / 動画・トレース・スクリーンショットの保存が必要なとき。Triggers: 'E2E テスト', 'シナリオテスト', '動画エビデンス', 'Playwright', 'テスト実行', 'リリース前確認', '回帰テスト', 'エビデンス収集', 'テスト証跡'" -allowed-tools: - - Read - - Bash(uv *) - - Bash(pytest *) - - Bash(npx *) - - Bash(playwright *) ---- - -# Playwright Evidence (エビデンス収集) - -E2E テスト実行時に **video / trace / screenshot / HAR** を確実に収集するための標準設定ガイド。 - -## エビデンスデフォルト設定 - -| 種別 | 推奨設定 | 説明 | -|---|---|---| -| video | `retain-on-failure` | 失敗テストの動画を保持 (全テスト: `on`) | -| trace | `retain-on-failure` | 失敗テストの Playwright Trace を保持 | -| screenshot | `only-on-failure` | 失敗時のスクリーンショットを自動取得 | - -## pytest-playwright 環境 - -### セットアップ済みプロジェクト (playwright_kit 使用) - -`scenario.config.yaml` のエビデンス関連設定: - -```yaml -playwright: - headless: true - viewport: { width: 1280, height: 720 } - video_size: { width: 1280, height: 720 } - enable_trace: true - video_format: mp4 -``` - -実行: - -```bash -./scenario-test/run.sh # 全テスト -./scenario-test/run.sh -k test_login # 特定テスト -./scenario-test/run.sh --pwk-no-evidence # エビデンス収集 OFF -``` - -### 素の pytest-playwright - -```bash -uv run pytest \ - --video=retain-on-failure \ - --tracing=retain-on-failure \ - --screenshot=only-on-failure \ - --output=reports/ -``` - -## Playwright Test (TypeScript) 環境 - -`playwright.config.ts`: - -```typescript -export default defineConfig({ - use: { - video: 'retain-on-failure', - trace: 'retain-on-failure', - screenshot: 'only-on-failure', - }, - outputDir: 'test-results/', - reporter: [['html', { open: 'never' }]], -}); -``` - -実行: - -```bash -npx playwright test # 全テスト -npx playwright test --ui # UI モード -npx playwright show-trace test-results/*/trace.zip # Trace Viewer -``` - -## 成果物 - -``` -reports// # pytest-playwright (playwright_kit) -├── report.md # Markdown テスト結果サマリ -├── / -│ ├── video.mp4 # テスト動画 -│ ├── trace.zip # Playwright Trace -│ ├── har.json # ネットワーク通信ログ -│ ├── console.log # console.error / console.warn -│ └── screenshot-*.png # スクリーンショット - -test-results/ # Playwright Test (TypeScript) -├── / -│ ├── video.webm # テスト動画 -│ └── trace.zip # Playwright Trace -``` - -## 関連 Skill - -- `/ndf:playwright-overlay` — 動画に字幕 + カーソルを追加 -- `/ndf:playwright-quality` — accessibility / Web Vitals 自動計測 -- `/ndf:playwright-report` — Markdown レポート生成 + Drive 共有 -- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template b/plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template index f231604e..f9de18ec 100644 --- a/plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template +++ b/plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template @@ -29,3 +29,14 @@ import pytest # @pytest.fixture # def admin_dashboard_url(pwk_config): # return f"{pwk_config.base_url}/admin/dashboard" + + +def pytest_collection_modifyitems(session, config, items): + if not items: + import warnings + + warnings.warn( + "[pwk] tests/ にテストスクリプトが見つかりません。" + "テストスクリプトを作成してから実行してください。", + stacklevel=1, + ) diff --git a/plugins/ndf/skills/playwright-overlay/SKILL.md b/plugins/ndf/skills/playwright-overlay/SKILL.md deleted file mode 100644 index a5df4f95..00000000 --- a/plugins/ndf/skills/playwright-overlay/SKILL.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -name: playwright-overlay -description: "Playwright テスト動画に赤丸カーソル + 2行字幕 (操作説明) を重ねるオーバーレイ機能。操作内容を視覚的に伝えるエビデンス動画を生成する。" -when_to_use: "テスト動画に字幕やカーソルを追加したいとき / 操作内容を視覚的に説明するエビデンス動画を作りたいとき。Triggers: '字幕', 'カーソル', 'overlay', 'HUD', '動画装飾', 'エビデンス動画', 'pwk-overlay', '赤丸'" -allowed-tools: - - Read - - Bash(uv *) - - Bash(pytest *) - - Bash(playwright *) ---- - -# Playwright Overlay (動画装飾) - -テスト動画に **赤丸カーソル + 2行字幕** を重ねて、操作内容を視覚的に伝えるエビデンス動画を生成する。 - -## 有効化 - -```bash -./scenario-test/run.sh --pwk-overlay -``` - -`--pwk-overlay` フラグで全テストの動画にオーバーレイが適用される。 - -## overlay API - -テストコード内で以下の関数を呼び出して字幕・カーソルを制御する: - -```python -from playwright_kit.overlay import set_caption, flash_click, hide_cursor -``` - -| 関数 | 説明 | -|---|---| -| `set_caption(page, previous="", next_action="")` | 2行字幕を更新 (上段: 直前の操作、下段: 次の操作) | -| `flash_click(page, x, y, settle_ms=250)` | 赤丸カーソルを (x, y) に移動 + リップルアニメーション | -| `hide_cursor(page)` | カーソルを非表示 (ナビゲーション後など) | - -## テストコード例 - -```python -from playwright.sync_api import Page, expect -from playwright_kit.overlay import set_caption, flash_click - -def test_login_scenario(page: Page, pwk_role_admin): - set_caption(page, next_action="ログインページを開く") - page.goto("/admin/login") - - set_caption(page, previous="ログインページを表示", next_action="メールアドレスを入力") - email = page.get_by_label("メールアドレス") - box = email.bounding_box() - flash_click(page, box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) - email.fill("admin@example.com") - - set_caption(page, previous="メールアドレスを入力", next_action="ログインボタンをクリック") - btn = page.get_by_role("button", name="ログイン") - box = btn.bounding_box() - flash_click(page, box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) - btn.click() - - set_caption(page, previous="ログイン成功", next_action="") - expect(page).to_have_url(lambda u: "/admin/dashboard" in u) -``` - -## 動画フォーマット - -`scenario.config.yaml` で mp4 を指定すると Drive プレビュアとの互換性が高い: - -```yaml -playwright: - video_format: mp4 # mp4 推奨 (webm も可) - video_size: { width: 1280, height: 720 } -``` - -## 関連 Skill - -- `/ndf:playwright-evidence` — 基本エビデンス収集 (overlay なし) -- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー diff --git a/plugins/ndf/skills/playwright-quality/SKILL.md b/plugins/ndf/skills/playwright-quality/SKILL.md deleted file mode 100644 index 8eb63e1f..00000000 --- a/plugins/ndf/skills/playwright-quality/SKILL.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -name: playwright-quality -description: "Playwright テスト実行時の品質自動計測。accessibility (axe-core / WCAG)、Core Web Vitals (LCP/CLS/TTFB)、body_check (PHP/SSR エラー検出) を page role marker に連動して自動実行する。" -when_to_use: "accessibility チェック / Core Web Vitals 計測 / PHP エラー検出が必要なとき。Triggers: 'a11y テスト', 'accessibility テスト', 'axe-core', 'WCAG', 'Core Web Vitals', 'Web Vitals', 'LCP', 'CLS', 'body_check', 'PHP エラー検出'" -allowed-tools: - - Read - - Bash(uv *) - - Bash(pytest *) - - Bash(python *) ---- - -# Playwright Quality (品質自動計測) - -E2E テスト実行時に **accessibility / Core Web Vitals / body_check** を自動計測する。 - -## accessibility (axe-core) - -`@pytest.mark.page_role` marker が付いたテストで、auto_roles にマッチする role の場合に axe-core を自動実行。 - -### 設定 (scenario.config.yaml) - -```yaml -accessibility: - enabled: true - auto_roles: [lp, list, form, dashboard, cart, checkout, settings, auth] - tags: [wcag2a, wcag2aa, wcag21aa, wcag22aa] - fail_on_violations: true -``` - -### テストコードでの手動実行 - -```python -def test_form_accessibility(page, pwk_accessibility_scan): - page.goto("/contact") - violations = pwk_accessibility_scan() - assert len(violations) == 0, f"{len(violations)} violations found" -``` - -### 単発スキャン (テスト外) - -> スクリプトの実行は `/ndf:playwright-kit-ops` skill を参照。 - -```bash -# playwright-kit-ops/ ディレクトリ内で実行 -python scripts/run_a11y_scan.py --url https://example.com -``` - -## Core Web Vitals - -`@pytest.mark.page_role` marker + auto_roles マッチで LCP / CLS / TTFB / longest_task を自動計測。 - -### 設定 (scenario.config.yaml) - -```yaml -web_vitals: - enabled: true - auto_roles: [lp, list, dashboard, search] - observe_ms: 5000 - fail_on_poor: true -``` - -### テストコードでの手動計測 - -```python -def test_dashboard_performance(page, pwk_web_vitals_measure): - page.goto("/dashboard") - metrics = pwk_web_vitals_measure() - assert metrics["lcp"]["rating"] != "poor" -``` - -### 単発計測 (テスト外) - -> スクリプトの実行は `/ndf:playwright-kit-ops` skill を参照。 - -```bash -# playwright-kit-ops/ ディレクトリ内で実行 -python scripts/check_cwv.py --url https://example.com -``` - -## body_check (PHP/SSR エラー検出) - -`page.on("response")` で全 HTML レスポンスを監視し、`Fatal error` / `Warning:` 等の文字列パターンを検出する。**デフォルトで有効** (PHP 系パターン内蔵)。 - -### 設定 (scenario.config.yaml) - -```yaml -body_check: - enabled: true - fatal_patterns: ["Fatal error", "Uncaught", "Parse error"] - warning_patterns: ["STRICT:", "Warning:", "Notice:", "Deprecated:"] - warning_head_chars: 300 - fail_on_match: true -``` - -### Opt-out - -```python -@pytest.mark.no_body_check -def test_known_warning_page(page): - page.goto("/legacy") -``` - -非 PHP プロジェクトで誤検出する場合は `body_check.enabled: false` で無効化。 - -## 関連 Skill - -- `/ndf:playwright-evidence` — 基本エビデンス収集 -- `/ndf:playwright-report` — 品質計測結果を含むレポート生成 -- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー From 658b77443e40fd7af657631a518f67be7254f930 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 22:57:57 +0000 Subject: [PATCH 05/15] =?UTF-8?q?feat:=20run.sh=20=E3=81=AB=20--video=3Don?= =?UTF-8?q?=20=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=20+=20--pwk-no?= =?UTF-8?q?-video=20=E5=AF=BE=E5=BF=9C=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ndf/skills/playwright-kit-ops/templates/run.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh index ea01aee2..069cdbfc 100755 --- a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh +++ b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh @@ -33,6 +33,7 @@ scenario-test ランタイムランチャ --pwk-config scenario.config.yaml のパス (env PWK_CONFIG でも可) --pwk-out-dir 成果物出力先 (default: ./reports//) --pwk-no-evidence HAR / trace / 動画 を OFF + --pwk-no-video 動画収集を OFF (デフォルトは全テストで動画 ON) --pwk-har-mode {minimal,full,none} HAR 録画モード (default: minimal) --pwk-overlay 動画に赤丸カーソル + 字幕 (旧名 HUD) を焼き込む @@ -83,6 +84,18 @@ fi # --- 3) pytest 実行 ------------------------------------------------ cd "$RUNTIME_DIR" + +# --pwk-no-video が引数に含まれていなければ --video=on をデフォルト追加。 +# pytest_plugin.py 側でもデフォルト注入するが、run.sh 経由の場合は +# 明示的に渡すことで --video の優先度を確保する。 +VIDEO_FLAG="--video=on" +for arg in "$@"; do + case "$arg" in + --pwk-no-video|--pwk-no-evidence) VIDEO_FLAG="" ;; + esac +done + exec uv run pytest \ --pwk-config="${PWK_CONFIG:-./scenario.config.yaml}" \ + $VIDEO_FLAG \ "$@" From 07d77f041b167af8e3cde98f1648092a7c044e02 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 22:59:49 +0000 Subject: [PATCH 06/15] =?UTF-8?q?feat:=20playwright-execution=20=E3=82=B9?= =?UTF-8?q?=E3=82=AD=E3=83=AB=E8=BF=BD=E5=8A=A0=20(evidence+overlay+qualit?= =?UTF-8?q?y=20=E7=B5=B1=E5=90=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ndf/skills/playwright-execution/SKILL.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 plugins/ndf/skills/playwright-execution/SKILL.md diff --git a/plugins/ndf/skills/playwright-execution/SKILL.md b/plugins/ndf/skills/playwright-execution/SKILL.md new file mode 100644 index 00000000..387838fd --- /dev/null +++ b/plugins/ndf/skills/playwright-execution/SKILL.md @@ -0,0 +1,98 @@ +name: playwright-execution +description: "Playwright E2E テストの実行 + エビデンス収集 (video/trace/screenshot/HAR) + overlay (赤丸カーソル+字幕) + 品質計測 (axe-core/Web Vitals/body_check) を統合した実行フェーズスキル。動画はデフォルト ON。" +when_to_use: "E2E テストの実行 / エビデンス収集 / 動画エビデンス / accessibility チェック / Core Web Vitals 計測が必要なとき。テストスクリプト作成済みであることが前提。Triggers: 'E2E テスト実行', 'テスト実行', '動画エビデンス', 'エビデンス収集', 'テスト証跡', 'a11y テスト', 'accessibility テスト', 'axe-core', 'WCAG', 'Core Web Vitals', 'Web Vitals', 'LCP', 'CLS', 'body_check', 'overlay', '字幕', 'カーソル'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(npx *) + - Bash(playwright *) + - Bash(python *) +--- + +# Playwright Execution (テスト実行 + エビデンス収集) + +テストスクリプト作成済みの状態で E2E テストを実行し、エビデンスを収集する。 + +## 前提条件 + +- テストスクリプトが `tests/` に作成済みであること (`/ndf:playwright-script-creation` で作成) +- `scenario.config.yaml` が設定済みであること + +## 大原則 + +**エビデンス動画はデフォルト ON**。全テストで常に動画を取得する。 +明示的にスキップする場合のみ `--pwk-no-video` を指定する。 + +## 実行コマンド + +```bash +./scenario-test/run.sh # 全テスト (動画 ON) +./scenario-test/run.sh -k test_admin # フィルタ +./scenario-test/run.sh --pwk-overlay # 字幕 + カーソル付き動画 +./scenario-test/run.sh --pwk-no-video # 動画のみ OFF +./scenario-test/run.sh --pwk-no-evidence # 全エビデンス OFF (HAR/trace/動画) +``` + +## エビデンス種別 + +| 種別 | デフォルト | OFF フラグ | 説明 | +|---|---|---|---| +| video | **ON** | `--pwk-no-video` | 全テストの動画を取得 | +| trace | ON (retain-on-failure) | `--pwk-no-evidence` | Playwright Trace (DOM + 操作ログ) | +| HAR | ON (minimal) | `--pwk-har-mode none` | ネットワーク通信ログ | +| screenshot | ON (only-on-failure) | `--pwk-no-evidence` | 失敗時スクリーンショット | + +## overlay (赤丸カーソル + 字幕) + +`--pwk-overlay` フラグで全テストの動画にオーバーレイが適用される。 + +API 詳細・使用例は `playwright_kit/overlay.py` を参照。主要関数: `set_caption()`, `flash_click()`, `hide_cursor()`。 + +## 品質計測 + +### accessibility (axe-core) + +`@pytest.mark.page_role` marker が付いたテストで auto_roles にマッチする場合に自動実行。 +設定は `scenario.config.yaml` の `accessibility:` セクションで制御。→ 設定例は `templates/scenario.config.yaml` を参照。 + +### Core Web Vitals + +`@pytest.mark.page_role` marker + auto_roles マッチで LCP/CLS/TTFB/longest_task を自動計測。 +設定は `scenario.config.yaml` の `web_vitals:` セクションで制御。→ 設定例は `templates/scenario.config.yaml` を参照。 + +### body_check (PHP/SSR エラー検出) + +`page.on("response")` で全 HTML レスポンスを監視し、`Fatal error` 等を検出。デフォルト有効。 +`@pytest.mark.no_body_check` で個別 opt-out 可能。→ 設定例は `templates/scenario.config.yaml` の `body_check:` セクションを参照。 + +## 成果物 + +``` +reports// +├── report.md # テスト結果サマリ +├── / +│ ├── video.mp4 # テスト動画 (デフォルト ON) +│ ├── trace.zip # Playwright Trace +│ ├── request.har # ネットワーク通信ログ +│ ├── body_check.jsonl # body_check 違反詳細 +│ └── screenshot-*.png # スクリーンショット +``` + +## CLI options + +| option | 役割 | +|---|---| +| `--pwk-config ` | `scenario.config.yaml` のパス | +| `--pwk-out-dir ` | 成果物出力先 (default: `reports//`) | +| `--pwk-no-video` | 動画収集を OFF (デフォルトは ON) | +| `--pwk-no-evidence` | HAR / trace / video の収集を全て OFF | +| `--pwk-har-mode {minimal,full,none}` | HAR 録画モード (default: minimal) | +| `--pwk-overlay` | overlay (赤丸カーソル + 字幕) を ON | + +## 関連 Skill + +- `/ndf:playwright-script-creation` — テストスクリプト作成 (実行の前段) +- `/ndf:playwright-report` — Markdown レポート生成 +- `/ndf:playwright-kit-ops` — スクリプト実行 (init_project / スキャン) +- `/ndf:playwright-scenario-test` — 全機能統括 From 372fade02f86c3c5631afdb61ffa767db9aebff8 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:00:30 +0000 Subject: [PATCH 07/15] =?UTF-8?q?feat:=20playwright-script-creation=20?= =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=AB=E8=BF=BD=E5=8A=A0=20(=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E3=82=AC=E3=82=A4=E3=83=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playwright-script-creation/SKILL.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 plugins/ndf/skills/playwright-script-creation/SKILL.md diff --git a/plugins/ndf/skills/playwright-script-creation/SKILL.md b/plugins/ndf/skills/playwright-script-creation/SKILL.md new file mode 100644 index 00000000..26a355e8 --- /dev/null +++ b/plugins/ndf/skills/playwright-script-creation/SKILL.md @@ -0,0 +1,107 @@ +name: playwright-script-creation +description: "再現可能な E2E テストスクリプトを作成するガイド。テンプレートを起点にテストコードを実装し、再現可能性レビューを経てからテスト実行フェーズに進む。ndf plugin 非依存で動作する。" +when_to_use: "E2E テストスクリプトの作成 / テストコードの実装 / テストテンプレートからのスクリプト生成が必要なとき。Triggers: 'テストスクリプト作成', 'テストコード作成', 'テスト実装', 'テストを書く', 'シナリオ作成', 'codegen', 'テンプレートからテスト', 'playwright codegen'" +allowed-tools: + - Read + - Edit + - Write + - Bash(uv *) + - Bash(playwright *) + - Bash(python *) +--- + +# Playwright Script Creation (テストスクリプト作成) + +再現可能なテストスクリプトを作成し、レビューを経てからテスト実行に進む。 + +## 大原則 + +**テストスクリプトを実装してからテストを実施する。** +スクリプトが完成・レビューを経るまで `/ndf:playwright-execution` に進まない。 + +## 前提条件 + +- テスト計画が完了していること (`/ndf:playwright-test-planning` で計画済み) +- `init_project.sh` でプロジェクトが初期化済みであること (`/ndf:playwright-kit-ops`) + +## ワークフロー + +``` +[A] テスト計画の確認 (チェックリスト / page role / テスト技法) + │ +[B] テンプレート選択 + │ tests/ 配下の test_*.py.template を起点にする + ▼ +[C] テストコード実装 + │ playwright codegen で操作を記録 → テスト関数に組み込む + │ または手動で expect() ベースの assertion を書く + ▼ +[D] 再現可能性レビュー (下記チェックリスト) + │ +[E] テスト実行へ → /ndf:playwright-execution +``` + +## テンプレート一覧 + +`init_project.sh` で以下のテンプレートが `tests/` に配置済み: + +| テンプレート | page role | 内容 | +|---|---|---| +| `test_auth.py` | auth | ログイン / ログアウトフロー | +| `test_list.py` | list | 一覧ページネーション / ソート | +| `test_form.py` | form | 入力 → 送信 → 結果検証 | +| `test_dashboard.py` | dashboard | KPI / リンク遷移 | + +## テストコードの書き方 + +### テンプレートを起点にする + +各 page role のテンプレートが `templates/test_*.py.template` に用意されている。 +`init_project.sh` 実行時に `tests/` へコピーされるので、プロジェクト固有の URL やセレクタを書き換えて使う。 + +→ コード例: `templates/test_form.py.template`, `templates/test_auth.py.template` 等を参照 + +### playwright codegen での操作記録 + +`uv run playwright codegen ` で操作を記録し、生成コードをテスト関数にコピーする。 +コピー後に `@pytest.mark.page_role()`, `@pytest.mark.role()`, `expect()` assertion, `pwk_config.base_url` を追加する。 + +### overlay 付きテスト + +overlay API (`set_caption`, `flash_click`) の使用例は `playwright_kit/overlay.py` を参照。 + +## fixture / marker 一覧 + +fixture / marker の完全な一覧は `playwright_kit/pytest_plugin.py` の `_PWK_MARKERS` 定義と `playwright_kit/fixtures/` 配下の各モジュールを参照。 + +主な fixture: `pwk_config`, `pwk_role_`, `pwk_evidence`, `pwk_accessibility_scan()`, `pwk_web_vitals_measure()` +主な marker: `@pytest.mark.page_role()`, `@pytest.mark.role()`, `@pytest.mark.phase()`, `@pytest.mark.priority()`, `@pytest.mark.no_body_check` + +## 再現可能性レビューチェックリスト + +スクリプト完成後、以下を全項目確認してからテスト実行に進む: + +- [ ] **再現可能性**: 同じ環境で同じ結果が得られるか (ランダム値・タイムスタンプに依存していないか) +- [ ] **テストデータ独立性**: 外部の状態に依存せず、テスト単体で成立するか +- [ ] **marker 付与**: `@pytest.mark.page_role()` が全テスト関数に付与されているか +- [ ] **role marker**: 認証が必要なテストに `@pytest.mark.role()` + `pwk_role_` fixture があるか +- [ ] **assertion 網羅性**: 正常系 + 少なくとも 1 つの異常系 (バリデーション等) が含まれるか +- [ ] **URL 構築**: ハードコードされた URL ではなく `pwk_config.base_url` を使用しているか +- [ ] **wait 戦略**: `wait_until="domcontentloaded"` 等の明示的な待機指定があるか +- [ ] **ndf plugin 非依存**: `scenario-test/` ディレクトリ単体で実行可能か + +## ndf plugin 非依存 + +`init_project.sh` で埋め込まれた `scenario-test/` は: +- `playwright_kit/` パッケージ本体を含む +- `pyproject.toml` で pytest11 entry-point を定義 +- `run.sh` でワンコマンド実行可能 + +→ ndf plugin 未インストール環境でも `./scenario-test/run.sh` で動作する。 + +## 関連 Skill + +- `/ndf:playwright-test-planning` — テスト計画 (前段) +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 (後段) +- `/ndf:playwright-kit-ops` — init_project / codegen 等のツール群 +- `/ndf:playwright-scenario-test` — 全機能統括 From ab0ff15bb28946bf190860f1fbd5e598a1d8c608 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:01:30 +0000 Subject: [PATCH 08/15] =?UTF-8?q?Update:=20playwright-report=20=E3=81=8B?= =?UTF-8?q?=E3=82=89=20Drive=20=E5=85=B1=E6=9C=89=E3=82=BB=E3=82=AF?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/ndf/skills/playwright-report/SKILL.md | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/plugins/ndf/skills/playwright-report/SKILL.md b/plugins/ndf/skills/playwright-report/SKILL.md index 916aab4f..c31959cd 100644 --- a/plugins/ndf/skills/playwright-report/SKILL.md +++ b/plugins/ndf/skills/playwright-report/SKILL.md @@ -42,35 +42,8 @@ report: phase_labels: {} ``` -## Google Drive アップロード - -### テスト実行時に自動アップロード - -```bash -./scenario-test/run.sh --pwk-drive-folder= -``` - -`--pwk-drive-folder` を指定すると、テスト終了後に report.md + エビデンスファイルが Drive にアップロードされる。 - -### 手動アップロード - -```bash -# エビデンスファイルを Drive にアップロード -python playwright-kit-ops/scripts/upload_evidence.py --kind trace - -# ディレクトリごとアップロード -python playwright-kit-ops/scripts/gdrive_upload_dir.py reports// --folder-id - -# report.md を Google Doc として変換・アップロード -python playwright-kit-ops/scripts/upload_md_as_gdoc.py reports//report.md - -# Google Doc にエビデンスの Drive リンクを埋め込み -python playwright-kit-ops/scripts/build_gdoc_with_drive_links.py reports// -``` - ## 関連 Skill -- `/ndf:playwright-evidence` — 基本エビデンス収集 -- `/ndf:playwright-quality` — レポートに含まれる品質計測 -- `/ndf:google-drive` — Google Drive 操作全般 +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 +- `/ndf:playwright-kit-ops` — エビデンスアップロードツール (Drive 連携が必要な場合) - `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー From 8a7118bbb4f77c7a8be023ae6be75da644a14c03 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:01:31 +0000 Subject: [PATCH 09/15] =?UTF-8?q?Update:=20playwright-test-planning=20?= =?UTF-8?q?=E3=81=AB=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=83=95=E3=82=A7=E3=83=BC=E3=82=BA=E3=81=B8=E3=81=AE?= =?UTF-8?q?=E5=B0=8E=E7=B7=9A=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- plugins/ndf/skills/playwright-test-planning/SKILL.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/ndf/skills/playwright-test-planning/SKILL.md b/plugins/ndf/skills/playwright-test-planning/SKILL.md index 1eabde57..2bb6a587 100644 --- a/plugins/ndf/skills/playwright-test-planning/SKILL.md +++ b/plugins/ndf/skills/playwright-test-planning/SKILL.md @@ -24,6 +24,10 @@ HTSM / ISTQB / FEW HICCUPPS に基づいて E2E テストシナリオを計画 [D] 必須テスト技法を確定 → docs/03-test-techniques.md § 11 ▼ [E] pytest テストを書く → templates/test_.py.template を起点に + ▼ +[F] スクリプト作成へ → /ndf:playwright-script-creation + テスト計画が確定したら、テストスクリプトの作成に進む。 + テスト計画が完了するまでスクリプト作成には進まない。 ``` ## page role 一覧 @@ -88,5 +92,6 @@ python scripts/record_scenario.py ## 関連 Skill -- `/ndf:playwright-evidence` — テスト実行 + エビデンス収集 +- `/ndf:playwright-script-creation` — テストスクリプト作成 (次のフェーズ) +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 - `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー From 3cab7a8cd27bc62ec8484b592986232907fc3ae1 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:03:15 +0000 Subject: [PATCH 10/15] =?UTF-8?q?Update:=20playwright-scenario-test=20orch?= =?UTF-8?q?estrator=20=E3=82=92=205=20=E3=82=B9=E3=82=AD=E3=83=AB=E6=A7=8B?= =?UTF-8?q?=E6=88=90=E3=81=AB=E6=94=B9=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skills/playwright-scenario-test/SKILL.md | 339 +++--------------- 1 file changed, 41 insertions(+), 298 deletions(-) diff --git a/plugins/ndf/skills/playwright-scenario-test/SKILL.md b/plugins/ndf/skills/playwright-scenario-test/SKILL.md index faed4ceb..e332f17f 100644 --- a/plugins/ndf/skills/playwright-scenario-test/SKILL.md +++ b/plugins/ndf/skills/playwright-scenario-test/SKILL.md @@ -1,7 +1,7 @@ --- name: playwright-scenario-test -description: "pytest-playwright ベースのフル E2E テストフレームワーク統括。テスト計画・エビデンス収集・動画装飾・品質計測・レポート生成の 5 機能を組み合わせた包括的なテストワークフローを提供する。個別機能のみ必要な場合は各専門 skill を直接参照。" -when_to_use: "フル E2E テストワークフロー (計画→実行→エビデンス→品質→レポート) を一貫して行うとき / pytest-playwright 拡張 fixture (pwk_*) の全体像を把握したいとき / init_project.sh でプロジェクトをセットアップするとき。Triggers: 'pytest-playwright', 'pwk_role', 'pwk_evidence', 'init_project', 'シナリオテスト一式', 'フル E2E'" +description: "pytest-playwright ベースのフル E2E テストフレームワーク統括。テスト計画・スクリプト作成・エビデンス付きテスト実行・レポート生成の 4 フェーズを組み合わせた包括的なテストワークフローを提供する。個別機能のみ必要な場合は各専門 skill を直接参照。" +when_to_use: "フル E2E テストワークフロー (計画→スクリプト→実行→レポート) を一貫して行うとき / pytest-playwright 拡張 fixture (pwk_*) の全体像を把握したいとき / init_project.sh でプロジェクトをセットアップするとき。Triggers: 'pytest-playwright', 'pwk_role', 'pwk_evidence', 'init_project', 'シナリオテスト一式', 'フル E2E'" allowed-tools: - Read - Bash(uv *) @@ -10,314 +10,57 @@ allowed-tools: - Bash(python *) --- -# Playwright シナリオテスト Skill (v0.5.0) +# Playwright シナリオテスト Skill (v0.6.0) -Web アプリの E2E シナリオを **理論ベース** で計画し、**pytest-playwright** 上で実行、**動画 + Markdown レポート + accessibility / web vitals** を自動収集する一式の Skill。 +Web アプリの E2E シナリオを **理論ベース** で計画し、**再現可能なテストスクリプトを実装してから**、**pytest-playwright** 上でエビデンス動画付きで実行、Markdown レポートを自動生成する一式の Skill。 -## 機能別 Skill +## 大原則 -個別機能のみ必要な場合は、以下の専門 skill を直接参照: +1. **再現可能なテストスクリプトを実装してからテストを実施する** +2. **テストスクリプトは ndf plugin 非依存でプロジェクトフォルダに設置する** +3. **テスト実行はエビデンス動画を常に取得する** (オプションで明示的にスキップ可能) -| Skill | 機能 | -|---|---| -| `/ndf:playwright-test-planning` | テスト計画 (HTSM / page role / チェックリスト) | -| `/ndf:playwright-evidence` | エビデンス収集 (video / trace / screenshot) | -| `/ndf:playwright-overlay` | 動画装飾 (字幕 + カーソル) | -| `/ndf:playwright-quality` | 品質計測 (accessibility / Web Vitals / body_check) | -| `/ndf:playwright-report` | レポート生成 + Drive 共有 | -| `/ndf:playwright-kit-ops` | スクリプト実行 (init_project / スキャン / アップロード) | +## フェーズ別 Skill -以下は全機能を組み合わせたフルワークフローの案内。 - -**v0.5.0 の方針**: 本 Skill は「テストを書き始めるためのスキャフォルダ」であり、`scripts/init_project.sh` で利用者プロジェクトに **all-in-one ディレクトリ** を埋め込んだ後は、Skill ディレクトリの存在に依存せず単独で動作する (CI / 別マシン / Skill 非導入のメンバー環境でも完結)。 - -## 用語集 - -ドメイン略語と正式名・意味の対応表。 - -| 略語 / 用語 | 正式名 / 意味 | -|---|---| -| accessibility (旧 a11y) | Web アクセシビリティ。WCAG 準拠を axe-core で機械検査 | -| web vitals (旧 CWV) | Google が定義する「ユーザ体感パフォーマンス指標」群 | -| LCP | Largest Contentful Paint — 最大コンテンツ描画時間 (体感ロード速度) | -| CLS | Cumulative Layout Shift — 累積レイアウトずれ量 (視覚的安定性) | -| TTFB | Time To First Byte — 初バイト到達時間 (サーバ応答速さ) | -| longest_task | Long Tasks API で観測した最長タスクのミリ秒値 (応答性代理指標) | -| HAR | HTTP Archive — ネットワーク通信ログのファイル形式 | -| trace | Playwright Trace — DOM スナップショット + 操作ログ + 動画の zip | -| overlay (旧 HUD) | テスト中に画面に重ねる赤丸カーソル + 字幕表示 | -| body_check | サーバが HTML 本文に出力した PHP/SSR エラー文字列の検出 | -| page role | LP / 一覧 / 詳細 / フォーム 等のページ種別。a11y / web vitals 自動実行の判定材料 | -| pwk | playwright_kit の略。fixture (`pwk_*`) / CLI option (`--pwk-*`) / env (`PWK_*`) の prefix | - -## 提供物 - -``` -playwright-scenario-test/ ← Skill 自体 (この Skill ディレクトリ) -├── SKILL.md ← このファイル -├── pyproject.toml ← Skill 開発用 (pytest entry-point 含む) -├── playwright_kit/ ← Python パッケージ本体 (旧 scenario_test) -│ ├── pytest_plugin.py ← pytest11 entry-point (addoption / markers / hooks) -│ ├── pytest_report.py ← report.md 生成 -│ ├── fixtures/ ← pytest fixtures -│ │ ├── auth.py — pwk_config / pwk_role_ -│ │ ├── evidence.py — pwk_evidence (HAR / trace / console / pageerror) -│ │ ├── accessibility.py — page_role marker autouse で axe-core -│ │ ├── web_vitals.py — page_role marker autouse で Core Web Vitals -│ │ └── body_check.py — page.on("response") で本文エラー文字列を検出 -│ ├── accessibility.py / web_vitals.py — axe-core / Web Vitals ランナー (純関数) -│ ├── overlay.py ← 赤丸カーソル + 字幕 (旧 HUD) JS -│ ├── video.py ← webm → mp4 変換 -│ └── config.py ← scenario.config.yaml ローダ -├── docs/ ← テスト方法論 (HTSM / ISTQB / FEW HICCUPPS) -├── (scripts/ は playwright-kit-ops/ skill に移動) -│ └── → /ndf:playwright-kit-ops を参照 -└── templates/ ← 利用者プロジェクト用雛形 - ├── pyproject.toml.runtime — runtime 用 pyproject (dev 用 deps を排除) - ├── runtime-gitignore — .venv / __pycache__ / reports/ - ├── runtime-README.md — Skill 無し環境向けの最低限の使い方 - ├── run.sh / run.bat — ワンコマンドランチャ - ├── scenario.config.yaml — base_url / roles / accessibility / web_vitals 設定 - ├── conftest.py.template — 利用者の conftest.py 雛形 - └── test_*.py.template — auth / list / form / dashboard 雛形 -``` - -init 後の利用者プロジェクト側 (Skill 非依存): - -``` -your-app/ -└── scenario-test/ ← all-in-one ランタイム (--runtime-dir で名前変更可) - ├── playwright_kit/ ← Python パッケージ本体 - ├── scripts/ ← 補助 CLI - ├── tests/ ← 利用者の pytest テスト - │ ├── conftest.py - │ └── test_*.py - ├── reports/ ← 実行結果 (.gitignore 推奨) - ├── scenario.config.yaml ← 利用者の設定 - ├── run.sh / run.bat ← ワンコマンドランチャ - ├── pyproject.toml ← runtime 用 (testpaths=["tests"]) - ├── uv.lock ← 再現性のため commit 推奨 - └── README.md ← runtime-README.md コピー -``` - -## クイックスタート - -```bash -# 1) このディレクトリ (Skill) で利用者プロジェクトを初期化 -cd .claude/plugins/ndf/skills/playwright-scenario-test # Skill のパスは環境による -./scripts/init_project.sh /path/to/your-app -# → /path/to/your-app/scenario-test/ 一式が作成され、uv sync + chromium install -# まで完了する - -# オプション: 配置先ディレクトリ名をカスタマイズ -./scripts/init_project.sh /path/to/your-app --runtime-dir e2e -# → /path/to/your-app/e2e/ - -# Windows -scripts\init_project.bat C:\path\to\your-app - -# 2) base_url / roles を編集 -$EDITOR /path/to/your-app/scenario-test/scenario.config.yaml - -# 3) tests/ にテストを追加 (init 時に test_auth/list/form/dashboard 雛形は配置済) -$EDITOR /path/to/your-app/scenario-test/tests/test_admin.py - -# 4) 実行 -cd /path/to/your-app -./scenario-test/run.sh # 全テスト -./scenario-test/run.sh -k test_admin # nodeid フィルタ -./scenario-test/run.sh --pwk-overlay # 動画に赤丸カーソル + 字幕 -./scenario-test/run.sh --pwk-drive-folder= # Drive 自動アップロード -``` - -→ 以降このディレクトリ (Skill) は不要。`your-app/scenario-test/` 単体で完結する。 - -### 複数ランタイム共存 - -```bash -./scripts/init_project.sh your-app --runtime-dir e2e-prod -./scripts/init_project.sh your-app --runtime-dir e2e-staging -# → your-app/e2e-prod/run.sh と your-app/e2e-staging/run.sh が独立に動く -``` - -## 利用者は通常の pytest テストを書く - -```python -# tests/test_admin_dashboard.py -import pytest -from playwright.sync_api import Page, expect - -@pytest.mark.page_role("dashboard") -@pytest.mark.role("admin") -def test_admin_kpi_view(page: Page, pwk_role_admin): - page.goto("/admin/dashboard") - expect(page.get_by_role("heading", name="売上サマリ")).to_be_visible() - page.get_by_role("link", name="ユーザ管理").click() - expect(page).to_have_url(lambda u: "/admin/users" in u) -``` - -提供 fixture / marker: - -| 提供 | 種別 | 役割 | +| Phase | Skill | 機能 | |---|---|---| -| `pwk_config` | session fixture | `scenario.config.yaml` をロード (Config dataclass) | -| `pwk_role_` | function fixture (動的) | 該当 role で login 済の storage_state を context に注入 | -| `pwk_evidence` | function fixture | HAR / trace / console.error / pageerror / body_check の集中管理 | -| `pwk_accessibility_scan()` | helper | 任意のタイミングで axe-core を 1 回実行 | -| `pwk_web_vitals_measure()` | helper | 任意のタイミングで Web Vitals を 1 回計測 | -| `pwk_body_check_scan()` | helper | 任意のタイミングで現在の page 本文を 1 回 body_check | -| `@pytest.mark.page_role("form")` | marker | accessibility / web_vitals autouse の判定 (auto_roles 設定に従う) | -| `@pytest.mark.role("admin")` | marker | report.md 集計用 (login 自体は `pwk_role_` fixture) | -| `@pytest.mark.phase(1)` | marker | report.md フェーズ集計 | -| `@pytest.mark.priority("high")` | marker | report.md ソート | -| `@pytest.mark.no_body_check` | marker | body_check autouse をこの test では skip | - -### body_check (PHP / SSR エラー検出, v0.4.0+) +| 1 | `/ndf:playwright-test-planning` | テスト計画 (HTSM / page role / チェックリスト) | +| 2 | `/ndf:playwright-script-creation` | テストスクリプト作成 (テンプレート→実装→レビュー) | +| 3 | `/ndf:playwright-execution` | テスト実行 + エビデンス収集 (video/trace/overlay/quality) | +| 4 | `/ndf:playwright-report` | レポート生成 (Markdown) | +| -- | `/ndf:playwright-kit-ops` | ツール群 (init_project / スキャン / アップロード) | -PHP / SSR が HTML 本文に直接出力した `Fatal error` / `Warning:` / `STRICT:` 等の -エラー文字列は console.error / pageerror では拾えない。`body_check` は -`page.on("response")` で全 HTML レスポンスを監視し、文字列パターンとの substring -一致で violation を記録する。**default で enabled + PHP 系パターン内蔵** なので、 -config を書かなくても PHP プロジェクトでまず動く。 +## 標準ワークフロー -パターンを上書きしたい場合のみ `scenario.config.yaml` で明示する: - -```yaml -# scenario.config.yaml (省略可) -body_check: - enabled: true - fatal_patterns: ["Fatal error", "Uncaught", "Parse error"] - warning_patterns: ["STRICT:", "Warning:", "Notice:", "Deprecated:"] - warning_head_chars: 300 # warning_patterns は本文先頭 N 文字のみ走査 (旧名 warning_head_bytes も alias) - not_found_patterns: ["File not found"] - fail_on_match: true # false で情報収集モード (PASS のまま report に記録) ``` - -- 違反は `case_dir/body_check.jsonl` に 1 violation = 1 行で出力 (`jq`/`grep` - で集計しやすいよう flat structure にしている) -- `report.md` のサマリ表に `body_check` カラムが、件数 > 0 の場合は詳細セクション - (URL / pattern / snippet) が出力される -- 機能ごと無効化したい場合は `body_check.enabled: false` を明示 -- 個別カテゴリのみ無効化したい場合は `fatal_patterns: []` のように明示空指定 -- 個別 test で skip したい場合は `@pytest.mark.no_body_check` を付与 -- 非 PHP プロジェクトでは default の `Notice:` / `Warning:` 等が誤検出になる - 場合あり。その場合は `warning_patterns: []` で warning カテゴリだけ無効化するか - `enabled: false` で機能ごと off にする - -## CLI options - -ランチャ経由 (`./run.sh` / `run.bat`) でも、`uv run pytest` を直接呼んでも、同じ option がそのまま効く。 - -| option | 役割 | -|---|---| -| `--pwk-config ` | `scenario.config.yaml` のパス。env `PWK_CONFIG` / CWD の同名ファイルでも可 | -| `--pwk-out-dir ` | 成果物出力先 (default: `reports//`) | -| `--pwk-no-evidence` | HAR / trace / video の収集を OFF | -| `--pwk-har-mode {minimal,full,none}` | HAR 録画モード (default: minimal、Issue #62) | -| `--pwk-overlay` | overlay (赤丸カーソル + 字幕、旧名 HUD) を全 page に inject | -| `--pwk-drive-folder ` | session 終了時に report.md と evidence を Drive アップロード | - -pytest 標準と組み合わせて使える: - -```bash -# page_role marker が付いたテストだけ実行 -./scenario-test/run.sh -m "page_role" - -# 4 worker で並列実行 -./scenario-test/run.sh -n 4 - -# 動画レポートを Drive へ自動アップロード -./scenario-test/run.sh --pwk-drive-folder= - -# pytest-html を組み合わせて HTML report も -./scenario-test/run.sh --html=reports/index.html --self-contained-html +[Phase 1] テスト計画 (/ndf:playwright-test-planning) + │ 対象 URL → page role 判定 → チェックリスト → テスト技法確定 + ▼ +[Phase 2] スクリプト作成 (/ndf:playwright-script-creation) + │ テンプレート選択 → テストコード実装 → 再現可能性レビュー + │ ※ スクリプトが完成するまでテスト実行に進まない + ▼ +[Phase 3] テスト実行 + エビデンス収集 (/ndf:playwright-execution) + │ 動画デフォルト ON → trace/HAR/overlay/a11y/CWV/body_check + │ ※ --pwk-no-video で動画のみスキップ可 + ▼ +[Phase 4] レポート生成 (/ndf:playwright-report) + │ reports//report.md 自動生成 + ▼ +[任意] ツール群 (/ndf:playwright-kit-ops) + init_project / スキャン / アップロード (任意タイミング) ``` -## 標準ワークフロー (理論ベース計画) - -``` -[A] 対象 URL を渡される - │ -[B] page role を判定 playwright-kit-ops/scripts/classify_page_role.py --url - ▼ -[C] 該当 checklist を開く docs/checklists/checklist-{role}.md - │ 全項目を「適用」or「不適用 (理由付き)」で判定 - ▼ -[D] 必須技法を確定 docs/03-test-techniques.md § 11 - ▼ -[E] pytest テストを書く templates/test_.py.template を起点に - │ `playwright codegen` で操作 → そのまま test 関数に貼る or 整形 - ▼ -[F] 実行 ./scenario-test/run.sh - │ trace.zip / video / HAR / console / accessibility / web_vitals を自動収集 - ▼ -[G] レポート確認 scenario-test/reports//report.md - │ --pwk-drive-folder 指定で Drive にアップロード + viewer URL 化 - ▼ -[H] 不具合発見 → bug report docs/05-bug-report.md - FEW HICCUPPS の oracle 軸を必ず付与 -``` - -## 単発 CLI ツール (補助) - -| Script | 用途 | -|---|---| -| → `/ndf:playwright-kit-ops` | スクリプト群は playwright-kit-ops skill に移動。詳細はそちらを参照 | - -## docs/ 配下 (理論ベース知識) - -| ファイル | 内容 | -|---|---| -| `docs/01-methodology.md` | 総論: HTSM / FEW HICCUPPS / ISO 29119-3 の位置付け | -| `docs/02-page-roles.md` | page role 分類 (lp/list/item/edit/form/search/...) | -| `docs/03-test-techniques.md` | テスト技法 (EP / BVA / Decision Table / Pairwise) と role 必須マッピング | -| `docs/04-playwright-mapping.md` | Playwright API → role / 観点 マッピング | -| `docs/05-bug-report.md` | bug report 仕様 (ISO 29119-3 + FEW HICCUPPS) | -| `docs/06-pytest-playwright.md` | pytest-playwright fixture / CLI option / playwright_kit 拡張との対応関係 | -| `docs/checklists/checklist-.md` | role 別チェックリスト (lp/list/item/edit/form/search/dashboard/auth/cart-checkout/modal-wizard/common) | - -## テスト雛形 (templates/) - -利用者は role に応じて `test_.py.template` をコピーして編集する (init 時に -4 ファイルが配置済)。各テンプレートには: - -- 該当 `page_role` marker -- 該当 `pwk_role_` fixture -- `expect()` ベースの web-first assertion -- 正常系 + 1 件以上の異常系 - -が含まれる。 - -## 開発者向け: Skill 単体で動かす旧運用 - -Skill 自身の改修・テスト時のみ、Skill ディレクトリで直接 pytest を回す: - -```bash -cd .claude/plugins/ndf/skills/playwright-scenario-test -uv sync -uv run pytest -q # 159 件 pure 関数テスト -``` - -利用者環境向け (`init_project.sh` 経由) と Skill 開発用は **別の uv プロジェクト** -として分離される (利用者側は `templates/pyproject.toml.runtime` を用い、開発側は -リポジトリルートの `pyproject.toml` を用いる)。 +## クイックスタート -## 制約 / 注意 +1. プロジェクト初期化: `./scripts/init_project.sh /path/to/your-app` +2. 設定編集: `scenario-test/scenario.config.yaml` +3. テストスクリプト作成: `scenario-test/tests/test_*.py` (→ `/ndf:playwright-script-creation`) +4. テスト実行 (動画デフォルト ON): `./scenario-test/run.sh` +5. 動画スキップ: `./scenario-test/run.sh --pwk-no-video` -- **依存**: `pytest>=8.0`, `pytest-playwright>=0.5`, `pytest-xdist>=3.0`, `playwright>=1.50` -- **認証情報は YAML に直書きしない**: `scenario.config.yaml` の `fields.Password` 等は `${ENV_VAR}` で参照し、実値は環境変数 (`.env` / `direnv` / shell export) で管理してください。リポジトリに認証情報をコミットしないこと -- **トレース / HAR / 動画は機微情報を含む**: - - HAR には URL のクエリ文字列・Cookie・Authorization ヘッダ等が記録されます - - trace.zip には localStorage / 操作履歴 / DOM スナップショットが含まれます - - `--pwk-drive-folder=` は **private folder** を指定し、共有相手を限定してください - - `upload_evidence.py --public` を付けない限り Drive にも非公開でアップ (既定) -- **CI**: GitHub Actions では `cd scenario-test && uv run pytest -n auto` でそのまま回せる -- **Skill 更新時の追従**: 開発中につきコピー済ランタイムは再 `init_project.sh` で - 上書き運用 (`scenario.config.yaml` / `tests/conftest.py` / `tests/test_*.py` は - 既存があれば skip するため利用者編集物は保護される) +→ `your-app/scenario-test/` は ndf plugin 非依存。単体で完結する。 -## 関連ドキュメント +## 用語集・制約 -- `docs/README.md` — 知識マップ -- `templates/scenario.config.yaml` — 設定例 -- `templates/runtime-README.md` — init 後の `your-app/scenario-test/README.md` 元 +用語集 (accessibility, web vitals, LCP, CLS, TTFB, HAR, trace, overlay, body_check, page role, pwk) と制約/注意事項は `playwright_kit/` パッケージの README (`templates/runtime-README.md`) および `pyproject.toml` (`templates/pyproject.toml.runtime`) を参照。 From 16d086d3eaf4bdb8be88a630e6e56eab7503cdb1 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:03:54 +0000 Subject: [PATCH 11/15] =?UTF-8?q?Update:=20plugin.json=20=E3=82=92=205=20?= =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=AB=E6=A7=8B=E6=88=90=E3=81=AB=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20(v4.9.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/ndf/.claude-plugin/plugin.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/ndf/.claude-plugin/plugin.json b/plugins/ndf/.claude-plugin/plugin.json index 8d30f339..4a249f56 100644 --- a/plugins/ndf/.claude-plugin/plugin.json +++ b/plugins/ndf/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ndf", - "version": "4.8.0", - "description": "Integrated plugin with 8 specialized agents (model-tiered: opus/sonnet/haiku), 45 skills including official mcp-builder, on-demand loader for Anthropic official skills, generic workflow/principle skills, skill usage statistics, pytest-playwright E2E testing split into 6 focused skills (test-planning, evidence, overlay, quality, report, kit-ops) + orchestrator, Google Drive/Chat integration, and Codex CLI integration via /ndf:codex skill. Transcript retention is automatically kept at >= 90 days. Serena MCP is a separate plugin (mcp-serena).", + "version": "4.9.0", + "description": "Integrated plugin with 8 specialized agents (model-tiered: opus/sonnet/haiku), 44 skills including official mcp-builder, on-demand loader for Anthropic official skills, generic workflow/principle skills, skill usage statistics, pytest-playwright E2E testing split into 5 focused skills (test-planning, script-creation, execution, report, kit-ops) + orchestrator with video-by-default evidence, Google Drive/Chat integration, and Codex CLI integration via /ndf:codex skill. Transcript retention is automatically kept at >= 90 days. Serena MCP is a separate plugin (mcp-serena).", "author": { "name": "takemi-ohama", "url": "https://github.com/takemi-ohama" @@ -62,9 +62,8 @@ "./skills/codex", "./skills/skill-stats", "./skills/playwright-test-planning", - "./skills/playwright-evidence", - "./skills/playwright-overlay", - "./skills/playwright-quality", + "./skills/playwright-script-creation", + "./skills/playwright-execution", "./skills/playwright-report", "./skills/playwright-kit-ops", "./skills/playwright-scenario-test", From 72eaf6d08b50adcfc3c198a688eba8c859212405 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:04:16 +0000 Subject: [PATCH 12/15] =?UTF-8?q?Docs:=20PLAN23=20=E3=82=92=205=20?= =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=AB=E5=86=8D=E6=A7=8B=E6=88=90=E3=81=AB?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- issues/PLAN23_playwright-skill-split.md | 56 ++++++++++++------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/issues/PLAN23_playwright-skill-split.md b/issues/PLAN23_playwright-skill-split.md index 4e59ccda..8dfbfef3 100644 --- a/issues/PLAN23_playwright-skill-split.md +++ b/issues/PLAN23_playwright-skill-split.md @@ -1,47 +1,43 @@ -# PLAN23: playwright-scenario-test を 6 機能 skill + 統括 skill に分割 +# PLAN23: playwright-scenario-test を 5 機能 skill + 統括 skill に再構成 **Issue**: https://github.com/devbasex/ai-plugins/issues/17 -**Status**: 実装済み (未コミット) +**Status**: 実装済み ## Context -`playwright-scenario-test` は 73 ファイル / 760KB の大型 skill。SKILL.md (315行, ~5,000 tokens) が skill 発動時にコンテキストに全量ロードされ、エージェントのコンテキストを圧迫していた。 +`playwright-scenario-test` は 73 ファイル / 760KB の大型 skill。初回は 6 skill + orchestrator に分割したが、以下の大原則に基づいて 5 skill + orchestrator に再構成した。 -## 実施内容 +### 大原則 + +1. 再現可能なテストスクリプトを実装してからテストを実施する +2. テストスクリプトは ndf plugin 非依存でプロジェクトフォルダに設置する +3. テスト実行はエビデンス動画を常に取得する (オプションでスキップ可能) -機能を 6 つの独立 skill に分割し、`playwright-scenario-test` を統括オーケストレータに改修。 +## 実施内容 -### 新規 6 skill +### 5 skill + orchestrator 構成 | # | Skill 名 | 責務 | |---|---|---| -| 1 | `playwright-test-planning` | テスト計画 (HTSM/ISTQB/FEW HICCUPPS、page role、チェックリスト) | -| 2 | `playwright-evidence` | エビデンス収集 (video/trace/screenshot/HAR) | -| 3 | `playwright-overlay` | 動画装飾 (赤丸カーソル + 字幕) | -| 4 | `playwright-quality` | 品質計測 (accessibility/Web Vitals/body_check) | -| 5 | `playwright-report` | Markdown レポート + Drive 共有 | -| 6 | `playwright-kit-ops` | スクリプト実行 (init_project/スキャン/アップロード) | - -### 統括 skill (既存改修) - -`playwright-scenario-test` → トリガーを絞り、冒頭に 6 skill への案内テーブルを追加。 - -### スクリプト移動 - -`playwright-scenario-test/scripts/` → `playwright-kit-ops/scripts/` に全スクリプトを移動。 -`init_project.sh` は `SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)"` で自身の親ディレクトリ (`playwright-kit-ops/`) を解決するため、移動先でそのまま動作する。 +| 1 | `playwright-test-planning` | テスト計画 (HTSM/ISTQB/FEW HICCUPPS) | +| 2 | `playwright-script-creation` | テストスクリプト作成 (テンプレート→実装→レビュー) | +| 3 | `playwright-execution` | テスト実行 + エビデンス収集 (video/trace/overlay/quality 統合) | +| 4 | `playwright-report` | レポート生成 | +| 5 | `playwright-kit-ops` | ツール群 (init_project/スキャン/アップロード) | -### plugin.json +### 廃止 skill -- skills 配列に 6 skill を追加 (計 45 skills) -- version: 4.7.5 → 4.8.0 +- `playwright-evidence` → `playwright-execution` に統合 +- `playwright-overlay` → `playwright-execution` に統合 +- `playwright-quality` → `playwright-execution` に統合 -## 変更ファイル一覧 +### コード変更 -- 新規 6 ファイル: `skills/playwright-{test-planning,evidence,overlay,quality,report,kit-ops}/SKILL.md` -- 移動 11 ファイル: `scripts/*.py`, `scripts/init_project.{sh,bat}` → `playwright-kit-ops/scripts/` -- 修正 2 ファイル: `playwright-scenario-test/SKILL.md`, `.claude-plugin/plugin.json` +- `pytest_plugin.py`: `--pwk-no-video` オプション追加、動画デフォルト ON +- `run.sh`: `--video=on` フォールバック追加 +- `conftest.py.template`: テストスクリプト存在チェック追加 +- `plugin.json`: v4.8.0 → v4.9.0 (45 → 44 skills) -## 将来の対応 (別 issue) +## 設計書 -- `playwright_kit` Python パッケージの内部サブディレクトリ化 +`docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md` From 9b98b7722fc30ca4ac292859887931e0948a7191 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:29:12 +0000 Subject: [PATCH 13/15] =?UTF-8?q?Docs:=20=E8=A8=AD=E8=A8=88=E6=9B=B8?= =?UTF-8?q?=E3=83=BB=E5=AE=9F=E8=A3=85=E8=A8=88=E7=94=BB=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2026-05-25-playwright-skill-restructure.md | 825 ++++++++++++++++++ ...-25-playwright-skill-restructure-design.md | 203 +++++ 2 files changed, 1028 insertions(+) create mode 100644 docs/superpowers/plans/2026-05-25-playwright-skill-restructure.md create mode 100644 docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md diff --git a/docs/superpowers/plans/2026-05-25-playwright-skill-restructure.md b/docs/superpowers/plans/2026-05-25-playwright-skill-restructure.md new file mode 100644 index 00000000..e45db06c --- /dev/null +++ b/docs/superpowers/plans/2026-05-25-playwright-skill-restructure.md @@ -0,0 +1,825 @@ +# Playwright スキル再構成 実装計画 + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** PR #18 の 6 スキル分割を、大原則 (再現可能テストスクリプト先行 / plugin 非依存 / エビデンス動画デフォルト ON) に基づいて 5 スキル + orchestrator に再構成する。 + +**Architecture:** 旧 evidence/overlay/quality の 3 スキルを `playwright-execution` に統合し、新規 `playwright-script-creation` を追加。`pytest_plugin.py` に `--pwk-no-video` オプションを追加し動画デフォルト ON を実現。`run.sh` にも `--video=on` フォールバックを追加。 + +**Tech Stack:** Python (pytest / pytest-playwright), Bash, YAML, Markdown (SKILL.md) + +**Spec:** `docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md` + +--- + +## ファイル構成 + +### 新規作成 + +| ファイル | 責務 | +|---|---| +| `plugins/ndf/skills/playwright-script-creation/SKILL.md` | Phase 2 スキル: テストスクリプト作成ガイド | +| `plugins/ndf/skills/playwright-execution/SKILL.md` | Phase 3 スキル: テスト実行+エビデンス収集 (3 スキル統合) | +| `plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py` | `--pwk-no-video` オプションと動画デフォルト ON のテスト | + +### 変更 + +| ファイル | 変更内容 | +|---|---| +| `plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py` | `--pwk-no-video` CLI オプション追加 + `pytest_configure` で動画デフォルト ON | +| `plugins/ndf/skills/playwright-kit-ops/templates/run.sh` | `--video=on` フォールバック追加 | +| `plugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template` | テストスクリプト存在チェック追加 | +| `plugins/ndf/skills/playwright-test-planning/SKILL.md` | 次フェーズ導線追加 | +| `plugins/ndf/skills/playwright-report/SKILL.md` | Drive 共有セクション削除 | +| `plugins/ndf/skills/playwright-scenario-test/SKILL.md` | 5 スキル案内テーブル更新 + 大原則記載 | +| `plugins/ndf/.claude-plugin/plugin.json` | skills 配列更新 (3 削除 + 2 追加) | + +### 削除 + +| ディレクトリ | 理由 | +|---|---| +| `plugins/ndf/skills/playwright-evidence/` | `playwright-execution` に統合 | +| `plugins/ndf/skills/playwright-overlay/` | `playwright-execution` に統合 | +| `plugins/ndf/skills/playwright-quality/` | `playwright-execution` に統合 | + +--- + +## Task 1: `--pwk-no-video` CLI オプション追加 + 動画デフォルト ON のテスト + +**Files:** +- Create: `plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py` + +- [ ] **Step 1: テストファイルを作成** + +`plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py` に以下を書く: + +```python +"""--pwk-no-video オプションと動画デフォルト ON の検証。 + +pytest-playwright の --video オプションが playwright_kit plugin 経由で +デフォルト 'on' に設定されること、および --pwk-no-video で 'off' に +切り替わることを pytester 経由で検証する。 +""" + +from __future__ import annotations + +import textwrap + + +def test_pwk_no_video_option_registered(pytester): + """--pwk-no-video が pytest -h に出ること。""" + pytester.makepyfile("def test_dummy(): pass\n") + res = pytester.runpytest("--help") + out = res.stdout.str() + assert "--pwk-no-video" in out + + +def test_video_default_on(pytester): + """--video 未指定時、playwright_kit が video='on' をデフォルト設定すること。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "on", f"expected 'on', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q") + res.assert_outcomes(passed=1) + + +def test_pwk_no_video_sets_off(pytester): + """--pwk-no-video 指定時、video='off' になること。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "off", f"expected 'off', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q", "--pwk-no-video") + res.assert_outcomes(passed=1) + + +def test_explicit_video_flag_takes_precedence(pytester): + """--video=retain-on-failure を明示指定した場合、pwk が上書きしないこと。""" + pytester.makepyfile( + textwrap.dedent( + """ + def test_video_config(pytestconfig): + video = pytestconfig.getoption("video", default=None) + assert video == "retain-on-failure", f"expected 'retain-on-failure', got {video!r}" + """ + ) + ) + res = pytester.runpytest("-q", "--video=retain-on-failure") + res.assert_outcomes(passed=1) +``` + +- [ ] **Step 2: テストを実行して FAIL を確認** + +Run: `cd /work/ai-plugins/plugins/ndf/skills/playwright-kit-ops && uv run pytest tests/test_video_default.py -v` + +Expected: `test_pwk_no_video_option_registered` → FAIL (`--pwk-no-video` がまだ登録されていない)。`test_video_default_on` → FAIL (デフォルトが `on` ではない)。`test_pwk_no_video_sets_off` → FAIL。`test_explicit_video_flag_takes_precedence` → 結果は pytest-playwright の状態に依存。 + +- [ ] **Step 3: コミット** + +```bash +git add plugins/ndf/skills/playwright-kit-ops/tests/test_video_default.py +git commit -m "test: --pwk-no-video オプションと動画デフォルト ON の failing tests 追加" +``` + +--- + +## Task 2: `pytest_plugin.py` に `--pwk-no-video` を実装して動画デフォルト ON にする + +**Files:** +- Modify: `plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py:44-93` (pytest_addoption) +- Modify: `plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py:110-137` (pytest_configure) + +- [ ] **Step 1: `pytest_addoption` に `--pwk-no-video` を追加** + +`plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py` の `pytest_addoption` 関数内、`--pwk-overlay` の直前に追加する: + +```python + group.addoption( + "--pwk-no-video", + action="store_true", + default=False, + help="動画収集を明示的に OFF にする (デフォルトは全テストで動画 ON)", + ) +``` + +- [ ] **Step 2: `pytest_configure` に動画デフォルト ON ロジックを追加** + +`pytest_configure` 関数内の既存コードの末尾(`config._pwk_config = cfg` 行の後、関数末尾)に以下を追加する: + +```python + # 動画デフォルト ON (大原則: エビデンス動画を常に取得) + # ユーザーが --video を CLI で明示指定した場合はそちらを優先する。 + # --pwk-no-video 指定時は video='off' に設定する。 + # --pwk-no-evidence 指定時も video='off' に設定する (全エビデンス OFF)。 + try: + video_opt = config.getoption("video", default=None) + no_video = config.getoption("pwk_no_video", default=False) + no_evidence = config.getoption("pwk_no_evidence", default=False) + if video_opt is None: + if no_video or no_evidence: + config.option.video = "off" + else: + config.option.video = "on" + except (ValueError, AttributeError): + pass +``` + +- [ ] **Step 3: テストを実行して PASS を確認** + +Run: `cd /work/ai-plugins/plugins/ndf/skills/playwright-kit-ops && uv run pytest tests/test_video_default.py -v` + +Expected: 4 テスト全て PASS。 + +- [ ] **Step 4: 既存テストが壊れていないことを確認** + +Run: `cd /work/ai-plugins/plugins/ndf/skills/playwright-kit-ops && uv run pytest -q` + +Expected: 全テスト PASS (テスト数は変動する可能性あり)。 + +- [ ] **Step 5: コミット** + +```bash +git add plugins/ndf/skills/playwright-kit-ops/playwright_kit/pytest_plugin.py +git commit -m "feat: --pwk-no-video オプション追加 + 動画デフォルト ON" +``` + +--- + +## Task 3: `run.sh` テンプレートに `--video=on` フォールバックを追加 + +**Files:** +- Modify: `plugins/ndf/skills/playwright-kit-ops/templates/run.sh:80-89` (pytest 実行部分) + +- [ ] **Step 1: `run.sh` の pytest 実行部分を変更** + +`plugins/ndf/skills/playwright-kit-ops/templates/run.sh` の末尾 pytest 実行部分を以下に置換する: + +```bash +# --- 3) pytest 実行 ------------------------------------------------ +cd "$RUNTIME_DIR" + +# --pwk-no-video が引数に含まれていなければ --video=on をデフォルト追加。 +# pytest_plugin.py 側でもデフォルト注入するが、run.sh 経由の場合は +# 明示的に渡すことで --video の優先度を確保する。 +VIDEO_FLAG="--video=on" +for arg in "$@"; do + case "$arg" in + --pwk-no-video|--pwk-no-evidence) VIDEO_FLAG="" ;; + esac +done + +exec uv run pytest \ + --pwk-config="${PWK_CONFIG:-./scenario.config.yaml}" \ + $VIDEO_FLAG \ + "$@" +``` + +- [ ] **Step 2: help テキストに `--pwk-no-video` を追加** + +`run.sh` の `--help` セクション (`cat </ +├── report.md # テスト結果サマリ +├── / +│ ├── video.mp4 # テスト動画 (デフォルト ON) +│ ├── trace.zip # Playwright Trace +│ ├── request.har # ネットワーク通信ログ +│ ├── body_check.jsonl # body_check 違反詳細 +│ └── screenshot-*.png # スクリーンショット +``` + +## CLI options + +| option | 役割 | +|---|---| +| `--pwk-config ` | `scenario.config.yaml` のパス | +| `--pwk-out-dir ` | 成果物出力先 (default: `reports//`) | +| `--pwk-no-video` | 動画収集を OFF (デフォルトは ON) | +| `--pwk-no-evidence` | HAR / trace / video の収集を全て OFF | +| `--pwk-har-mode {minimal,full,none}` | HAR 録画モード (default: minimal) | +| `--pwk-overlay` | overlay (赤丸カーソル + 字幕) を ON | + +## 関連 Skill + +- `/ndf:playwright-script-creation` — テストスクリプト作成 (実行の前段) +- `/ndf:playwright-report` — Markdown レポート生成 +- `/ndf:playwright-kit-ops` — スクリプト実行 (init_project / スキャン) +- `/ndf:playwright-scenario-test` — 全機能統括 +``` + +- [ ] **Step 2: コミット** + +```bash +git add plugins/ndf/skills/playwright-execution/SKILL.md +git commit -m "feat: playwright-execution スキル追加 (evidence+overlay+quality 統合)" +``` + +--- + +## Task 7: `playwright-script-creation/SKILL.md` を新規作成 + +**Files:** +- Create: `plugins/ndf/skills/playwright-script-creation/SKILL.md` + +- [ ] **Step 1: SKILL.md を作成** + +`plugins/ndf/skills/playwright-script-creation/SKILL.md`: + +```markdown +--- +name: playwright-script-creation +description: "再現可能な E2E テストスクリプトを作成するガイド。テンプレートを起点にテストコードを実装し、再現可能性レビューを経てからテスト実行フェーズに進む。ndf plugin 非依存で動作する。" +when_to_use: "E2E テストスクリプトの作成 / テストコードの実装 / テストテンプレートからのスクリプト生成が必要なとき。Triggers: 'テストスクリプト作成', 'テストコード作成', 'テスト実装', 'テストを書く', 'シナリオ作成', 'codegen', 'テンプレートからテスト', 'playwright codegen'" +allowed-tools: + - Read + - Edit + - Write + - Bash(uv *) + - Bash(playwright *) + - Bash(python *) +--- + +# Playwright Script Creation (テストスクリプト作成) + +再現可能なテストスクリプトを作成し、レビューを経てからテスト実行に進む。 + +## 大原則 + +**テストスクリプトを実装してからテストを実施する。** +スクリプトが完成・レビューを経るまで `/ndf:playwright-execution` に進まない。 + +## 前提条件 + +- テスト計画が完了していること (`/ndf:playwright-test-planning` で計画済み) +- `init_project.sh` でプロジェクトが初期化済みであること (`/ndf:playwright-kit-ops`) + +## ワークフロー + +``` +[A] テスト計画の確認 (チェックリスト / page role / テスト技法) + │ +[B] テンプレート選択 + │ tests/ 配下の test_*.py.template を起点にする + ▼ +[C] テストコード実装 + │ playwright codegen で操作を記録 → テスト関数に組み込む + │ または手動で expect() ベースの assertion を書く + ▼ +[D] 再現可能性レビュー (下記チェックリスト) + │ +[E] テスト実行へ → /ndf:playwright-execution +``` + +## テンプレート一覧 + +`init_project.sh` で以下のテンプレートが `tests/` に配置済み: + +| テンプレート | page role | 内容 | +|---|---|---| +| `test_auth.py` | auth | ログイン / ログアウトフロー | +| `test_list.py` | list | 一覧ページネーション / ソート | +| `test_form.py` | form | 入力 → 送信 → 結果検証 | +| `test_dashboard.py` | dashboard | KPI / リンク遷移 | + +## テストコードの書き方 + +### テンプレートを起点にする + +各 page role のテンプレートが `templates/test_*.py.template` に用意されている。 +`init_project.sh` 実行時に `tests/` へコピーされるので、プロジェクト固有の URL やセレクタを書き換えて使う。 + +→ コード例: `templates/test_form.py.template`, `templates/test_auth.py.template` 等を参照 + +### playwright codegen での操作記録 + +`uv run playwright codegen ` で操作を記録し、生成コードをテスト関数にコピーする。 +コピー後に `@pytest.mark.page_role()`, `@pytest.mark.role()`, `expect()` assertion, `pwk_config.base_url` を追加する。 + +### overlay 付きテスト + +overlay API (`set_caption`, `flash_click`) の使用例は `playwright_kit/overlay.py` を参照。 + +## fixture / marker 一覧 + +fixture / marker の完全な一覧は `playwright_kit/pytest_plugin.py` の `_PWK_MARKERS` 定義と `playwright_kit/fixtures/` 配下の各モジュールを参照。 + +主な fixture: `pwk_config`, `pwk_role_`, `pwk_evidence`, `pwk_accessibility_scan()`, `pwk_web_vitals_measure()` +主な marker: `@pytest.mark.page_role()`, `@pytest.mark.role()`, `@pytest.mark.phase()`, `@pytest.mark.priority()`, `@pytest.mark.no_body_check` + +## 再現可能性レビューチェックリスト + +スクリプト完成後、以下を全項目確認してからテスト実行に進む: + +- [ ] **再現可能性**: 同じ環境で同じ結果が得られるか (ランダム値・タイムスタンプに依存していないか) +- [ ] **テストデータ独立性**: 外部の状態に依存せず、テスト単体で成立するか +- [ ] **marker 付与**: `@pytest.mark.page_role()` が全テスト関数に付与されているか +- [ ] **role marker**: 認証が必要なテストに `@pytest.mark.role()` + `pwk_role_` fixture があるか +- [ ] **assertion 網羅性**: 正常系 + 少なくとも 1 つの異常系 (バリデーション等) が含まれるか +- [ ] **URL 構築**: ハードコードされた URL ではなく `pwk_config.base_url` を使用しているか +- [ ] **wait 戦略**: `wait_until="domcontentloaded"` 等の明示的な待機指定があるか +- [ ] **ndf plugin 非依存**: `scenario-test/` ディレクトリ単体で実行可能か + +## ndf plugin 非依存 + +`init_project.sh` で埋め込まれた `scenario-test/` は: +- `playwright_kit/` パッケージ本体を含む +- `pyproject.toml` で pytest11 entry-point を定義 +- `run.sh` でワンコマンド実行可能 + +→ ndf plugin 未インストール環境でも `./scenario-test/run.sh` で動作する。 + +## 関連 Skill + +- `/ndf:playwright-test-planning` — テスト計画 (前段) +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 (後段) +- `/ndf:playwright-kit-ops` — init_project / codegen 等のツール群 +- `/ndf:playwright-scenario-test` — 全機能統括 +``` + +- [ ] **Step 2: コミット** + +```bash +git add plugins/ndf/skills/playwright-script-creation/SKILL.md +git commit -m "feat: playwright-script-creation スキル追加 (テストスクリプト作成ガイド)" +``` + +--- + +## Task 8: `playwright-test-planning/SKILL.md` を改修 + +**Files:** +- Modify: `plugins/ndf/skills/playwright-test-planning/SKILL.md` + +- [ ] **Step 1: ワークフロー末尾に次フェーズ導線を追加** + +`plugins/ndf/skills/playwright-test-planning/SKILL.md` のワークフロー `[E]` の後に以下を追加する: + +```markdown + ▼ +[F] スクリプト作成へ → /ndf:playwright-script-creation + テスト計画が確定したら、テストスクリプトの作成に進む。 + テスト計画が完了するまでスクリプト作成には進まない。 +``` + +- [ ] **Step 2: 関連 Skill セクションを更新** + +既存の関連 Skill セクションを以下に置換する: + +```markdown +## 関連 Skill + +- `/ndf:playwright-script-creation` — テストスクリプト作成 (次のフェーズ) +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー +``` + +- [ ] **Step 3: コミット** + +```bash +git add plugins/ndf/skills/playwright-test-planning/SKILL.md +git commit -m "Update: playwright-test-planning にスクリプト作成フェーズへの導線追加" +``` + +--- + +## Task 9: `playwright-report/SKILL.md` から Drive 共有を削除 + +**Files:** +- Modify: `plugins/ndf/skills/playwright-report/SKILL.md` + +- [ ] **Step 1: Drive 関連セクションを削除** + +`plugins/ndf/skills/playwright-report/SKILL.md` から以下のセクションを削除する: +- `## Google Drive アップロード` セクション全体 (「### テスト実行時に自動アップロード」と「### 手動アップロード」を含む) + +- [ ] **Step 2: 関連 Skill セクションを更新** + +既存の関連 Skill セクションを以下に置換する: + +```markdown +## 関連 Skill + +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 +- `/ndf:playwright-kit-ops` — エビデンスアップロードツール (Drive 連携が必要な場合) +- `/ndf:playwright-scenario-test` — 全機能を統括したフルワークフロー +``` + +- [ ] **Step 3: コミット** + +```bash +git add plugins/ndf/skills/playwright-report/SKILL.md +git commit -m "Update: playwright-report から Drive 共有セクションを削除" +``` + +--- + +## Task 10: `playwright-scenario-test/SKILL.md` (orchestrator) を改修 + +**Files:** +- Modify: `plugins/ndf/skills/playwright-scenario-test/SKILL.md` + +- [ ] **Step 1: SKILL.md を全面改修** + +`plugins/ndf/skills/playwright-scenario-test/SKILL.md` の内容を以下に置換する (frontmatter を含めて全体を差し替え): + +```markdown +--- +name: playwright-scenario-test +description: "pytest-playwright ベースのフル E2E テストフレームワーク統括。テスト計画・スクリプト作成・エビデンス付きテスト実行・レポート生成の 4 フェーズを組み合わせた包括的なテストワークフローを提供する。個別機能のみ必要な場合は各専門 skill を直接参照。" +when_to_use: "フル E2E テストワークフロー (計画→スクリプト→実行→レポート) を一貫して行うとき / pytest-playwright 拡張 fixture (pwk_*) の全体像を把握したいとき / init_project.sh でプロジェクトをセットアップするとき。Triggers: 'pytest-playwright', 'pwk_role', 'pwk_evidence', 'init_project', 'シナリオテスト一式', 'フル E2E'" +allowed-tools: + - Read + - Bash(uv *) + - Bash(pytest *) + - Bash(playwright *) + - Bash(python *) +--- + +# Playwright シナリオテスト Skill (v0.6.0) + +Web アプリの E2E シナリオを **理論ベース** で計画し、**再現可能なテストスクリプトを実装してから**、**pytest-playwright** 上でエビデンス動画付きで実行、Markdown レポートを自動生成する一式の Skill。 + +## 大原則 + +1. **再現可能なテストスクリプトを実装してからテストを実施する** +2. **テストスクリプトは ndf plugin 非依存でプロジェクトフォルダに設置する** +3. **テスト実行はエビデンス動画を常に取得する** (オプションで明示的にスキップ可能) + +## フェーズ別 Skill + +| Phase | Skill | 機能 | +|---|---|---| +| 1 | `/ndf:playwright-test-planning` | テスト計画 (HTSM / page role / チェックリスト) | +| 2 | `/ndf:playwright-script-creation` | テストスクリプト作成 (テンプレート→実装→レビュー) | +| 3 | `/ndf:playwright-execution` | テスト実行 + エビデンス収集 (video/trace/overlay/quality) | +| 4 | `/ndf:playwright-report` | レポート生成 (Markdown) | +| -- | `/ndf:playwright-kit-ops` | ツール群 (init_project / スキャン / アップロード) | + +## 標準ワークフロー + +``` +[Phase 1] テスト計画 (/ndf:playwright-test-planning) + │ 対象 URL → page role 判定 → チェックリスト → テスト技法確定 + ▼ +[Phase 2] スクリプト作成 (/ndf:playwright-script-creation) + │ テンプレート選択 → テストコード実装 → 再現可能性レビュー + │ ※ スクリプトが完成するまでテスト実行に進まない + ▼ +[Phase 3] テスト実行 + エビデンス収集 (/ndf:playwright-execution) + │ 動画デフォルト ON → trace/HAR/overlay/a11y/CWV/body_check + │ ※ --pwk-no-video で動画のみスキップ可 + ▼ +[Phase 4] レポート生成 (/ndf:playwright-report) + │ reports//report.md 自動生成 + ▼ +[任意] ツール群 (/ndf:playwright-kit-ops) + init_project / スキャン / アップロード (任意タイミング) +``` + +## クイックスタート + +1. プロジェクト初期化: `./scripts/init_project.sh /path/to/your-app` +2. 設定編集: `scenario-test/scenario.config.yaml` +3. テストスクリプト作成: `scenario-test/tests/test_*.py` (→ `/ndf:playwright-script-creation`) +4. テスト実行 (動画デフォルト ON): `./scenario-test/run.sh` +5. 動画スキップ: `./scenario-test/run.sh --pwk-no-video` + +→ `your-app/scenario-test/` は ndf plugin 非依存。単体で完結する。 + +## 用語集・制約 + +用語集 (accessibility, web vitals, LCP, CLS, TTFB, HAR, trace, overlay, body_check, page role, pwk) と制約/注意事項は `playwright_kit/` パッケージの README (`templates/runtime-README.md`) および `pyproject.toml` (`templates/pyproject.toml.runtime`) を参照。 +``` + +- [ ] **Step 2: コミット** + +```bash +git add plugins/ndf/skills/playwright-scenario-test/SKILL.md +git commit -m "Update: playwright-scenario-test orchestrator を 5 スキル構成に改修" +``` + +--- + +## Task 11: `plugin.json` を更新 + +**Files:** +- Modify: `plugins/ndf/.claude-plugin/plugin.json` + +- [ ] **Step 1: skills 配列を更新** + +`plugins/ndf/.claude-plugin/plugin.json` の `skills` 配列から以下を削除: +```json + "./skills/playwright-evidence", + "./skills/playwright-overlay", + "./skills/playwright-quality", +``` + +同じ配列の `"./skills/playwright-test-planning"` の後に以下を追加: +```json + "./skills/playwright-script-creation", + "./skills/playwright-execution", +``` + +- [ ] **Step 2: description を更新** + +`description` フィールドを以下に変更: + +``` +"Integrated plugin with 8 specialized agents (model-tiered: opus/sonnet/haiku), 44 skills including official mcp-builder, on-demand loader for Anthropic official skills, generic workflow/principle skills, skill usage statistics, pytest-playwright E2E testing split into 5 focused skills (test-planning, script-creation, execution, report, kit-ops) + orchestrator with video-by-default evidence, Google Drive/Chat integration, and Codex CLI integration via /ndf:codex skill. Transcript retention is automatically kept at >= 90 days. Serena MCP is a separate plugin (mcp-serena)." +``` + +- [ ] **Step 3: version を 4.9.0 に更新** + +```json +"version": "4.9.0", +``` + +- [ ] **Step 4: コミット** + +```bash +git add plugins/ndf/.claude-plugin/plugin.json +git commit -m "Update: plugin.json を 5 スキル構成に更新 (v4.9.0)" +``` + +--- + +## Task 12: `claude plugin validate` で検証 + +**Files:** (なし — 検証のみ) + +- [ ] **Step 1: プラグイン検証を実行** + +Run: `cd /work/ai-plugins && claude plugin validate` + +Expected: 検証が通ること。エラーがあればその場で修正する。 + +- [ ] **Step 2: 全テストを実行** + +Run: `cd /work/ai-plugins/plugins/ndf/skills/playwright-kit-ops && uv run pytest -q` + +Expected: 全テスト PASS。 + +--- + +## Task 13: 実装プラン `issues/PLAN23_playwright-skill-split.md` を更新 + +**Files:** +- Modify: `issues/PLAN23_playwright-skill-split.md` + +- [ ] **Step 1: ステータスと内容を更新** + +`issues/PLAN23_playwright-skill-split.md` のステータスを更新し、再構成の概要を追記する: + +```markdown +# PLAN23: playwright-scenario-test を 5 機能 skill + 統括 skill に再構成 + +**Issue**: https://github.com/devbasex/ai-plugins/issues/17 +**Status**: 実装済み + +## Context + +`playwright-scenario-test` は 73 ファイル / 760KB の大型 skill。初回は 6 skill + orchestrator に分割したが、以下の大原則に基づいて 5 skill + orchestrator に再構成した。 + +### 大原則 + +1. 再現可能なテストスクリプトを実装してからテストを実施する +2. テストスクリプトは ndf plugin 非依存でプロジェクトフォルダに設置する +3. テスト実行はエビデンス動画を常に取得する (オプションでスキップ可能) + +## 実施内容 + +### 5 skill + orchestrator 構成 + +| # | Skill 名 | 責務 | +|---|---|---| +| 1 | `playwright-test-planning` | テスト計画 (HTSM/ISTQB/FEW HICCUPPS) | +| 2 | `playwright-script-creation` | テストスクリプト作成 (テンプレート→実装→レビュー) | +| 3 | `playwright-execution` | テスト実行 + エビデンス収集 (video/trace/overlay/quality 統合) | +| 4 | `playwright-report` | レポート生成 | +| 5 | `playwright-kit-ops` | ツール群 (init_project/スキャン/アップロード) | + +### 廃止 skill + +- `playwright-evidence` → `playwright-execution` に統合 +- `playwright-overlay` → `playwright-execution` に統合 +- `playwright-quality` → `playwright-execution` に統合 + +### コード変更 + +- `pytest_plugin.py`: `--pwk-no-video` オプション追加、動画デフォルト ON +- `run.sh`: `--video=on` フォールバック追加 +- `conftest.py.template`: テストスクリプト存在チェック追加 +- `plugin.json`: v4.8.0 → v4.9.0 (45 → 44 skills) + +## 設計書 + +`docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md` +``` + +- [ ] **Step 2: コミット** + +```bash +git add issues/PLAN23_playwright-skill-split.md +git commit -m "Docs: PLAN23 を 5 スキル再構成に更新" +``` diff --git a/docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md b/docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md new file mode 100644 index 00000000..982f962d --- /dev/null +++ b/docs/superpowers/specs/2026-05-25-playwright-skill-restructure-design.md @@ -0,0 +1,203 @@ +# Playwright スキル再構成設計書 + +## 背景 + +PR #18 で `playwright-scenario-test` を 6 スキルに分割したが、以下の大原則を満たすために再構成が必要: + +1. **再現可能なテストスクリプトを実装してからテストを実施する** +2. **テストスクリプトは ndf plugin がインストールされていなくても動作するようプロジェクトフォルダに設置する** +3. **テスト実行はエビデンス動画を常に取得できるようにしておく** (オプションで明示的にスキップ可能) + +## スキル構成 + +### 変更前 (6 スキル + orchestrator) + +| スキル | 責務 | +|---|---| +| playwright-test-planning | テスト計画 | +| playwright-evidence | エビデンス収集 | +| playwright-overlay | 動画装飾 | +| playwright-quality | 品質計測 | +| playwright-report | レポート + Drive 共有 | +| playwright-kit-ops | ツール群 | +| playwright-scenario-test | orchestrator | + +### 変更後 (5 スキル + orchestrator) + +| # | スキル | 責務 | 元スキル | +|---|---|---|---| +| 1 | `playwright-test-planning` | テスト計画 (HTSM/page role/チェックリスト) | 既存改修 | +| 2 | `playwright-script-creation` | テストスクリプト作成 (テンプレート→実装→レビュー) | **新規** | +| 3 | `playwright-execution` | テスト実行+エビデンス収集 (video/trace/overlay/quality) | evidence + overlay + quality 統合 | +| 4 | `playwright-report` | レポート生成 (Drive 共有削除) | 既存改修 | +| 5 | `playwright-kit-ops` | ツール群 (init_project/スキャン/アップロード) | 維持 | +| -- | `playwright-scenario-test` | orchestrator (5 スキルへの案内) | 既存改修 | + +### 廃止スキル + +- `playwright-evidence` → `playwright-execution` に統合 +- `playwright-overlay` → `playwright-execution` に統合 +- `playwright-quality` → `playwright-execution` に統合 + +## ワークフロー (大原則の反映) + +``` +[Phase 1] テスト計画 (/ndf:playwright-test-planning) + │ page role 判定 → チェックリスト → テスト技法確定 + ▼ +[Phase 2] スクリプト作成 (/ndf:playwright-script-creation) + │ テンプレート選択 → テストコード実装 → 再現可能性レビュー + │ ※ スクリプトが完成するまでテスト実行に進まない + ▼ +[Phase 3] テスト実行+エビデンス収集 (/ndf:playwright-execution) + │ 動画デフォルトON → trace/HAR/overlay/a11y/CWV/body_check + │ ※ --pwk-no-video で動画のみスキップ可 + ▼ +[Phase 4] レポート生成 (/ndf:playwright-report) + │ report.md 自動生成 + ▼ +[任意] ツール群 (/ndf:playwright-kit-ops) + init_project / スキャン / アップロード (任意タイミング) +``` + +## コード変更 + +### A. pytest_plugin.py: 動画デフォルト ON + +`--video=on` を pytest_configure でデフォルト注入する。ユーザーが `--video` を明示指定した場合はそちらを優先。 + +```python +# 新規 CLI オプション +group.addoption( + "--pwk-no-video", + action="store_true", + default=False, + help="動画収集を明示的に OFF にする", +) +``` + +```python +def pytest_configure(config): + # ... 既存の marker 登録 ... + + # 動画デフォルト ON: ユーザーが --video を明示指定していない場合のみ + video_opt = config.getoption("video", default=None) + no_video = config.getoption("pwk_no_video", default=False) + if video_opt is None and not no_video: + config.option.video = "on" + elif no_video: + config.option.video = "off" +``` + +### B. run.sh: --video=on のフォールバック追加 + +pytest_plugin 側で制御するため run.sh は補助的な変更のみ: + +```bash +# --pwk-no-video が引数に含まれていなければ --video=on を追加 +VIDEO_FLAG="--video=on" +for arg in "$@"; do + case "$arg" in + --pwk-no-video) VIDEO_FLAG="" ;; + esac +done + +exec uv run pytest \ + --pwk-config="${PWK_CONFIG:-./scenario.config.yaml}" \ + $VIDEO_FLAG \ + "$@" +``` + +### C. conftest.py テンプレート: テストスクリプト存在チェック + +`conftest.py.template` にテストスクリプトの存在チェックを追加: + +```python +def pytest_collection_modifyitems(session, config, items): + """テストスクリプトが存在しない場合に警告を出す。""" + if not items: + import warnings + warnings.warn( + "[pwk] tests/ ディレクトリにテストスクリプトが見つかりません。" + "playwright-script-creation スキルでテストスクリプトを作成してください。", + stacklevel=1, + ) +``` + +### D. plugin.json + +- 廃止: `playwright-evidence`, `playwright-overlay`, `playwright-quality` (3 スキル削除) +- 追加: `playwright-script-creation`, `playwright-execution` (2 スキル追加) +- skills 数: 45 → 44 + +### E. SKILL.md ファイル操作 + +| ファイル | 操作 | +|---|---| +| `playwright-script-creation/SKILL.md` | 新規作成 | +| `playwright-execution/SKILL.md` | 新規作成 | +| `playwright-test-planning/SKILL.md` | 改修 (次フェーズ導線追加) | +| `playwright-report/SKILL.md` | 改修 (Drive 共有削除) | +| `playwright-scenario-test/SKILL.md` | 改修 (5 スキル案内テーブル更新) | +| `playwright-evidence/SKILL.md` | 削除 (ディレクトリごと) | +| `playwright-overlay/SKILL.md` | 削除 (ディレクトリごと) | +| `playwright-quality/SKILL.md` | 削除 (ディレクトリごと) | + +## 各スキル SKILL.md の要件 + +### playwright-test-planning (改修) + +- 既存の内容を維持 +- ワークフロー末尾に「次は `/ndf:playwright-script-creation` でスクリプトを作成」を追加 +- 「テスト計画が完了するまでスクリプト作成に進まない」を明記 + +### playwright-script-creation (新規) + +- テンプレート(test_*.py.template)を起点にテストスクリプトを作成するガイド +- `playwright codegen` での操作記録 → テストコード化の手順 +- スクリプト完成後のレビューチェックリスト: + - 再現可能性の確認 (同じ環境で同じ結果が得られるか) + - テストデータの独立性 (外部依存の排除) + - page_role / role marker の付与確認 + - assert / expect の網羅性 +- 「スクリプトが完成・レビューを経てから `/ndf:playwright-execution` に進む」を明記 +- ndf plugin 非依存で動作することの説明 (init_project.sh で埋め込み済みの場合) + +### playwright-execution (新規: 3 スキル統合) + +- エビデンス収集設定 (video/trace/screenshot/HAR) — 旧 playwright-evidence +- overlay (赤丸カーソル + 字幕) — 旧 playwright-overlay +- 品質計測 (axe-core/Web Vitals/body_check) — 旧 playwright-quality +- **動画はデフォルト ON** であることを明記 +- `--pwk-no-video` で動画のみスキップ可能 +- `--pwk-no-evidence` で HAR/trace も含めて全エビデンス OFF +- 実行コマンド例、成果物ディレクトリ構造の説明 + +### playwright-report (改修) + +- 既存の Markdown レポート自動生成を維持 +- Drive 共有関連のセクション・コマンド例を削除 +- (Drive アップロードが必要な場合は kit-ops を案内) + +### playwright-scenario-test (orchestrator 改修) + +- 5 スキルへの案内テーブルを更新 +- フェーズ順序 (計画→スクリプト→実行→レポート) を明記 +- 大原則 3 つを冒頭に記載 + +## 実装上の注意点 + +- `pytest_configure` での `config.option.video` 直接設定は pytest-playwright の内部実装に依存する。実装時に pytest-playwright の `pytest_configure` フックとの実行順序を検証し、必要に応じて `tryfirst=True` や `browser_context_args` fixture 経由での制御に切り替える。 +- `--pwk-no-video` と `--pwk-no-evidence` の関係: `--pwk-no-evidence` は既存の HAR/trace OFF フラグ。`--pwk-no-video` は動画のみの独立制御。両方指定した場合は全エビデンス OFF。 +- 旧スキルディレクトリ (`playwright-evidence/`, `playwright-overlay/`, `playwright-quality/`) は SKILL.md のみ含むため、ディレクトリごと削除可能。 + +## ndf plugin 非依存の保証 + +`init_project.sh` で埋め込まれた `scenario-test/` ランタイムは: + +1. `playwright_kit/` パッケージ本体を含む +2. `pyproject.toml` で pytest11 entry-point を定義 +3. `run.sh` でワンコマンド実行可能 +4. テストスクリプト (`tests/test_*.py`) はプロジェクトフォルダに配置 + +→ ndf plugin がインストールされていない環境でも `./scenario-test/run.sh` で動作する。 From 4ac34bee2be6d66e0747e28fddd73f0626345a4c Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Mon, 25 May 2026 23:50:43 +0000 Subject: [PATCH 14/15] =?UTF-8?q?Fix:=20PR=20#18=20=E3=83=AC=E3=83=93?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=20-=20frontmatter=E4=BF=AE=E6=AD=A3=E3=83=BB=E6=97=A7?= =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=AB=E5=8F=82=E7=85=A7=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=83=BBrun.sh=20--video=E9=87=8D=E8=A4=87=E9=98=B2=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - playwright-execution/SKILL.md, playwright-script-creation/SKILL.md: frontmatter opening delimiter `---` 追加 - playwright-kit-ops/SKILL.md: 関連 Skill セクションを実在スキル名に更新 - playwright-report/SKILL.md: Google Drive 共有の文言を削除 (kit-ops に分離済み) - playwright-scenario-test/SKILL.md: クイックスタートを /ndf:playwright-kit-ops 経由に修正 - run.sh: ユーザーが --video=* を明示指定した場合は注入をスキップする制御追加 Co-Authored-By: Claude Opus 4.7 (1M context) --- plugins/ndf/skills/playwright-execution/SKILL.md | 1 + plugins/ndf/skills/playwright-kit-ops/SKILL.md | 7 +++---- plugins/ndf/skills/playwright-kit-ops/templates/run.sh | 8 ++++---- plugins/ndf/skills/playwright-report/SKILL.md | 6 +++--- plugins/ndf/skills/playwright-scenario-test/SKILL.md | 2 +- plugins/ndf/skills/playwright-script-creation/SKILL.md | 1 + 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/ndf/skills/playwright-execution/SKILL.md b/plugins/ndf/skills/playwright-execution/SKILL.md index 387838fd..0247137f 100644 --- a/plugins/ndf/skills/playwright-execution/SKILL.md +++ b/plugins/ndf/skills/playwright-execution/SKILL.md @@ -1,3 +1,4 @@ +--- name: playwright-execution description: "Playwright E2E テストの実行 + エビデンス収集 (video/trace/screenshot/HAR) + overlay (赤丸カーソル+字幕) + 品質計測 (axe-core/Web Vitals/body_check) を統合した実行フェーズスキル。動画はデフォルト ON。" when_to_use: "E2E テストの実行 / エビデンス収集 / 動画エビデンス / accessibility チェック / Core Web Vitals 計測が必要なとき。テストスクリプト作成済みであることが前提。Triggers: 'E2E テスト実行', 'テスト実行', '動画エビデンス', 'エビデンス収集', 'テスト証跡', 'a11y テスト', 'accessibility テスト', 'axe-core', 'WCAG', 'Core Web Vitals', 'Web Vitals', 'LCP', 'CLS', 'body_check', 'overlay', '字幕', 'カーソル'" diff --git a/plugins/ndf/skills/playwright-kit-ops/SKILL.md b/plugins/ndf/skills/playwright-kit-ops/SKILL.md index d0c2785c..76ed24c5 100644 --- a/plugins/ndf/skills/playwright-kit-ops/SKILL.md +++ b/plugins/ndf/skills/playwright-kit-ops/SKILL.md @@ -102,8 +102,7 @@ playwright_kit Python パッケージ本体・templates・tests はこの skill ## 関連 Skill - `/ndf:playwright-test-planning` — テスト計画 (方法論 + チェックリスト) -- `/ndf:playwright-evidence` — エビデンス収集設定ガイド -- `/ndf:playwright-overlay` — 動画装飾設定ガイド -- `/ndf:playwright-quality` — 品質計測設定ガイド -- `/ndf:playwright-report` — レポート生成設定ガイド +- `/ndf:playwright-script-creation` — テストスクリプト作成 +- `/ndf:playwright-execution` — テスト実行 + エビデンス収集 (video/trace/overlay/quality) +- `/ndf:playwright-report` — レポート生成 - `/ndf:playwright-scenario-test` — 全機能統括 diff --git a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh index 069cdbfc..a062b38c 100755 --- a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh +++ b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh @@ -85,13 +85,13 @@ fi # --- 3) pytest 実行 ------------------------------------------------ cd "$RUNTIME_DIR" -# --pwk-no-video が引数に含まれていなければ --video=on をデフォルト追加。 -# pytest_plugin.py 側でもデフォルト注入するが、run.sh 経由の場合は -# 明示的に渡すことで --video の優先度を確保する。 +# --pwk-no-video / --pwk-no-evidence / --video=* が引数に含まれていなければ +# --video=on をデフォルト追加。pytest_plugin.py 側でもデフォルト注入するが、 +# run.sh 経由の場合は明示的に渡すことで --video の優先度を確保する。 VIDEO_FLAG="--video=on" for arg in "$@"; do case "$arg" in - --pwk-no-video|--pwk-no-evidence) VIDEO_FLAG="" ;; + --pwk-no-video|--pwk-no-evidence|--video=*) VIDEO_FLAG="" ;; esac done diff --git a/plugins/ndf/skills/playwright-report/SKILL.md b/plugins/ndf/skills/playwright-report/SKILL.md index c31959cd..aca64e87 100644 --- a/plugins/ndf/skills/playwright-report/SKILL.md +++ b/plugins/ndf/skills/playwright-report/SKILL.md @@ -1,7 +1,7 @@ --- name: playwright-report -description: "Playwright テスト結果の Markdown レポート自動生成 + Google Drive 共有。テスト結果サマリ・エビデンスリンク・失敗詳細を report.md にまとめる。" -when_to_use: "テストレポートの生成 / テスト結果の共有 / Google Drive へのエビデンスアップロードが必要なとき。Triggers: 'テストレポート', 'report.md', 'テスト結果', 'テスト報告書', 'Drive 共有', 'Drive アップロード', 'エビデンス共有'" +description: "Playwright テスト結果の Markdown レポート自動生成。テスト結果サマリ・エビデンスリンク・失敗詳細を report.md にまとめる。" +when_to_use: "テストレポートの生成 / テスト結果の共有が必要なとき。Triggers: 'テストレポート', 'report.md', 'テスト結果', 'テスト報告書', 'レポート生成', 'テスト結果まとめ'" allowed-tools: - Read - Bash(uv *) @@ -11,7 +11,7 @@ allowed-tools: # Playwright Report (レポート生成) -テスト実行後に **Markdown レポート** を自動生成し、Google Drive で共有する。 +テスト実行後に **Markdown レポート** を自動生成する。 ## 自動生成 diff --git a/plugins/ndf/skills/playwright-scenario-test/SKILL.md b/plugins/ndf/skills/playwright-scenario-test/SKILL.md index e332f17f..3fefbe1b 100644 --- a/plugins/ndf/skills/playwright-scenario-test/SKILL.md +++ b/plugins/ndf/skills/playwright-scenario-test/SKILL.md @@ -53,7 +53,7 @@ Web アプリの E2E シナリオを **理論ベース** で計画し、**再現 ## クイックスタート -1. プロジェクト初期化: `./scripts/init_project.sh /path/to/your-app` +1. プロジェクト初期化: `/ndf:playwright-kit-ops` で `./scripts/init_project.sh /path/to/your-app` を実行 2. 設定編集: `scenario-test/scenario.config.yaml` 3. テストスクリプト作成: `scenario-test/tests/test_*.py` (→ `/ndf:playwright-script-creation`) 4. テスト実行 (動画デフォルト ON): `./scenario-test/run.sh` diff --git a/plugins/ndf/skills/playwright-script-creation/SKILL.md b/plugins/ndf/skills/playwright-script-creation/SKILL.md index 26a355e8..9c259f96 100644 --- a/plugins/ndf/skills/playwright-script-creation/SKILL.md +++ b/plugins/ndf/skills/playwright-script-creation/SKILL.md @@ -1,3 +1,4 @@ +--- name: playwright-script-creation description: "再現可能な E2E テストスクリプトを作成するガイド。テンプレートを起点にテストコードを実装し、再現可能性レビューを経てからテスト実行フェーズに進む。ndf plugin 非依存で動作する。" when_to_use: "E2E テストスクリプトの作成 / テストコードの実装 / テストテンプレートからのスクリプト生成が必要なとき。Triggers: 'テストスクリプト作成', 'テストコード作成', 'テスト実装', 'テストを書く', 'シナリオ作成', 'codegen', 'テンプレートからテスト', 'playwright codegen'" From d321f46bdf8c5c6050e7696889a864bded2c0699 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Tue, 26 May 2026 00:01:29 +0000 Subject: [PATCH 15/15] =?UTF-8?q?Fix:=20run.sh=20=E3=81=AE=20--video=20?= =?UTF-8?q?=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9=E5=8C=BA=E5=88=87=E3=82=8A?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=99=82=E3=81=AB=E3=83=87=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=88=20--video=3Don=20=E3=81=8C=E9=87=8D=E8=A4=87?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit case 文に --video (スペース区切り形式) を追加し、--video off のように スペースで値を渡した場合も VIDEO_FLAG を空にする。 Co-Authored-By: Claude Opus 4.7 (1M context) --- plugins/ndf/skills/playwright-kit-ops/templates/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh index a062b38c..f83d6016 100755 --- a/plugins/ndf/skills/playwright-kit-ops/templates/run.sh +++ b/plugins/ndf/skills/playwright-kit-ops/templates/run.sh @@ -91,7 +91,7 @@ cd "$RUNTIME_DIR" VIDEO_FLAG="--video=on" for arg in "$@"; do case "$arg" in - --pwk-no-video|--pwk-no-evidence|--video=*) VIDEO_FLAG="" ;; + --pwk-no-video|--pwk-no-evidence|--video|--video=*) VIDEO_FLAG="" ;; esac done