Skip to content

feat: Playwright ブラウザ接続構成 + Google Drive エビデンス保管 Skill 追加 - #19

Closed
takemi-ohama wants to merge 5 commits into
mainfrom
feature/playwright-browser-connect
Closed

feat: Playwright ブラウザ接続構成 + Google Drive エビデンス保管 Skill 追加#19
takemi-ohama wants to merge 5 commits into
mainfrom
feature/playwright-browser-connect

Conversation

@takemi-ohama

Copy link
Copy Markdown
Contributor

Summary

  • playwright-browser-connect Skill 新規追加: ローカル Chromium / Windows CDP (WSL2 Docker→Chrome) / macOS CDP (Docker Desktop→Chrome) の 3 パターンの接続構成を宣言的に切り替え可能に
  • playwright-evidence-drive Skill 新規追加: テスト後のエビデンス一式 (動画/trace/HAR/report.md) を Google Drive に保管、Google Docs 変換 + Drive リンク埋め込みに対応
  • scenario.config.yamlbrowser: セクション追加 (mode: local|cdp-remote, cdp_endpoint)
  • conftest.py.templateconnect_over_cdp() 対応の browser session fixture 追加
  • config.pyBrowserConfig dataclass 追加
  • 関連 6 Skill の参照リンクを更新
  • plugin.json v4.10.0 (46 skills)

背景

Test plan

  • uv run pytest tests/ -x -q 全テストパス (161 passed)
  • claude plugin validate plugins/ndf パス
  • BrowserConfig.from_raw() で local / cdp-remote の両モード正常パース確認
  • 実環境での CDP 接続テスト (Windows / macOS)
  • Google Drive アップロード E2E テスト

… (v4.10.0)
- playwright-browser-connect: ローカル Chromium / Windows CDP / macOS CDP の 3 パターン対応
- playwright-evidence-drive: テストエビデンス一式の Google Drive 保管・共有
- config.py に BrowserConfig dataclass 追加 (mode: local|cdp-remote)
- scenario.config.yaml に browser: セクション追加
- conftest.py.template に connect_over_cdp() 対応 browser fixture 追加
- 関連 Skill の参照リンクを更新
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 1 | gemini | REQUEST_CHANGES

Playwright のブラウザ接続構成(local/CDP)と Google Drive へのエビデンス保管機能の追加を確認しました。既存のスクリプト群を Skill として体系化し、柔軟な接続モードをサポートする設計は非常に有用です。

一方で、conftest.py.template における browser fixture の実装において、pytest-playwright 標準のカスタマイズ用 fixture である browser_type_launch_args が考慮されていない点が見受けられました。これにより、テンプレート内のコメントで案内されている設定(slow_mo 等)が機能しない状態となっているため、修正を推奨します。

Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
Comment threadplugins/ndf/.claude-plugin/plugin.json

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 1 | codex | REQUEST_CHANGES

CDP 接続設定と local mode のブラウザ起動 fixture は、生成された runtime で接続失敗または既存オプション無視が起きるため修正が必要です。

Comment threadplugins/ndf/skills/playwright-kit-ops/playwright_kit/config.py Outdated
Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
takemi-ohama added a commit that referenced this pull request May 26, 2026
- conftest.py.template: browser_type_launch_args を依存に追加し local モードで
--headed/slow_mo/channel 等が反映されるよう修正 (#1, #6)
- conftest.py.template: 変数名 b → browser に改名 (#2)
- conftest.py.template: CDP 接続時に非 Chromium ブラウザの fail-fast チェック追加 (#5)
- config.py: BrowserConfig.cdp_endpoint の既定値を ws:// → http:// に変更 (#4)
- CHANGELOG.md: v4.10.0 エントリを追加 (#3)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 2 | gemini | REQUEST_CHANGES

新規追加された Playwright 関連スクリプトのドキュメント例と実装の不整合を修正する必要があります。また、CDP 接続時の設定引き継ぎなど、テンプレート側の微調整を推奨します。

Comment threadplugins/ndf/skills/playwright-evidence-drive/SKILL.md
Comment threadplugins/ndf/skills/playwright-evidence-drive/SKILL.md Outdated
Comment threadplugins/ndf/skills/playwright-evidence-drive/SKILL.md
Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
Comment threadplugins/ndf/skills/playwright-browser-connect/SKILL.md

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 2 | codex | REQUEST_CHANGES

CDP remote の主要要件である既存 Chrome セッション再利用と、生成テンプレートの CDP endpoint 例に未修正の不整合があります。

Comment threadplugins/ndf/skills/playwright-kit-ops/templates/conftest.py.template Outdated
Comment threadplugins/ndf/skills/playwright-kit-ops/templates/scenario.config.yaml Outdated
- SKILL.md: upload_evidence.py の引数 --parent → --parent-folder-id に修正
- SKILL.md: gdrive_upload_dir.py の引数を --local/--parent に修正
- SKILL.md: build_gdoc_with_drive_links.py の引数を --md/--folder/--run-id/--name に修正
- conftest.py.template: CDP 接続時に slow_mo を渡すよう修正
- conftest.py.template: local モードで pwk_config.playwright.headless を setdefault で尊重
- conftest.py.template: CDP モード既存 Session 再利用用の _cdp_default_context fixture 追加
- playwright-browser-connect/SKILL.md: conftest.py スニペットをテンプレートと同期
- scenario.config.yaml / SKILL.md: CDP URL を ws:// → http:// に統一
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
takemi-ohama added a commit that referenced this pull request May 26, 2026
- SKILL.md: upload_evidence.py の引数 --parent → --parent-folder-id に修正
- SKILL.md: gdrive_upload_dir.py の引数を --local/--parent に修正
- SKILL.md: build_gdoc_with_drive_links.py の引数を --md/--folder/--run-id/--name に修正
- conftest.py.template: CDP 接続時に slow_mo を渡すよう修正
- conftest.py.template: local モードで pwk_config.playwright.headless を setdefault で尊重
- conftest.py.template: CDP モード既存 Session 再利用用の _cdp_default_context fixture 追加
- playwright-browser-connect/SKILL.md: conftest.py スニペットをテンプレートと同期
- scenario.config.yaml / SKILL.md: CDP URL を ws:// → http:// に統一
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 3 | codex | REQUEST_CHANGES

playwright-evidence-drive 側では Drive スクリプトの新しい CLI 引数に更新されていますが、playwright-kit-ops のエビデンスアップロード例は旧形式のままです。Skill ごとに案内が分岐しないよう、gdrive_upload_dir.pybuild_gdoc_with_drive_links.py の実行例を実スクリプトの --local/--parent--md/--folder/--run-id/--name に揃えてください。

Comment threadplugins/ndf/skills/playwright-browser-connect/SKILL.md Outdated

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 3 | gemini | REQUEST_CHANGES

PR #19 の実装を確認しました。Playwright の CDP 接続対応および Google Drive エビデンスアーカイブの Skill 分離は非常に有用な改善です。一方で、設定ファイルの尊重やロジックの重複について、以下の修正を提案します。

共通指摘

  • [minor / 保守性] playwright_kit.uploaders パッケージと scripts/upload_evidence.py のロジックが重複しています。真実の源 (SSOT) を維持するため、スクリプト側がパッケージの upload 関数を利用するようにリファクタリングを検討してください。

Comment threadplugins/ndf/skills/playwright-kit-ops/playwright_kit/config.py Outdated
- SKILL.md: TCP proxy を廃止し --remote-allow-origins=* フラグによる
Host ヘッダ検証回避に差し替え (proxy 不要でシンプル化)
- conftest.py.template: CDP接続/localモード両方で scenario.config.yaml の
playwright.slow_mo_ms をフォールバックとして反映
- config.py: cdp_endpoint が null (YAML でキーのみ定義) の場合に
"None" 文字列にならないよう or 演算子でガード
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@takemi-ohama
takemi-ohamaforce-pushed the feature/playwright-browser-connect branch from d17fb15 to 0e4a82fCompareMay 26, 2026 03:26

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 4 | gemini | REQUEST_CHANGES

今回の修正で、TCP proxy を廃止し --remote-allow-origins=* による構成簡略化が行われましたが、Windows (WSL2) 環境での接続性について懸念があります。また、設定パース時のバリデーションをより堅牢にすることで、設定不備による予期せぬクラッシュを防ぐことができます。

追加の指摘 (config.py)

  • PlaywrightConfig.from_rawhar_mode バリデーションにおいて、har_mode: (null) の時に "none" となり、デフォルトの "minimal" ではなく明示的な "なし" 設定として扱われます。意図的でない場合は or でのフォールバックを検討してください。

Comment threadplugins/ndf/skills/playwright-browser-connect/SKILL.md
Comment threadplugins/ndf/skills/playwright-kit-ops/playwright_kit/config.py Outdated

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 4 | codex | COMMENT

マーケットプレイス上の NDF 公開説明が今回の v4.10.0 / 46 skills の内容と乖離しているため、公開面の表記更新だけ対応してください。

Comment threadplugins/ndf/.claude-plugin/plugin.json
- SKILL.md: Chrome の 127.0.0.1 バインド問題に対応するネットワーク別接続ガイドを追加
(--remote-debugging-address=0.0.0.0 / socat / netsh portproxy の3方式 + 早見表)
- config.py: browser.mode が null の場合に ValueError でクラッシュする問題を修正
(raw.get("mode") or base.mode でデフォルト値へフォールバック)
- marketplace.json: NDF の description を v4.10.0 / 46 skills に更新
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 5 | gemini | REQUEST_CHANGES

Playwright 接続構成の分離と Google Drive エビデンスアーカイブ機能の追加により、WSL2/macOS 等のハイブリッド環境でのテスト実行が大幅に容易になります。機能自体は非常に有用ですが、以下の点について修正を推奨します:

  1. Drive アップロード時のファイル衝突 (重大): pytest_plugin.pypytest_sessionfinish 実装において、全テストの成果物(trace.zip 等)が単一の Drive フォルダにフラットにアップロードされるため、同名ファイルが衝突し、どのテストのエビデンスか判別できなくなります。ファイル名にテスト名を含めるか、Drive 上にディレクトリ階層を作成する対応が必要です。
  2. MIME タイプの不足: uploaders/__init__.py_MIME_BY_EXT.md が定義されていないため、report.mdapplication/octet-stream として扱われます。
  3. 接続情報の整合性: scenario.config.yaml の例示ポートが 9223 となっており、他ドキュメントとの不整合があります。

Comment threadplugins/ndf/skills/playwright-kit-ops/templates/scenario.config.yaml Outdated

@takemi-ohamatakemi-ohama left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 5 | codex | COMMENT

CDP 接続テンプレートに、現行の browser-connect 手順と異なる旧ポート例が残っています。

Comment threadplugins/ndf/skills/playwright-kit-ops/templates/scenario.config.yaml Outdated
SKILL.md や他の例示と一致するよう、旧 proxy 前提の 9223 を標準の 9222 に修正。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@takemi-ohama

Copy link
Copy Markdown
ContributorAuthor

ℹ️ レビューコメント履歴整理のため本 PR を一度 close し、同じブランチ feature/playwright-browser-connect で新 PR を作り直します。ブランチの内容・base は変えません。

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@takemi-ohama