mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-14 05:06:33 +00:00
8a0ddd46d5
Add a self-contained Playwright E2E test suite that runs against a local PostgreSQL database instead of Neon. Tests cover role-based access for all 5 user roles (proxy admin, admin viewer, internal user, internal viewer, team admin) and authentication flows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
100 lines
2.7 KiB
YAML
100 lines
2.7 KiB
YAML
name: UI E2E Playwright Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
ui_e2e_tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: llmproxy
|
|
POSTGRES_PASSWORD: dbpassword9090
|
|
POSTGRES_DB: litellm
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: "22"
|
|
|
|
- name: Install Poetry
|
|
run: pip install 'poetry==2.3.2'
|
|
|
|
- name: Cache Poetry dependencies
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0
|
|
with:
|
|
path: |
|
|
~/.cache/pypoetry
|
|
~/.cache/pip
|
|
.venv
|
|
key: ${{ runner.os }}-poetry-ui-e2e-${{ hashFiles('poetry.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-poetry-ui-e2e-
|
|
${{ runner.os }}-poetry-
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
poetry config virtualenvs.in-project true
|
|
poetry install --with dev,proxy-dev --extras "proxy" --quiet
|
|
|
|
- name: Generate Prisma client
|
|
env:
|
|
PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache
|
|
run: |
|
|
poetry run pip install nodejs-wheel-binaries==24.13.1
|
|
poetry run prisma generate --schema litellm/proxy/schema.prisma
|
|
|
|
- name: Install Playwright
|
|
run: |
|
|
cd tests/ui_e2e_tests
|
|
npm install --silent
|
|
npx playwright install --with-deps chromium
|
|
|
|
- name: Run UI E2E tests
|
|
env:
|
|
CI: "true"
|
|
DATABASE_URL: postgresql://llmproxy:dbpassword9090@localhost:5432/litellm
|
|
run: |
|
|
cd tests/ui_e2e_tests
|
|
./run_e2e.sh
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: playwright-results
|
|
path: |
|
|
tests/ui_e2e_tests/test-results/
|
|
tests/ui_e2e_tests/playwright-report/
|
|
retention-days: 7
|