v0.66.0: e2e results in Gitea job summary (#141)
CI / build + unit + e2e (pull_request) Successful in 14m43s
CI / build + unit + e2e (pull_request) Successful in 14m43s
The run page's Job summaries panel showed vitest results (vitest's built-in github-actions reporter auto-appends $GITHUB_STEP_SUMMARY in CI) but nothing about the Playwright suite. The E2E step now also runs the built-in json reporter (--reporter=list,json, output pinned to git-ignored test-results/e2e.json via PLAYWRIGHT_JSON_OUTPUT_FILE), and a new non-fatal 'E2E job summary' step (if: always()) parses it with an inline node script and appends spec-level passed/failed/skipped counts + failed spec names (file > title) to $GITHUB_STEP_SUMMARY. Guarded so a missing/malformed report can never fail or mask the e2e step's real exit code; no test behavior, timeouts, workers or retries changed.
This commit is contained in:
+48
-2
@@ -189,10 +189,56 @@ jobs:
|
||||
# in-network app host out of any proxy path.
|
||||
NO_PROXY: app,localhost,127.0.0.1,.kkhost.pl
|
||||
no_proxy: app,localhost,127.0.0.1,.kkhost.pl
|
||||
# Machine-readable e2e results for the job-summary step below (Playwright's built-in
|
||||
# json reporter; without this env var it would dump to stdout). test-results/ is git-ignored.
|
||||
PLAYWRIGHT_JSON_OUTPUT_FILE: test-results/e2e.json
|
||||
# Connectivity diagnostics now run post-deploy in e2e/ci-diagnostics.ts (globalSetup).
|
||||
# --reporter=list prints each test as it completes (name + ✓/× + duration) for progress
|
||||
# visibility in the job log; failure error context/snapshots are unchanged.
|
||||
run: npx playwright test --reporter=list
|
||||
# visibility in the job log; failure error context/snapshots are unchanged. The json
|
||||
# reporter adds a machine-readable report (PLAYWRIGHT_JSON_OUTPUT_FILE above) — no
|
||||
# execution behavior changes, reporters only observe.
|
||||
run: npx playwright test --reporter=list,json
|
||||
|
||||
# Appends e2e results to the job-summary panel — mirrors how unit tests get there
|
||||
# (vitest's built-in github-actions reporter auto-appends $GITHUB_STEP_SUMMARY in CI).
|
||||
# if: always() so a FAILED suite still gets summarized; non-fatal by design — a missing
|
||||
# or malformed report must never mask the real e2e exit code. The script is single-quoted
|
||||
# for bash, so it contains no apostrophes.
|
||||
- name: E2E job summary
|
||||
if: always()
|
||||
run: |
|
||||
node -e '
|
||||
const fs = require("fs");
|
||||
let report;
|
||||
try {
|
||||
report = JSON.parse(fs.readFileSync("test-results/e2e.json", "utf8"));
|
||||
} catch {
|
||||
process.exit(0); // e2e never ran (earlier step failed) or no report — nothing to summarize
|
||||
}
|
||||
let passed = 0, skipped = 0;
|
||||
const failed = [];
|
||||
const walk = (suite) => {
|
||||
for (const spec of suite.specs ?? []) {
|
||||
if (!spec.ok) failed.push(`${suite.title} › ${spec.title}`);
|
||||
else if ((spec.tests ?? []).length && spec.tests.every((t) => t.expectedStatus === "skipped")) skipped++;
|
||||
else passed++;
|
||||
}
|
||||
for (const sub of suite.suites ?? []) walk(sub);
|
||||
};
|
||||
for (const s of report.suites ?? []) walk(s);
|
||||
const lines = [
|
||||
"", "## E2E results", "",
|
||||
`- Passed: ${passed}`,
|
||||
`- Failed: ${failed.length}`,
|
||||
`- Skipped: ${skipped}`,
|
||||
];
|
||||
if (failed.length) {
|
||||
lines.push("", "### Failed specs");
|
||||
for (const f of failed) lines.push(`- \`${f}\``);
|
||||
}
|
||||
const summaryFile = process.env.GITHUB_STEP_SUMMARY;
|
||||
if (summaryFile) fs.appendFileSync(summaryFile, lines.join("\n") + "\n");
|
||||
' || true
|
||||
|
||||
# The daemon is shared with production — never leave our stack or network behind.
|
||||
# -v drops the named DB volume so every run seeds fresh (no schema drift between PRs).
|
||||
|
||||
Reference in New Issue
Block a user