Skip to content
Latchkey

playwright-e2e workflow (viser-project/viser)

The playwright-e2e workflow from viser-project/viser, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: viser-project/viser.github/workflows/playwright.ymlLicense Apache-2.0View source

What it does

This is the playwright-e2e workflow from the viser-project/viser repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: playwright-e2e

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

concurrency:
  group: playwright-${{ github.ref }}
  cancel-in-progress: true

jobs:
  e2e-tests:
    runs-on: ubuntu-latest
    strategy:
      # Don't cancel the other shards/versions when one fails -- we want the
      # full failure picture.
      fail-fast: false
      matrix:
        python-version: ["3.9", "3.12"]
        # Shard the suite across runners (pytest-split, balanced by
        # .test_durations) so wall-clock is ~tests/3. Keep `group` count in sync
        # with `--splits` below.
        group: [1, 2, 3]

    steps:
      - uses: actions/checkout@v4

      # Restores the shared client build from cache; only builds on a cache miss
      # (i.e. the first job after a client source change). Identical build is
      # reused across the matrix, other workflows, and subsequent runs.
      - uses: ./.github/actions/build-client

      - uses: ./.github/actions/setup-e2e
        with:
          python-version: ${{ matrix.python-version }}

      - name: Run E2E tests
        run: uv run pytest tests/e2e/ --splits 3 --group ${{ matrix.group }} -n auto

      - name: Upload test results on failure
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-test-results-py${{ matrix.python-version }}-group${{ matrix.group }}
          path: test-results/
          retention-days: 30

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: playwright-e2e
 
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
 
concurrency:
  group: playwright-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  e2e-tests:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      # Don't cancel the other shards/versions when one fails -- we want the
      # full failure picture.
      fail-fast: false
      matrix:
        python-version: ["3.9", "3.12"]
        # Shard the suite across runners (pytest-split, balanced by
        # .test_durations) so wall-clock is ~tests/3. Keep `group` count in sync
        # with `--splits` below.
        group: [1, 2, 3]
 
    steps:
      - uses: actions/checkout@v4
 
      # Restores the shared client build from cache; only builds on a cache miss
      # (i.e. the first job after a client source change). Identical build is
      # reused across the matrix, other workflows, and subsequent runs.
      - uses: ./.github/actions/build-client
 
      - uses: ./.github/actions/setup-e2e
        with:
          python-version: ${{ matrix.python-version }}
 
      - name: Run E2E tests
        run: uv run pytest tests/e2e/ --splits 3 --group ${{ matrix.group }} -n auto
 
      - name: Upload test results on failure
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-test-results-py${{ matrix.python-version }}-group${{ matrix.group }}
          path: test-results/
          retention-days: 30
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow