mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 20:42:02 +00:00
chore(e2e): Setup E2E testing for the UI
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
name: UI - E2E Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- "v5.*"
|
||||
paths:
|
||||
- 'ui/**'
|
||||
|
||||
env:
|
||||
SERVICES_TO_START: "api-dev postgres valkey worker-beat worker-dev"
|
||||
DOCKER_COMPOSE_FILE: "docker-compose-dev.yml"
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
cache-dependency-path: './ui/package-lock.json'
|
||||
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
playwright-${{ runner.os }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: ./ui
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: ./ui
|
||||
|
||||
- name: Start Docker Compose backend
|
||||
run: docker-compose -f ${DOCKER_COMPOSE_FILE} up -d ${SERVICES_TO_START}
|
||||
|
||||
- name: Wait for API to be ready
|
||||
run: |
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:8000/; then
|
||||
echo "API is up!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for API..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: npx playwright test
|
||||
working-directory: ./ui
|
||||
|
||||
- name: Upload Playwright report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: ./ui/playwright-report
|
||||
|
||||
- name: Upload Playwright videos
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-videos
|
||||
path: ./ui/test-results/**/*.webm
|
||||
|
||||
- name: Docker Compose Down
|
||||
if: always()
|
||||
run: docker-compose -f ${DOCKER_COMPOSE_FILE} down
|
||||
Reference in New Issue
Block a user