This commit is contained in:
2026-04-12 01:06:31 +07:00
commit 10d660cbcb
1066 changed files with 228596 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
# Test Report Format
Structured QA report template. Sacrifice grammar for concision.
## Template
```markdown
# Test Report — {date} — {scope}
## Test Results Overview
- **Total**: X tests
- **Passed**: X | **Failed**: X | **Skipped**: X
- **Duration**: Xs
## Coverage Metrics
| Metric | Value | Threshold | Status |
|----------|-------|-----------|--------|
| Lines | X% | 80% | PASS/FAIL |
| Branches | X% | 70% | PASS/FAIL |
| Functions| X% | 80% | PASS/FAIL |
## Failed Tests
### `test/path/file.test.ts` — TestName
- **Error**: Error message
- **Stack**: Relevant stack trace (truncated)
- **Cause**: Brief root cause analysis
- **Fix**: Suggested resolution
## UI Test Results (if applicable)
- **Pages tested**: X
- **Screenshots**: ./screenshots/
- **Console errors**: none | [list]
- **Responsive**: checked at [viewports] | skipped
- **Performance**: LCP Xs, FID Xms, CLS X
## Build Status
- **Build**: PASS/FAIL
- **Warnings**: none | [list]
- **Dependencies**: all resolved | [issues]
## Critical Issues
1. [Blocking issue description + impact]
## Recommendations
1. [Actionable improvement with priority]
## Unresolved Questions
- [Any open questions, if any]
```
## Guidelines
- Include ALL failed tests with error messages — don't summarize away details
- Coverage: highlight specific uncovered files/functions, not just percentages
- Screenshots: embed paths directly in report for easy access
- Recommendations: prioritize by impact (critical > high > medium > low)
- Keep report under 200 lines — split into sections if larger scope needed
- Save report using naming pattern from `## Naming` section injected by hooks

View File

@@ -0,0 +1,103 @@
# Test Execution Workflow
## Step 1: Identify Scope
Determine what to test based on recent changes:
- New feature → full test suite + new test cases
- Bug fix → regression tests + targeted fix validation
- Refactor → existing test suite (no new tests unless gaps found)
- Coverage check → full suite with coverage flags
## Step 2: Pre-flight Checks
Run syntax/type checks before tests to catch compile errors early:
```bash
# JavaScript/TypeScript
npx tsc --noEmit # TypeScript check
npx eslint . # Lint check
# Python
python -m py_compile file.py
flake8 .
# Flutter
flutter analyze
# Go
go vet ./...
# Rust
cargo check
```
## Step 3: Execute Tests
### JavaScript/TypeScript
```bash
npm test # or yarn test / pnpm test / bun test
npm run test:coverage # with coverage
npx vitest run # Vitest
npx jest --coverage # Jest with coverage
```
### Python
```bash
pytest # basic
pytest --cov=src --cov-report=term-missing # with coverage
python -m unittest discover # unittest
```
### Go / Rust / Flutter
```bash
go test ./... -cover # Go with coverage
cargo test # Rust
flutter test --coverage # Flutter
```
## Step 4: Analyze Results
Focus on:
1. **Failing tests** — read error messages and stack traces carefully
2. **Flaky tests** — tests that pass/fail intermittently indicate race conditions or state leaks
3. **Slow tests** — identify bottlenecks (>5s per test is suspicious)
4. **Skipped tests** — ensure skips are intentional, not hiding failures
## Step 5: Coverage Analysis
Thresholds:
- **80%+** line coverage — standard minimum
- **70%+** branch coverage — acceptable for most projects
- Focus on critical paths: auth, payment, data mutations
Identify gaps:
- Uncovered error handlers
- Missing edge case branches
- Untested utility functions
## Step 6: Build Verification
```bash
npm run build # JS/TS production build
python setup.py build # Python
go build ./... # Go
cargo build --release # Rust
flutter build # Flutter
```
Check for:
- Build warnings or deprecation notices
- Unresolved dependencies
- Production config correctness
## Quality Checklist
- [ ] All tests pass (zero failures)
- [ ] Coverage meets project threshold
- [ ] No flaky tests detected
- [ ] Build completes without errors
- [ ] Error scenarios tested
- [ ] Test isolation verified (no shared state)
- [ ] Test data cleaned up after execution
- [ ] Mocks/stubs properly configured
- [ ] Environment variables correctly set

View File

@@ -0,0 +1,65 @@
# UI Testing Workflow
Activate the ck:chrome-devtools skill.
## Purpose
Run comprehensive UI tests on a website and generate a detailed report.
## Arguments
- $1: URL - The URL of the website to test
- $2: OPTIONS - Optional test configuration (e.g., --headless, --mobile, --auth)
## Testing Protected Routes (Authentication)
### Step 1: User Manual Login
Instruct the user to:
1. Open the target site in their browser
2. Log in manually with their credentials
3. Open browser DevTools (F12) → Application tab → Cookies/Storage
### Step 2: Extract Auth Credentials
Ask the user to provide one of:
- **Cookies**: Copy cookie values (name, value, domain)
- **Access Token**: Copy JWT/Bearer token from localStorage or cookies
- **Session Storage**: Copy relevant session keys
### Step 3: Inject Authentication
Use the `inject-auth.js` script:
```bash
cd $SKILL_DIR # .opencode/skills/chrome-devtools/scripts
# Option A: Inject cookies
node inject-auth.js --url https://example.com --cookies '[{"name":"session","value":"abc123","domain":".example.com"}]'
# Option B: Inject Bearer token
node inject-auth.js --url https://example.com --token "Bearer eyJhbGciOi..." --header Authorization --token-key access_token
# Option C: Inject localStorage
node inject-auth.js --url https://example.com --local-storage '{"auth_token":"xyz","user_id":"123"}'
```
### Step 4: Run Tests
After auth injection, run tests normally:
```bash
node navigate.js --url https://example.com/dashboard
node screenshot.js --url https://example.com/profile --output profile.png
```
## Workflow
- Use `ck:plan` skill to organize the test plan & report
- All screenshots saved in the same report directory
- Browse URL, discover all pages, components, endpoints
- Create test plan based on discovered structure
- Use multiple `tester` subagents in parallel for: pages, forms, navigation, user flows, accessibility, responsive layouts, performance, security, seo
- Use `ck:ai-multimodal` to analyze all screenshots
- Generate comprehensive Markdown report
- Ask user if they want to preview with `/ck:preview`
## Output Requirements
- Clear, structured Markdown with headers, lists, code blocks
- Include test results summary, key findings, screenshot references
- Ensure token efficiency while maintaining high quality
- Sacrifice grammar for concision
**Do not** start implementing fixes.