Improve HTML test report (#2282)

This commit is contained in:
Michael Telatynski
2025-04-23 14:33:20 +01:00
committed by GitHub
parent a70c5e0215
commit eef66d9795
6 changed files with 84 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ jobs:
arch: [x64, ia32, arm64] arch: [x64, ia32, arm64]
with: with:
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
blob_report: true
linux: linux:
needs: fetch needs: fetch
@@ -37,14 +38,47 @@ jobs:
with: with:
sqlcipher: ${{ matrix.sqlcipher }} sqlcipher: ${{ matrix.sqlcipher }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
blob_report: true
macos: macos:
needs: fetch needs: fetch
name: macOS name: macOS
uses: ./.github/workflows/build_macos.yaml uses: ./.github/workflows/build_macos.yaml
with:
blob_report: true
tests-done: tests-done:
needs: [windows, linux, macos] needs: [windows, linux, macos]
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
if: always()
steps: steps:
- run: echo "Tests successful" - uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
pattern: blob-report-*
path: all-blob-reports
merge-multiple: true
- name: Merge into HTML Report
run: yarn playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
- name: Upload HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: html-report
path: playwright-report
retention-days: 14
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1

View File

@@ -16,6 +16,10 @@ on:
type: string type: string
required: true required: true
description: "How to link sqlcipher, one of 'system' | 'static'" description: "How to link sqlcipher, one of 'system' | 'static'"
blob_report:
type: boolean
required: false
description: "Whether to run the blob report"
env: env:
SQLCIPHER_BUNDLED: ${{ inputs.sqlcipher == 'static' && '1' || '' }} SQLCIPHER_BUNDLED: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
MAX_GLIBC: 2.31 # bullseye-era glibc, used by glibc-check.sh MAX_GLIBC: 2.31 # bullseye-era glibc, used by glibc-check.sh
@@ -194,3 +198,4 @@ jobs:
prepare_cmd: | prepare_cmd: |
sudo apt-get -qq update sudo apt-get -qq update
sudo apt install ./dist/*.deb sudo apt install ./dist/*.deb
blob_report: ${{ inputs.blob_report }}

View File

@@ -27,6 +27,10 @@ on:
type: string type: string
required: false required: false
description: "The URL to which the output will be deployed." description: "The URL to which the output will be deployed."
blob_report:
type: boolean
required: false
description: "Whether to run the blob report"
permissions: {} # No permissions required permissions: {} # No permissions required
jobs: jobs:
build: build:
@@ -159,3 +163,4 @@ jobs:
hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element && hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element &&
rsync -a /Volumes/Element/Element*.app ~/Applications/ && rsync -a /Volumes/Element/Element*.app ~/Applications/ &&
hdiutil detach /Volumes/Element hdiutil detach /Volumes/Element
blob_report: ${{ inputs.blob_report }}

View File

@@ -18,6 +18,10 @@ on:
type: string type: string
required: false required: false
description: "Command to run to prepare the executable or environment for testing" description: "Command to run to prepare the executable or environment for testing"
blob_report:
type: boolean
default: false
description: "Whether to upload a blob report instead of the HTML report"
permissions: {} permissions: {}
jobs: jobs:
test: test:
@@ -65,14 +69,22 @@ jobs:
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
timeout-minutes: 5 timeout-minutes: 5
with: with:
run: "yarn test ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }}" run: yarn test --project=${{ inputs.artifact }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }}
env: env:
ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }} ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }}
- name: Upload blob report
if: always() && inputs.blob_report
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ inputs.artifact }}
path: blob-report
retention-days: 1
- name: Upload HTML report - name: Upload HTML report
if: always() if: always() && inputs.blob_report == false
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.artifact }}-test name: ${{ inputs.artifact }}-test
path: playwright/html-report path: playwright-report
retention-days: 14 retention-days: 14

View File

@@ -30,6 +30,10 @@ on:
type: string type: string
required: false required: false
description: "Whether to sign & notarise the build, requires 'packages.element.io' environment" description: "Whether to sign & notarise the build, requires 'packages.element.io' environment"
blob_report:
type: boolean
required: false
description: "Whether to run the blob report"
permissions: {} # No permissions required permissions: {} # No permissions required
jobs: jobs:
build: build:
@@ -224,3 +228,4 @@ jobs:
artifact: win-${{ inputs.arch }} artifact: win-${{ inputs.arch }}
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }} runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
executable: ./dist/win*-unpacked/Element*.exe executable: ./dist/win*-unpacked/Element*.exe
blob_report: ${{ inputs.blob_report }}

View File

@@ -8,7 +8,25 @@ Please see LICENSE files in the repository root for full details.
import { defineConfig } from "@playwright/test"; import { defineConfig } from "@playwright/test";
const projects = [
"macos",
"win-x64",
"win-ia32",
"win-arm64",
"linux-amd64-sqlcipher-system",
"linux-amd64-sqlcipher-static",
"linux-arm64-sqlcipher-system",
"linux-arm64-sqlcipher-static",
];
export default defineConfig({ export default defineConfig({
// Allows the GitHub action to specify a project name (OS + arch) for the combined report to make sense
// workaround for https://github.com/microsoft/playwright/issues/33521
projects: process.env.CI
? projects.map((name) => ({
name,
}))
: undefined,
use: { use: {
viewport: { width: 1280, height: 720 }, viewport: { width: 1280, height: 720 },
video: "retain-on-failure", video: "retain-on-failure",
@@ -18,7 +36,7 @@ export default defineConfig({
outputDir: "playwright/test-results", outputDir: "playwright/test-results",
workers: 1, workers: 1,
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
reporter: [["html", { outputFolder: "playwright/html-report" }]], reporter: process.env.CI ? [["blob"], ["github"]] : [["html", { outputFolder: "playwright/html-report" }]],
snapshotDir: "playwright/snapshots", snapshotDir: "playwright/snapshots",
snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}", snapshotPathTemplate: "{snapshotDir}/{testFilePath}/{arg}-{platform}{ext}",
timeout: 30 * 1000, timeout: 30 * 1000,