From 8304a66e949e57833e9eb697f396e6dbb7c79081 Mon Sep 17 00:00:00 2001 From: Chris Shuttlesworth Date: Sun, 18 Oct 2026 22:35:33 -0400 Subject: [PATCH] playwright-test: an upload input keeps a green run's screenshots The playwright-report artifact (the report and test-results/, screenshots included) was uploaded only on failure, so a passing run kept no screenshots to review. A new `upload` input, default `failure`, makes the upload step run on `failure() || inputs.upload == 'always'`. Every existing caller keeps the failure-only behaviour unchanged. A value other than `failure` or `always` fails the lockstep job before any pod is spent, so a typo cannot skip the artifact. Co-Authored-By: Claude Haiku 5.5 --- .github/workflows/playwright-test.yml | 18 +++++++++++++++++- README.md | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright-test.yml b/.github/workflows/playwright-test.yml index 6dc8a6c..c13eaae 100644 --- a/.github/workflows/playwright-test.yml +++ b/.github/workflows/playwright-test.yml @@ -49,6 +49,16 @@ on: required: false type: number default: 1 + upload: + description: >- + When the `playwright-report` artifact (playwright-report/ and + test-results/, screenshots included) is uploaded. `failure` (the + default) uploads only when a suite fails, so a green run has no + artifact. `always` uploads on every run, so a green run keeps its + screenshots for review. Any other value fails the lockstep job. + required: false + type: string + default: failure playwright-image: description: >- The estate Playwright pin (ADR 0017). Override only to debug this @@ -95,6 +105,12 @@ jobs: outputs: shards: ${{ steps.shards.outputs.list }} steps: + # A typo in `upload` would otherwise skip the artifact without a word. + - name: check the upload input + env: + UPLOAD: ${{ inputs.upload }} + run: | + case "$UPLOAD" in failure|always) ;; *) echo "::error::upload must be 'failure' or 'always', got '$UPLOAD'"; exit 1 ;; esac # The test job's matrix, as a JSON list [1..shards]. Computed here # because an expression cannot build a range, and this job already runs # first; failing here also stops a bad value before any pod is spent. @@ -261,7 +277,7 @@ jobs: echo "e2e: ${{ steps.e2e.outcome }}" exit 1 - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 - if: failure() + if: failure() || inputs.upload == 'always' with: # Unique per shard: upload-artifact refuses a second artifact of the # same name in one run. diff --git a/README.md b/README.md index f392378..cd3f6a0 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,10 @@ that on three: e2e-command: npm run test:e2e -- --shard=$SHARD ``` +Set `upload: always` to keep the report and screenshots of a **green** run: the +`playwright-report` artifact is uploaded only on failure by default. The input +defaults to `failure`, so every existing caller is unchanged. + This section is the CI half only. What the repo looks like on the **inside** — the Playwright config baseline, how the app-under-test boots, test layout, and the starter smoke — is [docs/playwright-consumer.md](docs/playwright-consumer.md),