@@ -74,24 +74,47 @@ jobs:
7474 if (fs.existsSync(resultsPath)) {
7575 const results = JSON.parse(fs.readFileSync(resultsPath, 'utf8'));
7676 const { stats } = results;
77-
77+
78+ const total = stats.expected + stats.unexpected + stats.flaky + stats.skipped;
79+ const failed = stats.unexpected > 0;
80+
81+ const summary = failed
82+ ? `> 🚨 **Test Run Failed** – ${stats.unexpected} failing test(s)`
83+ : `> ✅ **All Tests Passed!** 🎉`;
84+
85+ const table = `
86+ | Metric | Count |
87+ |----------|-------|
88+ | 🧪 Total | ${total} |
89+ | ✅ Passed | ${stats.expected} |
90+ | ❌ Failed | ${stats.unexpected} |
91+ | ⚠️ Flaky | ${stats.flaky} |
92+ | ⏭️ Skipped | ${stats.skipped} |
93+ | ⏱ Duration | ${Math.round(stats.duration / 1000)}s |
94+ `;
95+
96+ const link = `[📊 View full Playwright report](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`;
97+
7898 const body = `## 🎭 Playwright Test Results
79-
80- **Tests:** ${stats.expected + stats.unexpected + stats.flaky + stats.skipped}
81- **✅ Passed:** ${stats.expected}
82- **❌ Failed:** ${stats.unexpected}
83- **⚠️ Flaky:** ${stats.flaky}
84- **⏭️ Skipped:** ${stats.skipped}
85- **⏱️ Duration:** ${Math.round(stats.duration / 1000)}s
86-
87- ${stats.unexpected > 0 ? '❌ Some tests failed. Check the [Playwright report](https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId + ') for details.' : '✅ All tests passed!'}`;
88-
89- github.rest.issues.createComment({
90- issue_number: context.issue.number,
91- owner: context.repo.owner,
92- repo: context.repo.repo,
93- body: body
94- });
99+
100+ ${summary}
101+
102+ <details>
103+ <summary>📖 Detailed Results</summary>
104+
105+ ${table}
106+
107+ </details>
108+
109+ ${link}
110+ `;
111+
112+ github.rest.issues.createComment({
113+ issue_number: context.issue.number,
114+ owner: context.repo.owner,
115+ repo: context.repo.repo,
116+ body: body
117+ });
95118 }
96119 } catch (error) {
97120 console.log('Could not post test results:', error.message);
0 commit comments