Skip to content

Commit eef66d9

Browse files
authored
Improve HTML test report (#2282)
1 parent a70c5e0 commit eef66d9

File tree

6 files changed

+84
-5
lines changed

6 files changed

+84
-5
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
arch: [x64, ia32, arm64]
2626
with:
2727
arch: ${{ matrix.arch }}
28+
blob_report: true
2829

2930
linux:
3031
needs: fetch
@@ -37,14 +38,47 @@ jobs:
3738
with:
3839
sqlcipher: ${{ matrix.sqlcipher }}
3940
arch: ${{ matrix.arch }}
41+
blob_report: true
4042

4143
macos:
4244
needs: fetch
4345
name: macOS
4446
uses: ./.github/workflows/build_macos.yaml
47+
with:
48+
blob_report: true
4549

4650
tests-done:
4751
needs: [windows, linux, macos]
4852
runs-on: ubuntu-24.04
53+
if: always()
4954
steps:
50-
- run: echo "Tests successful"
55+
- uses: actions/checkout@v4
56+
57+
- uses: actions/setup-node@v4
58+
with:
59+
cache: "yarn"
60+
node-version: "lts/*"
61+
62+
- name: Install dependencies
63+
run: yarn install --frozen-lockfile
64+
65+
- name: Download blob reports from GitHub Actions Artifacts
66+
uses: actions/download-artifact@v4
67+
with:
68+
pattern: blob-report-*
69+
path: all-blob-reports
70+
merge-multiple: true
71+
72+
- name: Merge into HTML Report
73+
run: yarn playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
74+
75+
- name: Upload HTML report
76+
if: always()
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: html-report
80+
path: playwright-report
81+
retention-days: 14
82+
83+
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
84+
run: exit 1

.github/workflows/build_linux.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
type: string
1717
required: true
1818
description: "How to link sqlcipher, one of 'system' | 'static'"
19+
blob_report:
20+
type: boolean
21+
required: false
22+
description: "Whether to run the blob report"
1923
env:
2024
SQLCIPHER_BUNDLED: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
2125
MAX_GLIBC: 2.31 # bullseye-era glibc, used by glibc-check.sh
@@ -194,3 +198,4 @@ jobs:
194198
prepare_cmd: |
195199
sudo apt-get -qq update
196200
sudo apt install ./dist/*.deb
201+
blob_report: ${{ inputs.blob_report }}

.github/workflows/build_macos.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
type: string
2828
required: false
2929
description: "The URL to which the output will be deployed."
30+
blob_report:
31+
type: boolean
32+
required: false
33+
description: "Whether to run the blob report"
3034
permissions: {} # No permissions required
3135
jobs:
3236
build:
@@ -159,3 +163,4 @@ jobs:
159163
hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element &&
160164
rsync -a /Volumes/Element/Element*.app ~/Applications/ &&
161165
hdiutil detach /Volumes/Element
166+
blob_report: ${{ inputs.blob_report }}

.github/workflows/build_test.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
type: string
1919
required: false
2020
description: "Command to run to prepare the executable or environment for testing"
21+
blob_report:
22+
type: boolean
23+
default: false
24+
description: "Whether to upload a blob report instead of the HTML report"
2125
permissions: {}
2226
jobs:
2327
test:
@@ -65,14 +69,22 @@ jobs:
6569
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
6670
timeout-minutes: 5
6771
with:
68-
run: "yarn test ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }}"
72+
run: yarn test --project=${{ inputs.artifact }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }}
6973
env:
7074
ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }}
7175

76+
- name: Upload blob report
77+
if: always() && inputs.blob_report
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: blob-report-${{ inputs.artifact }}
81+
path: blob-report
82+
retention-days: 1
83+
7284
- name: Upload HTML report
73-
if: always()
85+
if: always() && inputs.blob_report == false
7486
uses: actions/upload-artifact@v4
7587
with:
7688
name: ${{ inputs.artifact }}-test
77-
path: playwright/html-report
89+
path: playwright-report
7890
retention-days: 14

.github/workflows/build_windows.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ on:
3030
type: string
3131
required: false
3232
description: "Whether to sign & notarise the build, requires 'packages.element.io' environment"
33+
blob_report:
34+
type: boolean
35+
required: false
36+
description: "Whether to run the blob report"
3337
permissions: {} # No permissions required
3438
jobs:
3539
build:
@@ -224,3 +228,4 @@ jobs:
224228
artifact: win-${{ inputs.arch }}
225229
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
226230
executable: ./dist/win*-unpacked/Element*.exe
231+
blob_report: ${{ inputs.blob_report }}

playwright.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@ Please see LICENSE files in the repository root for full details.
88

99
import { defineConfig } from "@playwright/test";
1010

11+
const projects = [
12+
"macos",
13+
"win-x64",
14+
"win-ia32",
15+
"win-arm64",
16+
"linux-amd64-sqlcipher-system",
17+
"linux-amd64-sqlcipher-static",
18+
"linux-arm64-sqlcipher-system",
19+
"linux-arm64-sqlcipher-static",
20+
];
21+
1122
export default defineConfig({
23+
// Allows the GitHub action to specify a project name (OS + arch) for the combined report to make sense
24+
// workaround for https://github.com/microsoft/playwright/issues/33521
25+
projects: process.env.CI
26+
? projects.map((name) => ({
27+
name,
28+
}))
29+
: undefined,
1230
use: {
1331
viewport: { width: 1280, height: 720 },
1432
video: "retain-on-failure",
@@ -18,7 +36,7 @@ export default defineConfig({
1836
outputDir: "playwright/test-results",
1937
workers: 1,
2038
retries: process.env.CI ? 2 : 0,
21-
reporter: [["html", { outputFolder: "playwright/html-report" }]],
39+
reporter: process.env.CI ? [["blob"], ["github"]] : [["html", { outputFolder: "playwright/html-report" }]],
2240
snapshotDir: "playwright/snapshots",
2341
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
2442
timeout: 30 * 1000,

0 commit comments

Comments
 (0)