Files
keinasystem/.agents/workflows/testing-cleanup.md

79 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: ブラウザテスト後のクリーンアップ手順
---
# ブラウザテスト後のクリーンアップ
ブラウザサブエージェントを使ったテスト実施後、必ず以下のクリーンアップを行うこと。
## ルール
1. **テスト関連ファイルはすべて `testing/` フォルダ以下に保存する**
- スクリーンショット → `testing/screenshots/<カテゴリ>/`
- 録画(.webp`testing/recordings/`
- テスト結果レポート → `testing/test_report.md`
- サブエージェントが自動生成した一時ファイル → `testing/subagent_generated/`
2. **プロジェクトの既存ファイルを変更しない**
- ブラウザサブエージェントは内部的に Playwright を使っており、以下のファイルを勝手に生成・変更することがある:
- `frontend/playwright_*.mjs`(テストスクリプト)
- `frontend/e2e/`(テストディレクトリ)
- `frontend/test-results/`(テスト結果)
- `.gitignore`(追記されることがある)
- `docker-compose.yml``WATCHPACK_POLLING` が追加されることがある)
- `frontend/src/` 内のソースコード(稀に変更されることがある)
## テスト終了後のクリーンアップ手順
// turbo-all
### 1. git で変更されたファイルを確認する
```powershell
git diff --name-only
```
### 2. サブエージェントによる既存ファイルの変更を元に戻す
```powershell
# 典型的な復元対象
git checkout .gitignore
git checkout docker-compose.yml
git checkout frontend/src/ 2>$null
git checkout frontend/tsconfig.tsbuildinfo 2>$null
```
### 3. サブエージェントが生成した一時ファイルを `testing/subagent_generated/` に移動する
```powershell
$project = "C:\Users\akira\Develop\keinasystem_t02"
$dest = "$project\testing\subagent_generated"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
# playwright系ファイル
Get-ChildItem "$project\frontend\playwright_*.mjs" -ErrorAction SilentlyContinue | Move-Item -Destination $dest -Force
# e2eフォルダ
if (Test-Path "$project\frontend\e2e") { Move-Item "$project\frontend\e2e" "$dest\e2e" -Force }
# test-resultsフォルダ
if (Test-Path "$project\frontend\test-results") { Move-Item "$project\frontend\test-results" "$dest\test-results" -Force }
```
### 4. git管理に追加されてしまったファイルを除外する
```powershell
git rm --cached "frontend/e2e/*" 2>$null
git rm --cached "frontend/test-results/*" 2>$null
git rm --cached "frontend/playwright_*.mjs" 2>$null
```
### 5. 最終確認
```powershell
# testing/ 以外に未追跡・変更ファイルがないことを確認
git status --short | Where-Object { $_ -notmatch "testing/" }
```
上記の結果が空であればクリーンアップ完了。