feat(ci): integrate Playwright E2E tests into Docker build workflow
This commit is contained in:
53
.github/workflows/playwright.yml
vendored
53
.github/workflows/playwright.yml
vendored
@@ -1,53 +0,0 @@
|
||||
name: Playwright Tests
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
jobs:
|
||||
test:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
- name: Build Frontend
|
||||
working-directory: frontend
|
||||
run: |
|
||||
echo "Installing frontend dependencies..."
|
||||
npm ci
|
||||
echo "Building frontend..."
|
||||
npm run build
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
echo "Building charon:local Docker image..."
|
||||
docker build -t charon:local .
|
||||
- name: Start Application Stack
|
||||
run: docker compose -f .docker/compose/docker-compose.local.yml up -d
|
||||
- name: Wait for Application Health
|
||||
run: |
|
||||
echo "Waiting for application to be ready..."
|
||||
timeout 120 bash -c 'until curl -sf http://localhost:8080/api/v1/health > /dev/null; do
|
||||
echo "Waiting for health endpoint..."
|
||||
sleep 2
|
||||
done'
|
||||
echo "✅ Application is ready"
|
||||
- name: Run Playwright tests
|
||||
env:
|
||||
PLAYWRIGHT_BASE_URL: http://localhost:8080
|
||||
run: npx playwright test
|
||||
- name: Stop Application Stack
|
||||
if: always()
|
||||
run: docker compose -f .docker/compose/docker-compose.local.yml down -v
|
||||
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
||||
if: ${{ !cancelled() }}
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
Reference in New Issue
Block a user