|
44 | 44 | CONVEX_PREVIEW_NAME: pr-${{ github.event.pull_request.number }} |
45 | 45 | E2E_CLERK_USER: ${{ vars.E2E_CLERK_USER }} |
46 | 46 | E2E_CLERK_PASSWORD: ${{ vars.E2E_CLERK_PASSWORD }} |
47 | | - E2E_CLERK_USER_B: ${{ vars.E2E_CLERK_USER_B }} |
48 | | - E2E_CLERK_PASSWORD_B: ${{ vars.E2E_CLERK_PASSWORD_B }} |
49 | 47 | CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }} |
50 | 48 | VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} |
51 | 49 | CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} |
@@ -73,13 +71,47 @@ jobs: |
73 | 71 | uses: actions/github-script@v8 |
74 | 72 | with: |
75 | 73 | script: | |
76 | | - const reportUrl = `https://yn1323.github.io/hosting-pages/$REPORT_DIR/${{ github.event.pull_request.number }}/`; |
| 74 | + const fs = require('fs'); |
| 75 | + const reportUrl = `https://yn1323.github.io/hosting-pages/${{ env.REPORT_DIR }}/${{ github.event.pull_request.number }}/`; |
77 | 76 | const testResult = '${{ steps.playwright.outcome }}'; |
78 | 77 | const statusEmoji = testResult === 'success' ? '✅' : '❌'; |
79 | 78 | const statusText = testResult === 'success' ? '成功' : '失敗'; |
| 79 | +
|
| 80 | + let summary = ''; |
| 81 | + try { |
| 82 | + const json = JSON.parse(fs.readFileSync('test-results.json', 'utf8')); |
| 83 | + const suites = json.suites || []; |
| 84 | + let passed = 0, failed = 0, skipped = 0; |
| 85 | + const rows = []; |
| 86 | +
|
| 87 | + function collectTests(suites) { |
| 88 | + for (const suite of suites) { |
| 89 | + for (const spec of (suite.specs || [])) { |
| 90 | + for (const test of (spec.tests || [])) { |
| 91 | + const status = test.status; |
| 92 | + if (status === 'expected') passed++; |
| 93 | + else if (status === 'unexpected') failed++; |
| 94 | + else if (status === 'skipped') skipped++; |
| 95 | + const icon = status === 'expected' ? '✅' : status === 'unexpected' ? '❌' : '⏭'; |
| 96 | + rows.push(`| ${icon} | ${spec.title} |`); |
| 97 | + } |
| 98 | + } |
| 99 | + if (suite.suites) collectTests(suite.suites); |
| 100 | + } |
| 101 | + } |
| 102 | + collectTests(suites); |
| 103 | +
|
| 104 | + summary = `\n\n**${passed} passed** / **${failed} failed** / **${skipped} skipped**\n\n`; |
| 105 | + if (rows.length > 0) { |
| 106 | + summary += `<details><summary>テスト詳細</summary>\n\n| Status | Test |\n|--------|------|\n${rows.join('\n')}\n\n</details>`; |
| 107 | + } |
| 108 | + } catch (e) { |
| 109 | + summary = '\n\n⚠️ テスト結果JSONの読み込みに失敗しました'; |
| 110 | + } |
| 111 | +
|
80 | 112 | await github.rest.issues.createComment({ |
81 | 113 | owner: context.repo.owner, |
82 | 114 | repo: context.repo.repo, |
83 | 115 | issue_number: context.issue.number, |
84 | | - body: `## 📊 Playwright Test Report\n\n${statusEmoji} **テスト結果: ${statusText}**\n\n[View Report](${reportUrl})` |
| 116 | + body: `## 📊 Playwright Test Report\n\n${statusEmoji} **テスト結果: ${statusText}**${summary}\n\n[View Report](${reportUrl})\n\nデプロイ先: https://github.com/yn1323/hosting-pages` |
85 | 117 | }); |
0 commit comments