Skip to content

Commit d32d009

Browse files
committed
test(frontend/tests): add unit and E2E test summaries to CI workflow
Enhanced the CI workflow to generate summaries for unit and E2E tests. This includes coverage metrics for unit tests and a report link for E2E tests. Modified files: - .github/workflows/frontend.yml: Added steps for generating test summaries
1 parent 0fecd61 commit d32d009

3 files changed

Lines changed: 42 additions & 5 deletions

File tree

.github/workflows/frontend.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ jobs:
4545
- name: Run Unit Tests with Coverage
4646
run: pnpm test:coverage
4747

48+
- name: Generate Unit Test Summary
49+
if: ${{ !cancelled() }}
50+
run: |
51+
echo "## 🧪 Unit Test Results" >> $GITHUB_STEP_SUMMARY
52+
echo "" >> $GITHUB_STEP_SUMMARY
53+
if [ -f coverage/coverage-summary.json ]; then
54+
echo "### 📊 Coverage Summary" >> $GITHUB_STEP_SUMMARY
55+
echo "" >> $GITHUB_STEP_SUMMARY
56+
echo "| Metric | Coverage |" >> $GITHUB_STEP_SUMMARY
57+
echo "|--------|----------|" >> $GITHUB_STEP_SUMMARY
58+
echo "| Lines | $(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')% |" >> $GITHUB_STEP_SUMMARY
59+
echo "| Statements | $(cat coverage/coverage-summary.json | jq -r '.total.statements.pct')% |" >> $GITHUB_STEP_SUMMARY
60+
echo "| Functions | $(cat coverage/coverage-summary.json | jq -r '.total.functions.pct')% |" >> $GITHUB_STEP_SUMMARY
61+
echo "| Branches | $(cat coverage/coverage-summary.json | jq -r '.total.branches.pct')% |" >> $GITHUB_STEP_SUMMARY
62+
else
63+
echo "⚠️ Coverage summary not available" >> $GITHUB_STEP_SUMMARY
64+
fi
65+
echo "" >> $GITHUB_STEP_SUMMARY
66+
4867
- name: Upload Unit Test Coverage Report
4968
uses: actions/upload-artifact@v4
5069
if: ${{ !cancelled() }}
@@ -59,6 +78,22 @@ jobs:
5978
- name: Run E2E Tests
6079
run: pnpm test:e2e
6180

81+
- name: Generate E2E Test Summary
82+
if: ${{ !cancelled() }}
83+
run: |
84+
echo "## 🎭 Playwright E2E Test Results" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
if [ -f playwright-report/index.html ]; then
87+
echo "✅ E2E tests completed. See artifacts for detailed HTML report." >> $GITHUB_STEP_SUMMARY
88+
else
89+
echo "⚠️ Report not generated" >> $GITHUB_STEP_SUMMARY
90+
fi
91+
echo "" >> $GITHUB_STEP_SUMMARY
92+
echo "📥 **Download Reports:**" >> $GITHUB_STEP_SUMMARY
93+
echo "- \`playwright-report\` - Interactive HTML report" >> $GITHUB_STEP_SUMMARY
94+
echo "- \`unit-test-coverage\` - Coverage HTML report" >> $GITHUB_STEP_SUMMARY
95+
echo "" >> $GITHUB_STEP_SUMMARY
96+
6297
- name: Upload E2E Test Report
6398
uses: actions/upload-artifact@v4
6499
if: ${{ !cancelled() }}

src/frontend/task-agent-web/playwright.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export default defineConfig({
2424
workers: process.env.CI ? 1 : undefined,
2525

2626
// Reporter to use
27-
reporter: [
28-
['html', { open: 'never' }],
29-
['list'],
30-
],
27+
// - 'github' for CI: generates annotations directly in GitHub Actions
28+
// - 'html' for detailed reports (uploaded as artifacts)
29+
// - 'list' for console output
30+
reporter: process.env.CI
31+
? [['github'], ['html', { open: 'never' }], ['list']]
32+
: [['html', { open: 'never' }], ['list']],
3133

3234
// Shared settings for all projects
3335
use: {

src/frontend/task-agent-web/vitest.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineConfig({
1212
exclude: ['node_modules', '.next', 'e2e'],
1313
coverage: {
1414
provider: 'v8',
15-
reporter: ['text', 'json', 'html'],
15+
reporter: ['text', 'json', 'json-summary', 'html'],
1616
exclude: [
1717
'node_modules',
1818
'.next',

0 commit comments

Comments
 (0)