Skip to content

Commit aa2cd95

Browse files
committed
chore: conflict 해결 및 테마 변경으로 인한 컬러 수정
2 parents c81de72 + c036c40 commit aa2cd95

106 files changed

Lines changed: 18225 additions & 18869 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/testing.mdc

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
## <!-- .cursor/rules/test.playwright.mdc -->
2+
3+
description: "Testing rules (Jest + RTL + Playwright)"
4+
globs: ["**/*.{ts,tsx}"]
5+
alwaysApply: true
6+
7+
---
8+
9+
# Testing Rules
10+
11+
## General
12+
13+
- File naming: `*.test.ts(x)` for unit/component, `*.spec.ts(x)` for integration/E2E.
14+
- Co-locate tests with code when small; otherwise keep under `/tests`.
15+
- Aim for high-value coverage (core logic ~80%+). Skip trivial one-liners.
16+
- Naming: `describe(Component)` + `it('renders …')` with full-sentence style.
17+
- **Comments must be in English** for international collaboration and maintainability.
18+
- **Keep comments minimal and concise** - only add comments when they provide essential context or explain non-obvious behavior.
19+
20+
## Unit/Component (Jest + React Testing Library)
21+
22+
- Test **public behavior** (render, interaction, output). Avoid testing internals.
23+
- Each critical component should include:
24+
- Render snapshot (basic mount),
25+
- Interaction (click, input, keyboard),
26+
- a11y basics (role/label presence, keyboard navigation),
27+
- Store selector correctness (mock store when needed).
28+
- Prefer `screen.getByRole` over `getByTestId` unless no semantic alternative.
29+
- Use `@testing-library/jest-dom` matchers for DOM assertions.
30+
31+
## Store (Zustand slices)
32+
33+
- Test actions:
34+
- Initial state correctness,
35+
- Success/error branches,
36+
- Immutable updates.
37+
- Async actions: mock API calls, assert `isLoading/error/data` transitions.
38+
- Test persistence middleware behavior when applicable.
39+
40+
## E2E (Playwright)
41+
42+
- Cover only critical flows:
43+
- Happy path: load → interact → result,
44+
- Core regressions: auth, filters, CRUD happy path.
45+
- Store screenshots/videos on CI for failed runs.
46+
- Prefer deterministic locators (role, label, data-testid) over CSS selectors.
47+
- Use `page.waitForSelector` for dynamic content loading.
48+
49+
## Package-Specific Rules
50+
51+
### View Package
52+
53+
- Test React components with Jest + RTL
54+
- Test Zustand stores (theme, branch, data, loading, etc.)
55+
- E2E tests for webview interactions
56+
- Mock VSCode API calls appropriately
57+
58+
### Analysis Engine Package
59+
60+
- Test core logic with Jest (Node environment)
61+
- Mock external dependencies (GitHub API, file system)
62+
- Test parsing and analysis algorithms
63+
64+
### VSCode Extension Package
65+
66+
- Test extension commands and utilities
67+
- Mock VSCode extension API
68+
- Test webview communication
69+
70+
## Iterative Test Refinement
71+
72+
- When a test fails, analyze the provided error log to identify the root cause.
73+
- **Priority 1: Locators.** If an element is not found, correct the Playwright locator first. Prefer `getByRole`, `getByText`, `data-testid` in that order.
74+
- **Priority 2: Timing.** If the locator is correct but the element is not ready, add or adjust `page.waitForSelector` or other appropriate `waitFor` functions. Do not use fixed `page.waitForTimeout()`.
75+
- **Priority 3: Assertions.** Ensure the assertion (`expect()`) matches the actual state of the application described in the error log.
76+
- Modify the minimum necessary code to fix the specific error. Do not refactor unrelated code.
77+
78+
## Accessibility
79+
80+
- Include basic accessibility checks (role/label presence, keyboard navigation).
81+
- Ensure focus management in modals/menus is tested.
82+
83+
## Misc
84+
85+
- Keep tests fast/deterministic. Avoid real timeouts/network.
86+
- Use Jest's timer mocking (`jest.useFakeTimers`) if time-dependent.
87+
- Mock D3.js and other heavy dependencies appropriately.
88+
- Use `testPathIgnorePatterns` to exclude build artifacts.
89+
- Ensure focus management in modals/menus is tested.

.cursor/templates/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Cursor AI 테스트 생성 도구
2+
3+
이 디렉토리는 Cursor AI를 활용하여 **Githru VSCode Extension** 프로젝트의 테스트 코드를 자동 생성하는 도구들을 모아놓은 곳입니다.
4+
5+
## 📁 프로젝트 구조
6+
7+
```
8+
githru-vscode-ext/
9+
├── .cursor/ # Cursor AI 도구들
10+
│ ├── rules/
11+
│ │ └── testing.mdc # 테스트 작성 규칙
12+
│ └── templates/
13+
│ ├── test.playwright.md # E2E 테스트 템플릿
14+
│ └── README.md # 이 파일
15+
├── packages/
16+
│ ├── view/ # React 웹뷰 패키지
17+
│ │ ├── src/
18+
│ │ │ ├── components/ # React 컴포넌트들
19+
│ │ │ ├── store/ # Zustand 상태 관리
20+
│ │ │ └── fake-assets/ # 테스트용 모킹 데이터
21+
│ │ └── tests/ # 실제 테스트 파일들
22+
│ │ ├── pr-commit-detail.e2e.spec.ts
23+
│ │ ├── temporal-filter.e2e.spec.ts
24+
│ │ └── fakeAsset.ts # 테스트 헬퍼 함수들
25+
│ ├── analysis-engine/ # 분석 엔진 패키지
26+
│ └── vscode/ # VSCode 확장 패키지
27+
```
28+
29+
## 🚀 빠른 시작 (Quick Start)
30+
31+
### 1. E2E 테스트 생성 (Playwright)
32+
33+
**템플릿 파일**: `.cursor/templates/test.playwright.md`
34+
35+
1. **템플릿 열기**: `.cursor/templates/test.playwright.md` 파일을 엽니다
36+
2. **시나리오 작성**: 아래 예시를 참고해 테스트 시나리오를 작성합니다
37+
3. **AI 실행**: `⌃+I` (Cursor Agent)를 누르고 템플릿을 붙여넣습니다
38+
4. **파일 생성**: AI가 자동으로 `packages/view/tests/`에 테스트 파일을 생성합니다
39+
40+
## 📝 사용 예시
41+
42+
### E2E 테스트 예시 (TemporalFilter)
43+
44+
```markdown
45+
Context:
46+
47+
- 테스트 대상: TemporalFilter 컴포넌트
48+
- 시나리오:
49+
- [ ] 기간 브러시 필터링이 정상 작동해야 한다
50+
- [ ] 필터링 후 통계가 갱신되어야 한다
51+
- [ ] Reset 버튼으로 필터가 해제되어야 한다
52+
53+
Constraints:
54+
55+
- Zustand state only (no other state libs)
56+
- Mock external dependencies (GitHub API, file system)
57+
- VSCode webview environment
58+
```
59+
60+
**결과**: `packages/view/tests/temporal-filter.e2e.spec.ts` 파일 생성
61+
62+
## 🔧 테스트 룰 및 규칙
63+
64+
### 자동 적용되는 룰
65+
66+
**룰 파일**: `.cursor/rules/testing.mdc`
67+
68+
- Cursor가 자동으로 이 룰을 적용하여 일관된 테스트 코드를 생성합니다
69+
- **Jest + RTL + Playwright** 패턴을 따릅니다
70+
- **VSCode webview 환경**에 최적화되어 있습니다
71+
- **Zustand 상태 관리****외부 의존성 모킹**을 자동으로 처리합니다
72+
73+
### 파일 명명 규칙
74+
75+
- **E2E 테스트**: `{component-name}.e2e.spec.ts`
76+
77+
### 실제 테스트 파일 위치
78+
79+
```
80+
packages/view/tests/
81+
```
82+
83+
## 🎯 테스트 실행 방법
84+
85+
### E2E 테스트 실행
86+
87+
```bash
88+
# packages/view 디렉토리로 이동
89+
cd packages/view
90+
91+
# 모든 E2E 테스트 실행
92+
npm run test:e2e
93+
94+
# 특정 테스트 실행
95+
npm run test:e2e -- tests/pr-commit-detail.e2e.spec.ts
96+
npm run test:e2e -- tests/temporal-filter.e2e.spec.ts
97+
98+
# 특정 브라우저에서 실행
99+
npm run test:e2e -- --project=chromium
100+
npm run test:e2e -- --project=webkit
101+
```
102+
103+
### 테스트 결과 확인
104+
105+
```bash
106+
# 테스트 리포트 확인
107+
npx playwright show-report
108+
109+
# 헤드리스 모드로 실행
110+
npm run test:e2e -- --headed
111+
112+
# 디버그 모드로 실행
113+
npm run test:e2e -- --debug
114+
```
115+
116+
## 🔧 커스터마이징
117+
118+
### 새로운 템플릿 추가
119+
120+
1. `.cursor/templates/` 디렉토리에 새 `.md` 파일 생성
121+
2. 프롬프트 템플릿 작성
122+
3. 이 README에 사용법 추가
123+
124+
**현재 사용 가능한 템플릿**:
125+
126+
- `test.playwright.md`: E2E 테스트 생성용
127+
128+
### 룰 수정
129+
130+
1. `.cursor/rules/testing.mdc` 파일 편집
131+
2. 프로젝트 요구사항에 맞게 가이드라인 조정
132+
133+
## ⚠️ 주의사항
134+
135+
- **생성된 테스트는 반드시 실제 실행해보고 검증하세요**
136+
- **VSCode webview 환경의 제약사항**을 고려하세요
137+
- **Zustand 상태 관리****외부 의존성 모킹**이 자동으로 적용됩니다
138+
- **로딩 상태가 너무 빠를 경우** 스피너 테스트가 스킵될 수 있습니다
139+
- **실제 DOM 구조**에 맞춰 셀렉터가 자동으로 조정됩니다
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!-- ai/template/test.playwright.md -->
2+
3+
# ✅ Playwright Test Prompt (Auto-Enhanced)
4+
5+
## 🎯 목적
6+
7+
주요 사용자 시나리오를 **E2E 테스트**로 검증한다.
8+
E2E 테스트 코드를 생성하고 자동으로 실행하여 실패 시 수정까지 한 번에 처리한다.
9+
10+
---
11+
12+
## 📌 사용 방법
13+
14+
1. 테스트 대상 컴포넌트/플로우를 지정한다.
15+
2. 주요 시나리오(AC 기반)를 적는다.
16+
3. Cursor Agent (⌃+I)에 붙여넣는다.
17+
4. **자동으로 테스트 실행 및 결과 분석**
18+
5. **실패 시 자동 수정 제안 및 재실행**
19+
20+
---
21+
22+
## 🚦 가드레일
23+
24+
You are in **AUTO-ENHANCED-TEST-GENERATION** mode.
25+
MUST create runnable Playwright test code (`*.spec.ts`) AND automatically execute it.
26+
Follow project conventions (TypeScript, Playwright setup).
27+
Keep tests fast, deterministic (no arbitrary `timeout`).
28+
29+
**CRITICAL WORKFLOW:**
30+
31+
1. Generate test code based on scenarios
32+
2. Execute test automatically
33+
3. If test fails, analyze error and fix test code
34+
4. Retry up to 3 times with automatic fixes
35+
5. Only modify test code, never modify source code
36+
37+
---
38+
39+
## 입력 템플릿
40+
41+
Context:
42+
43+
- 테스트 대상 (페이지/컴포넌트):
44+
- 시나리오 (AC):
45+
- [ ] 시나리오 1
46+
- [ ] 시나리오 2
47+
- [ ] 시나리오 3
48+
49+
Constraints:
50+
51+
- Zustand state only (no other state libs)
52+
- Mock external dependencies (GitHub API, file system)
53+
- VSCode webview environment
54+
55+
---
56+
57+
## Output contract
58+
59+
- Playwright test code in TypeScript (`*.spec.ts`)
60+
- 테스트는 Happy Path + Critical Regression 최소 커버
61+
- 코드 블록은 반드시 실행 가능해야 함
62+
- Use `page.waitForSelector` for dynamic content
63+
- **반드시 파일 생성**: `packages/view/tests/{component-name}.e2e.spec.ts` 경로에 저장
64+
- **자동 실행**: 생성 후 즉시 `npm run test:e2e` 실행
65+
- **자동 수정**: 실패 시 에러 분석 후 수정된 코드 제안
66+
- **최대 3회 재시도**: 테스트 코드만 수정하여 성공할 때까지 시도
67+
- **소스 코드 수정 금지**: 테스트 코드만 변경 가능
68+
69+
## 🔄 자동 수정 규칙
70+
71+
### 로케이터 오류 수정
72+
73+
- `page.locator()``page.waitForSelector()` + `page.locator().first()`
74+
- 더 구체적인 셀렉터 사용
75+
- `data-testid` 우선 사용
76+
77+
### 타이밍 이슈 수정
78+
79+
- `timeout` 값 2배 증가
80+
- `page.waitForLoadState('networkidle')` 추가
81+
- `page.waitForTimeout()` 적절히 사용
82+
83+
### 네트워크 에러 수정
84+
85+
- `page.route()` 사용하여 API 모킹
86+
- `beforeEach`에 네트워크 모킹 추가
87+
88+
### 콘솔 에러 수정
89+
90+
- `page.on('console')` 이벤트 리스너 추가
91+
- 에러 로깅 및 처리
92+
93+
End with:
94+
95+
- CONFIRM: TEST CASES GENERATED AND EXECUTED

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
.DS_Store
33
.idea
4+
/.claude/
5+
/CLAUDE.md
6+
/.rules/

0 commit comments

Comments
 (0)