Skip to content

Client E2E Tests

Client E2E Tests #481

---
# This workflow runs client E2E tests using Playwright
#
# See: https://playwright.dev/
name: Client E2E Tests
# yamllint disable-line rule:truthy
on:
# schedule tests to run every day at 3pm UTC (10am eastern) monday-friday
schedule:
- cron: '0 15 * * 1-5'
jobs:
e2e-tests:
name: Playwright E2E Tests
timeout-minutes: 30
runs-on: ubuntu-22.04
# Shard the tests across multiple machines to improve performance
# Can be increased as needed starting with a small pool
strategy:
fail-fast: false
matrix:
shardIndex: [1]
shardTotal: [1]
steps:
- uses: actions/checkout@v3
# Debugging purposes to verify branch being worked on
- run: git branch
- name: Use Node 20.10.0 LTS
uses: actions/setup-node@v3
with:
node-version: 20.10.0
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Cache Browsers
id: cache-browsers
uses: actions/cache@v3
env:
cache-name: cache-playwright-browsers
with:
# Playwright browsers are stored in
# %USERPROFILE%\AppData\Local\ms-playwright on Windows
# ~/Library/Caches/ms-playwright on MacOS
# ~/.cache/ms-playwright on Linux
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
# Install Playwright browsers and dependencies if cache miss
- if: ${{ steps.cache-browsers.outputs.cache-hit != 'true' }}
name: Install Playwright Browsers
run: npx playwright install --with-deps
# Install Playwright dependencies only if cache hit
- if: ${{ steps.cache-browsers.outputs.cache-hit == 'true' }}
name: Install Playwright Dependencies
run: npx playwright install-deps
- name: Run Playwright tests
run: yarn workspace hmi-client test:e2e --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload test artifacts on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-e2e-report
path: packages/client/**/tests/e2e/test-report/
retention-days: 10