| name | local-testing |
| description | Use when testing features with local backend integration - runs codebase E2E tests by default, uses Claude in Chrome only when explicitly requested with --browser flag |
Local Testing
Overview
๋ก์ปฌ ๋ฐฑ์๋์ ํ๋ก ํธ์๋๋ฅผ ํจ๊ป ๋์ฐ๊ณ ํ
์คํธ๋ฅผ ์ํํ๋ ์ํฌํ๋ก์ฐ.
Core principle:
- ๊ธฐ๋ณธ: ์ฝ๋๋ฒ ์ด์ค E2E ํ
์คํธ ์คํ
- ์ ํ:
--browser ํ๋๊ทธ ์ Claude in Chrome์ผ๋ก ์ค์๊ฐ ๋ธ๋ผ์ฐ์ ์ธํฐ๋์
No Mock Data Policy
์ค์: ์ด ํ
์คํธ ํ๊ฒฝ์ Mock ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ์ง ์์ต๋๋ค.
- Mock ์ฌ์ฉ ๊ธ์ง: MSW, Jest mock, fixture ๋ฐ์ดํฐ ์ฌ์ฉ ์ํจ
- ์ค์ ๋ก์ปฌ ์๋ฒ ์ฌ์ฉ: ๋ชจ๋ API ํธ์ถ์ ์ค์ ๋ฐฑ์๋ ์๋ฒ๋ก ์ ์ก
- ์ค์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฌ์ฉ: PostgreSQL (Docker) ๋๋ ๊ธฐํ DB
- ์ค์ ์ธ์ฆ ์ฌ์ฉ: ์ค์ ์ธ์ฆ ํ๋ก์ฐ ํ
์คํธ
Frontend (localhost:PORT)
โ HTTP requests
Backend (localhost:API_PORT)
โ Database queries
Database (localhost:DB_PORT)
When to Use
- ๊ฐ๋ฐํ ๊ธฐ๋ฅ์ ๋ก์ปฌ์์ ์ค์ ๋ฐฑ์๋์ ์ฐ๋ ํ
์คํธ
- "๋ก์ปฌ์์ ํ
์คํธ", "๋ฐฑ์๋ ์ฐ๋ ํ
์คํธ" ์ธ๊ธ
- API ํธ์ถ๊ณผ UI ์ํธ์์ฉ์ ํจ๊ป ๊ฒ์ฆ
Don't use for:
- ํ๋ก๋์
/์คํ
์ด์ง ํ๊ฒฝ ํ
์คํธ
- ๋ฐฑ์๋ ์์ด ํ๋ก ํธ๋ง ํ
์คํธ
Usage
/local-testing [test-name]
/local-testing [page-path] --browser
Testing Modes
Mode 1: E2E Test (Default)
When: ์๋ํ๋ ํ
์คํธ, CI/CD, ๋ฐ๋ณต ๊ฐ๋ฅํ ๊ฒ์ฆ
workflow:
1. ์๋ฒ ์ํ ํ์ธ (curl health check)
2. E2E ํ
์คํธ ์คํ (pnpm test:e2e ๋๋ npm run test:e2e)
3. ๊ฒฐ๊ณผ ๋ฆฌํฌํธ ํ์ธ
Mode 2: Browser (--browser flag)
When: ์๋ ๋๋ฒ๊น
, ์ค์๊ฐ UI ํ์ธ, ๋ณต์กํ ์ธํฐ๋์
ํ์
workflow:
1. ์๋ฒ ์ํ ํ์ธ
2. Claude in Chrome ์ฐ๊ฒฐ
3. ๋ก๊ทธ์ธ ์ํ (ํ์์)
4. ํ์ด์ง ํ์ ๋ฐ ์ธํฐ๋์
5. ๋คํธ์ํฌ/์ฝ์ ๊ฒ์ฆ
Quick Reference
| Mode | Command | Use Case |
|---|
| Default | E2E test runner | ์๋ํ๋ E2E ํ
์คํธ, ํ๊ท ํ
์คํธ |
| --browser | Claude in Chrome | ์๋ ๋๋ฒ๊น
, ์ค์๊ฐ ํ์ธ |
Implementation: E2E Test (Default)
Phase 1: Server Check
curl -s http://localhost:API_PORT/health > /dev/null && echo "โ
Backend OK" || echo "โ Backend not running"
curl -s http://localhost:FRONTEND_PORT > /dev/null && echo "โ
Frontend OK" || echo "โ Frontend not running"
Phase 2: Run E2E Tests
pnpm test:e2e
npm run test:e2e
pnpm test:e2e tests/e2e/login.spec.ts
pnpm test:e2e --grep "login"
Phase 3: Review Results
open playwright-report/index.html
Implementation: Browser Mode (--browser flag)
Phase 1: Check Servers
curl -s http://localhost:API_PORT/health > /dev/null || echo "โ Start backend first"
curl -s http://localhost:FRONTEND_PORT > /dev/null || echo "โ Start frontend first"
Phase 2: Connect Chrome
mcp-cli call claude-in-chrome/tabs_context_mcp '{"createIfEmpty": true}'
mcp-cli call claude-in-chrome/navigate '{"url": "http://localhost:FRONTEND_PORT", "tabId": <TAB_ID>}'
Phase 3: Authentication (if needed)
mcp-cli call claude-in-chrome/read_page '{"tabId": <TAB_ID>, "filter": "interactive"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "left_click", "ref": "<EMAIL_REF>"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "key", "text": "cmd+a"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "type", "text": "test@example.com"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "key", "text": "Tab"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "type", "text": "password"}'
mcp-cli call claude-in-chrome/computer '{"tabId": <TAB_ID>, "action": "key", "text": "Enter"}'
Phase 4: Navigate & Test
mcp-cli call claude-in-chrome/navigate '{"url": "http://localhost:FRONTEND_PORT/<path>", "tabId": <TAB_ID>}'
mcp-cli call claude-in-chrome/read_page '{"tabId": <TAB_ID>}'
Phase 5: Verification
mcp-cli call claude-in-chrome/read_network_requests '{"tabId": <TAB_ID>}'
mcp-cli call claude-in-chrome/read_console_messages '{"tabId": <TAB_ID>, "pattern": "error|Error"}'
Common Mistakes
| Mistake | Fix |
|---|
| ์๋ฒ ๋ฏธ์คํ ์ํ๋ก ํ
์คํธ | curl๋ก health check ๋จผ์ |
| E2E ํ
์คํธ ํ๊ฒฝ ๋ฏธ์ค์ | Playwright ์ค์น ๋ฐ ์ค์ ํ์ธ |
| ํญ ID ์ฌ์ฌ์ฉ (browser mode) | ๋งค๋ฒ tabs_context_mcp ํธ์ถ |
| ๋ก๊ทธ์ธ ์์ด ํ์ด์ง ์ ๊ทผ | ์ธ์ฆ ํ์ ํ์ด์ง๋ ๋ก๊ทธ์ธ ๋จผ์ |
| Backend ์ฝ๋ ๋ณ๊ฒฝ ๋ฏธ๋ฐ์ | ์๋ฒ ์ฌ์์ ๋๋ ์ฌ๋น๋ |
Red Flags - STOP
- ์๋ฒ ์์ ์ ๋จ โ ์๋ฌ ๋ก๊ทธ ํ์ธ
- ๋ก๊ทธ์ธ ์คํจ โ test credentials ํ์ธ
- ํ์ด์ง ๋ก๋ ์ ๋จ โ ๋คํธ์ํฌ/์ฝ์ ์๋ฌ ํ์ธ
- API ํธ์ถ ์คํจ โ ๋ฐฑ์๋ ๋ก๊ทธ ํ์ธ
E2E Test Best Practices
Element Selection
const heading = page.locator('h1').first();
const heading = page.locator('main h1').first();
Error State Testing
test('should not display error state', async ({ page }) => {
await page.waitForLoadState('networkidle');
await expect(page.locator('text=Error')).not.toBeVisible();
});
Integration
- E2E ํ
์คํธ: ๊ธฐ๋ณธ ํ
์คํธ ๋ฐฉ๋ฒ
- Claude in Chrome: ๋ธ๋ผ์ฐ์ ์ธํฐ๋์
(--browser)
- superpowers:systematic-debugging: ํ
์คํธ ์ค ๋ฒ๊ทธ ๋ฐ๊ฒฌ ์
- superpowers:requesting-code-review: ํ
์คํธ ์ฑ๊ณต ํ ์ฝ๋ ๋ฆฌ๋ทฐ