Merge pull request #33 from trails-cool/fix-playwright-summary
This commit is contained in:
commit
970f591a60
1 changed files with 16 additions and 15 deletions
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
|
@ -186,24 +186,25 @@ jobs:
|
|||
if [ -f playwright-results.json ]; then
|
||||
node -e "
|
||||
const r = require('./playwright-results.json');
|
||||
const total = r.suites.reduce((n, s) => n + s.specs.length, 0);
|
||||
const passed = r.suites.reduce((n, s) => n + s.specs.filter(t => t.ok).length, 0);
|
||||
const failed = total - passed;
|
||||
const dur = (r.stats.duration / 1000).toFixed(1);
|
||||
const s = r.stats;
|
||||
const dur = (s.duration / 1000).toFixed(1);
|
||||
let md = '## Playwright E2E Results\n\n';
|
||||
md += '| Status | Count |\n|--------|-------|\n';
|
||||
md += '| :white_check_mark: Passed | ${passed} |\n';
|
||||
if (failed > 0) md += '| :x: Failed | ${failed} |\n';
|
||||
md += '| Total | ${total} |\n';
|
||||
md += '| Duration | ${dur}s |\n\n';
|
||||
for (const suite of r.suites) {
|
||||
md += '### ' + suite.title + '\n\n';
|
||||
for (const spec of suite.specs) {
|
||||
const icon = spec.ok ? ':white_check_mark:' : ':x:';
|
||||
const time = spec.tests?.[0]?.results?.[0]?.duration;
|
||||
md += '- ' + icon + ' ' + spec.title + (time ? ' (' + time + 'ms)' : '') + '\n';
|
||||
md += '| :white_check_mark: Passed | ' + s.expected + ' |\n';
|
||||
if (s.unexpected > 0) md += '| :x: Failed | ' + s.unexpected + ' |\n';
|
||||
if (s.flaky > 0) md += '| :warning: Flaky | ' + s.flaky + ' |\n';
|
||||
if (s.skipped > 0) md += '| :fast_forward: Skipped | ' + s.skipped + ' |\n';
|
||||
md += '| :stopwatch: Duration | ' + dur + 's |\n\n';
|
||||
for (const file of r.suites) {
|
||||
for (const describe of (file.suites || [])) {
|
||||
md += '### ' + describe.title + '\n\n';
|
||||
for (const spec of (describe.specs || [])) {
|
||||
const icon = spec.ok ? ':white_check_mark:' : ':x:';
|
||||
const t = spec.tests?.[0]?.results?.[0]?.duration;
|
||||
md += '- ' + icon + ' ' + spec.title + (t ? ' (' + t + 'ms)' : '') + '\n';
|
||||
}
|
||||
md += '\n';
|
||||
}
|
||||
md += '\n';
|
||||
}
|
||||
require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, md);
|
||||
"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue