Skip to content

Bff

Bff #703

Workflow file for this run

# ===============================================================
# React Client E2E - Playwright (TypeScript) smoke suite
# ===============================================================
# - runs TypeScript Playwright tests for the React admin UI
# - Vite dev server is spawned by Playwright's webServer config
# - backend API is stubbed with page.route() (no gateway required)
# - triggered on PRs and pushes touching client/** or this workflow
# ---------------------------------------------------------------
name: Client E2E (Playwright)
on:
push:
branches: ["main", "epic/ui-rewrite"]
paths:
- "client/**"
- ".github/workflows/client-e2e.yml"
pull_request:
types: [opened, synchronize, ready_for_review]
branches: ["main", "epic/ui-rewrite"]
paths:
- "client/**"
- ".github/workflows/client-e2e.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
playwright:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
name: Playwright smoke + auth
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CI: "true"
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
JWT_SECRET_KEY: "ci-client-e2e-jwt-secret-not-for-production-use" # pragma: allowlist secret
AUTH_ENCRYPTION_SECRET: "ci-client-e2e-auth-enc-secret-not-for-production" # pragma: allowlist secret
steps:
- name: ⬇️ Checkout source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
fetch-depth: 1
# -----------------------------------------------------------
# Setup runtimes
# -----------------------------------------------------------
- name: 🐍 Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
with:
python-version: "3.12"
- name: 📦 Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: 🟩 Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
# -----------------------------------------------------------
# Python dependencies & OpenAPI export
# -----------------------------------------------------------
- name: 💾 Cache uv virtual environment
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: .venv
key: venv-${{ runner.os }}-python-3.12-${{ hashFiles('uv.lock') }}
restore-keys: |
venv-${{ runner.os }}-python-3.12-
venv-${{ runner.os }}-
- name: 📥 Install Python dependencies
run: |
cp .env.example .env
make venv
make install-dev
- name: 📄 Export OpenAPI spec
run: |
CACHE_TYPE=memory uv run python -c \
"import json; from mcpgateway.main import app; open('client/openapi.json', 'w').write(json.dumps(app.openapi(), indent=2))"
echo "OpenAPI spec exported ($(wc -c < client/openapi.json) bytes)"
# -----------------------------------------------------------
# Install client dependencies & generate types
# -----------------------------------------------------------
- name: 📥 Install client dependencies
working-directory: ./client
run: npm ci --no-audit --no-fund
- name: ⚙️ Generate types with orval
working-directory: ./client
run: npm run generate
- name: 🎭 Cache Playwright browsers
id: playwright-cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: ${{ runner.os }}-playwright-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: 🎭 Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./client
run: npx playwright install --with-deps chromium
- name: 🎭 Install Playwright system deps (cached browsers)
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: ./client
run: npx playwright install-deps chromium
- name: 🧪 Run Playwright tests
working-directory: ./client
run: npm run e2e
- name: 📦 Upload Playwright HTML report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-report
path: client/playwright-report
retention-days: 7
if-no-files-found: ignore
- name: 📦 Upload Playwright traces on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-traces
path: client/test-results
retention-days: 7
if-no-files-found: ignore