Skip to content

[feat]: improve test coverage #5943

[feat]: improve test coverage

[feat]: improve test coverage #5943

Workflow file for this run

name: CI
on:
push:
branches: [develop, main]
pull_request:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
runs-on: ${{ matrix.os }}
# Run each command in parallel with the same setup steps.
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
config:
# Specify names so that the GitHub branch protection settings for
# required checks don't need to change if we ever change the commands used.
- name: npm audit
command: yarn npm audit --all --recursive --severity high
- name: lint
command: |
# lint steps
set -x
yarn license-check
yarn dedupe --check
yarn run tsc --noEmit # typecheck files that are not included by webpack or package builds
yarn run format:ci
yarn run lint:ci
yarn run lint:unused-exports
yarn run lint:dependencies
- name: packages
command: yarn run build:packages
- name: web
command: yarn run web:build:prod
- name: desktop
command: yarn run desktop:build:prod
- name: build benchmark
command: yarn run benchmark:build:prod
- name: test
command: yarn run test --maxWorkers=100%
include:
- os: windows-latest
config:
name: packages
command: echo complete
name: ${{ matrix.config.name }} (${{ matrix.os }})
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- run: corepack enable yarn
- name: Restore cache
uses: actions/cache@v6
with:
path: |
.yarn/cache
**/node_modules
key: v5-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: v5-${{ runner.os }}-yarn-
- run: yarn install --immutable
- run: ${{ matrix.config.command }}
e2e-desktop:
runs-on: ubuntu-latest
# Run smoke tests in parallel across 2 shards
# Full regression runs separately in e2e-regression.yml (nightly + develop/main)
strategy:
fail-fast: false
matrix:
shard: [1, 2]
name: e2e-desktop (ubuntu-latest) [${{ matrix.shard }}/2]
# Set a fixed timezone to ensure consistent test results.
# Lichtblick uses the system's local timezone, which can cause test assertions
# to fail due to time discrepancies across different environments.
env:
TZ: Europe/Lisbon
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- run: corepack enable yarn
- name: Restore cache
uses: actions/cache@v6
with:
path: |
.yarn/cache
**/node_modules
key: v5-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: v5-${{ runner.os }}-yarn-
- run: yarn install --immutable
- name: Apply AppArmor Fix (Ubuntu)
# Required for Playwright on Ubuntu to work properly
# See: https://github.com/microsoft/playwright/issues/34251
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
# It must be dev build, otherwise playwright wont't have all data-testid avaiable for icons
# https://mui.com/material-ui/migration/upgrade-to-v7/#svgicons-data-testid-removed
- name: Build desktop app
run: yarn desktop:build:dev
- name: Run E2E Desktop smoke tests - Shard ${{ matrix.shard }}/2
uses: coactions/setup-xvfb@v1
with:
working-directory: ./
run: yarn test:e2e:desktop:smoke:ci --shard=${{ matrix.shard }}/2
- name: Upload Desktop E2E Test Reports (Shard ${{ matrix.shard }})
if: always()
uses: actions/upload-artifact@v7
with:
name: blob-report-desktop-${{ matrix.shard }}
path: blob-report
retention-days: 1
e2e-web:
runs-on: ubuntu-latest
name: e2e-web (ubuntu-latest)
env:
TZ: Europe/Lisbon
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- run: corepack enable yarn
- name: Restore cache
uses: actions/cache@v6
with:
path: |
.yarn/cache
**/node_modules
key: v5-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: v5-${{ runner.os }}-yarn-
- run: yarn install --immutable
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E Web smoke tests
run: yarn test:e2e:web:smoke:ci
- name: Upload Web E2E Test Reports
if: always()
uses: actions/upload-artifact@v7
with:
name: e2e-web-reports
path: e2e/reports/web/
retention-days: 7
if-no-files-found: warn
# Merge reports from all shards and generate summary
e2e-report:
if: always()
needs: [e2e-desktop, e2e-web]
runs-on: ubuntu-latest
name: e2e-report (merge all reports)
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
- run: corepack enable yarn
- name: Restore cache
uses: actions/cache@v6
with:
path: |
.yarn/cache
**/node_modules
key: v5-${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: v5-${{ runner.os }}-yarn-
- run: yarn install --immutable
- name: Download all desktop blob reports
uses: actions/download-artifact@v8
with:
pattern: blob-report-desktop-*
path: all-blob-reports-desktop
merge-multiple: true
- name: Download web reports
uses: actions/download-artifact@v8
with:
name: e2e-web-reports
path: e2e/reports/web
continue-on-error: true
- name: Merge Desktop Playwright reports
run: |
mkdir -p e2e/reports/desktop
echo "Downloaded desktop blob reports:"
ls -la all-blob-reports-desktop/ || echo "No desktop blob reports found"
# Merge blob reports into JSON format
npx playwright merge-reports --reporter json ./all-blob-reports-desktop > e2e/reports/desktop/results.json
# Also generate HTML report
npx playwright merge-reports --reporter html ./all-blob-reports-desktop
echo "Merged desktop report size:"
ls -lh e2e/reports/desktop/results.json
- name: Generate E2E Test Summary
run: |
echo "Generating E2E test summary from merged reports..."
yarn ts-node e2e/ci-helpers/generate-test-summary.ts >> $GITHUB_STEP_SUMMARY
- name: Upload Merged E2E Test Reports
if: always()
uses: actions/upload-artifact@v7
with:
name: e2e-test-reports-merged
path: |
e2e/reports/
playwright-report/
retention-days: 7