Skip to content

feat(js-release): add optional E2E test job after build on tag push #527

Description

@bedatty

Summary

Add a new e2e_tests job to js-release.yml that runs after the build job on tag pushes, behind an opt-in enable_e2e flag. This enables frontend repos to run Playwright E2E tests as part of the release pipeline via a standard npm run test:e2e command.

This will become the standard pattern across all JS/TS frontends.


New inputs

All are optional with backward-compatible defaults (no impact on existing callers).

Input Type Default Description
enable_e2e boolean false Enable the E2E job
e2e_script string test:e2e npm script to run (e.g. test:e2e, test:e2e:mock)
e2e_base_url string '' If set, injected as BASE_URL env var (for real-environment mode)
node_version string 22 Node.js version for the E2E runner

New job — e2e_tests

Add after the build job in .github/workflows/js-release.yml:

e2e_tests:
  name: E2E Tests
  needs: [build]
  if: >-
    github.ref_type == 'tag' && inputs.enable_e2e &&
    !cancelled() && needs.build.result == 'success'
  runs-on: ${{ inputs.runner_type }}
  permissions:
    contents: read
  steps:
    - uses: actions/checkout@v4

    - uses: actions/setup-node@v4
      with:
        node-version: ${{ inputs.node_version }}
        cache: 'npm'

    - name: Install dependencies
      run: npm ci

    - name: Install Playwright browsers
      run: npx playwright install --with-deps chromium

    - name: Run E2E tests
      run: npm run ${{ inputs.e2e_script }}
      env:
        BASE_URL: ${{ inputs.e2e_base_url }}

    - name: Upload Playwright report
      if: always()
      uses: actions/upload-artifact@v4
      with:
        name: playwright-report
        path: playwright-report/
        retention-days: 7

Usage examples

Mock mode (self-contained — no real backend required)

uses: LerianStudio/github-actions-shared-workflows/.github/workflows/js-release.yml@vX.Y.Z
with:
  enable_e2e: true
  e2e_script: test:e2e:mock

Real environment mode (against a deployed staging URL)

uses: LerianStudio/github-actions-shared-workflows/.github/workflows/js-release.yml@vX.Y.Z
with:
  enable_e2e: true
  e2e_script: test:e2e
  e2e_base_url: ${{ vars.STAGING_URL }}

Context

  • First consumer: LerianStudio/product-console (uses Playwright with Chromium only)
  • playwright.config.ts will be updated on the consumer side to read process.env.BASE_URL || 'http://localhost:8081' to support real-environment mode
  • Only Chromium browsers need to be installed (--with-deps chromium) as that is the only project defined in the consumer's playwright config

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions