Skip to content

Commit 0e08412

Browse files
committed
cleanup reporting comment
1 parent cd3e8e7 commit 0e08412

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)