Skip to content

add test suite

add test suite #2

Workflow file for this run

name: E2E Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
e2e:
name: E2E tests (Playwright)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and start the E2E stack
run: docker compose -f docker-compose.e2e.yml up -d --build
- name: Wait for the API to be ready
run: |
for i in $(seq 1 60); do
curl -sf http://localhost:8099/ && break
echo "Waiting for API… ($i/60)"
sleep 5
done
- name: Verify database tables exist
run: |
for i in $(seq 1 12); do
TABLES=$(docker compose -f docker-compose.e2e.yml exec -T mysql mysql -uroot -proot glpi_plugins_e2e -N -e "SHOW TABLES;" 2>/dev/null)
if echo "$TABLES" | grep -q apps; then
echo "Database tables verified"
break
fi
echo "Waiting for database tables… ($i/12)"
sleep 5
done
echo "$TABLES" | grep apps || { echo "ERROR: Database tables not found"; exit 1; }
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/e2e/package-lock.json
- name: Install dependencies
working-directory: frontend/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: frontend/e2e
run: npx playwright install --with-deps chromium
- name: Run E2E tests
working-directory: frontend/e2e
env:
E2E_BASE_URL: http://localhost:4200
run: npx playwright test
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/e2e/playwright-report/
retention-days: 7
- name: Tear down
if: always()
run: docker compose -f docker-compose.e2e.yml down -v