Reading a red pipeline
Why This Matters
A red pipeline is a question: what broke, and whose problem is it? Teams that answer it in two minutes keep trusting their tests. Teams that need to dig for half an hour start pressing Re-run all jobs until it turns green, and from then on the suite protects nobody. This lesson makes the run page answer most of the question itself, and gives you a fixed order for the rest.
What you will learn
- A job summary that lists failures on the run page itself
- A reading order: which job, which tests, which pattern, which trace
- Recognising a product bug, a test bug, an environment problem and a flaky test
The summary on the run page
The report job ends with:
- run: node scripts/summary.mjs test-results/results.json
scripts/summary.mjs in the example repository reads the merged JSON report (lesson 37) and writes Markdown to the file in $GITHUB_STEP_SUMMARY. GitHub shows that Markdown on the run page, under the job graph. This is run #13 on main, green:
On a red run the script adds a table with one row per failed or flaky test. You can run it locally on any results.json. With TAX_RATE broken as in the exercise of lesson 37, the output is:
## Playwright results
✅ 3 passed · ❌ 1 failed · ⚠️ 0 flaky · ⏭️ 0 skipped · 1 s
| Status | Project | Test | Error |
|---|---|---|---|
| ❌ failed | unit | module-1/cart-maths.spec.ts › total adds 21% tax, like the shop's checkout | Error: expect(received).toBe(expected) // Object.is equality · Expected: 72.59 · Received: 71.99 |
Download **playwright-report** below for traces, screenshots and the full HTML report.
This is a real red run: run #18 on the exercise/flaky branch, the first version of the hybrid test from lesson 35:
The page alone already tells you a lot. One test fails, in Firefox and WebKit but not in Chromium. 128 other tests pass, so the site is up. The Error column says the sandbox id was "…", the placeholder the page shows before it knows the id. That is a value read too early: a timing problem in the test, found without opening a single log.
What the first version got wrong
The first version of the script showed only the first line of each error. For this failure that line is Error: expect(received).toBe(expected) // Object.is equality, which is true and useless: it says an assertion failed, not what was expected. The script now keeps the first three non-empty lines of the message, which for nearly every Playwright assertion include Expected and Received, or the locator. Test your own CI output on a real failure before you trust it.
The heart of the script is a walk through the JSON tree that collects every test with the status unexpected or flaky:
for (const spec of suite.specs ?? []) {
for (const t of spec.tests ?? []) {
if (t.status !== "unexpected" && t.status !== "flaky") continue;
const failed = t.results.find((r) => r.status !== "passed" && r.status !== "skipped");
// ... first three lines of failed.error.message, then one table row
}
}
It uses the test status (unexpected, flaky) to decide which tests to list, and the result status (failed, timedOut) to find the attempt with the error: the two levels from lesson 37.
A reading order
1. Which job is red?
| Red | Meaning |
|---|---|
test (1) at typecheck or lint | The code does not compile or breaks a lint rule. No tests ran on that shard. |
test (N) at Run tests | Tests failed. Go on to step 2. |
report | Merging or the summary failed. The tests themselves may be fine. Open the job log. |
Watch out for the first case. Because of if: ${{ !cancelled() }}, the report job still runs, but it only has the blob report of the other shard. The summary then shows about half the tests, all green. Always check the total: this suite has 127 tests.
2. Which tests failed?
Read the summary table, not the log. Then look for the pattern:
| Pattern | Most likely |
|---|---|
| One test, in all three browsers | The test or the product changed. Not a browser problem. |
| One test, in one browser only | A browser difference, or timing that only that browser exposes (lesson 35) |
| ⚠️ flaky | Timing or shared data. Passing on a retry is not “fine” (lesson 35). |
| Many unrelated tests, mostly timeouts | The environment: the site is down or slow. Check https://practiceautomatedtesting.com/api/shop/health before reading any test. |
Only the visual project | A rendering change, or a Playwright upgrade without new baselines (module 6) |
3. Open the evidence
Download the playwright-report artifact at the bottom of the run page, unzip it and run:
npx playwright show-report playwright-report
Every failed test has a trace from its first retry. Read it in the order of lesson 14: errors, the step before the failure, network, console.
4. Name the cause
Give every failure one verdict before you change anything:
- Product bug: the application does something wrong. File a bug; do not “fix” the test.
- Test bug: the test is wrong (a locator, an expectation, a missing wait). Fix the test.
- Environment: the site, the network or the data was not what the test needed. Fix the setup, or make the test independent of it.
- Flaky: it passes sometimes. Find the cause (lesson 35); do not raise the retries.
Only a product bug is a reason to stop a release. The other three are reasons to fix your suite, quickly, before people stop believing it.
When re-running is fine
Re-run failed jobs is fine when you already know the cause is outside the code: the health check was down, a GitHub runner crashed, or a download failed. It is not fine as a way to find out whether it was “just flaky”. If it turns green, you have learned nothing, and the cause is still there.
Exercise
The latest run on the exercise/debugging branch is red on purpose (lesson 14). Without opening the code first:
- How many tests failed, in which projects? Is that a browser problem?
- Use the summary table and the traces to give each failed test a verdict: product, test, environment or flaky.
- Compare your verdicts with lesson 15.
Show suggested answer
The five broken tests of module 3 fail in all three browser projects: 15 rows in the table, each one failed on all three attempts. Because the same test fails in Chromium, Firefox and WebKit, it is not a browser problem.
One exception is possible: the test that reads the result count with textContent depends on timing. If a retry happens to read the count after the search has finished, that row shows as ⚠️ flaky instead. That is not a better result: it is the same test bug, now hiding.
None of them is a product bug: the shop works, as main with the same site proves. Four are test bugs: an Add to Cart locator that matches five buttons (strict mode), a test id that does not exist, a count read with textContent instead of asserted, and a wrong expected price. The fifth, the slow-backend test, is an environment problem the test itself creates: the products request takes six seconds and the assertion waits five.
If you reached those verdicts from the summary and the traces alone, the pipeline did its job: it explained itself.

