pKouchouAI2025-10-13~14
pKouchouAI
広聴AIにPlaywright Agentを使う実験
https://chatgpt.com/share/68ec76bf-5bf0-8011-9933-e59ae74d3ca8
詳細メモ
まず code kouchou-aiする
少し混乱したがoriginがnishio/kouchou-ai、upstreamがdigitaldemocracy2030/kouchou-aiを指しているんだな
Syncした
% git checkout -b playwright-agent
Playwright を導入 / 更新
% npm install -D @playwright/test@latest
うーん、npm installは禁止中なんだよな
pnpmでやる
code::
% pnpm install -D @playwright/test@latest
Downloading lefthook-darwin-arm64@1.13.6: 5.52 MB/5.52 MB, done
Packages: +31
+++++++++++++++++++++++++++++++
Downloading next@15.5.4: 30.29 MB/30.29 MB, done
Downloading @next/swc-darwin-arm64@15.5.4: 42.36 MB/42.36 MB, done
Progress: resolved 75, reused 18, downloaded 14, added 31, done
dependencies:
+ @next/third-parties 15.5.4
devDependencies:
+ @biomejs/biome 1.9.4 (2.2.5 is available)
+ @playwright/test 1.56.0
+ lefthook 1.13.6
╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Ignored build scripts: @biomejs/biome, lefthook, sharp. │
│ Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
Done in 38s using pnpm v10.18.1
% npx playwright install --with-deps
% node -v
v22.19.0
十分新しい
Agents 定義を追加(Claude Code を使う想定)
% npx playwright init-agents --loop=claude
https://gyazo.com/a7317be8d9f8ca1a062a1d97aabafaab
入れてなかったので入れる
% npm run test:e2e
Error: No tests found
そうなんだっけ
まあまず管理画面を開くか
Claude Code のエディタ上で、planner に指示
code::
New MCP server found in .mcp.json: playwright-test │
│ MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the MCP documentation. │
│ ❯ 1. Use this and all future MCP servers in this project
「管理画面を開くテストのプランを作って」
英語で作ってきてしまうなぁ
コードと開発者コミュニティとユーザグループ
---
claudeがだいぶ苦労したけどテストができるようになりました
苦労した理由はテスト対象のサーバが適切に立ち上がってて、適切にそれを参照するように設定されていないといけないことなんですけど、ちゃんと設定できてるかのテストを先にやらせることによってAIでも何とかなりました
大きな問題を小さく分解する
Shipping with Codex
https://github.com/digitaldemocracy2030/kouchou-ai/pull/719
一通りできた