2025-01-16 16:46:30 +01:00
|
|
|
name: Playwright Tests
|
2025-01-16 17:22:43 +01:00
|
|
|
|
2025-01-16 16:46:30 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main, master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main, master ]
|
2025-01-16 17:22:43 +01:00
|
|
|
|
2025-01-16 16:46:30 +01:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
2025-01-17 07:59:08 +01:00
|
|
|
services:
|
|
|
|
postgres-employee:
|
|
|
|
container_name: postgres_employee
|
|
|
|
image: postgres:13.3
|
2025-01-17 08:18:52 +01:00
|
|
|
env:
|
2025-01-17 07:59:08 +01:00
|
|
|
POSTGRES_DB: employee_db
|
|
|
|
POSTGRES_USER: employee
|
|
|
|
POSTGRES_PASSWORD: secret
|
|
|
|
|
|
|
|
employee:
|
|
|
|
container_name: employee
|
|
|
|
image: berndheidemann/employee-management-service:1.1.3
|
2025-01-17 10:05:42 +01:00
|
|
|
# image: berndheidemann/employee-management-service_without_keycloak:1.1
|
2025-01-17 08:18:52 +01:00
|
|
|
env:
|
2025-01-17 10:05:42 +01:00
|
|
|
spring.datasource.url: jdbc:postgresql://postgres-employee:5432/employee_db
|
|
|
|
spring.datasource.username: employee
|
|
|
|
spring.datasource.password: secret
|
2025-01-17 07:59:08 +01:00
|
|
|
depends_on:
|
2025-01-17 10:05:42 +01:00
|
|
|
- postgres-employee
|
2025-01-16 17:22:43 +01:00
|
|
|
|
2025-01-16 16:46:30 +01:00
|
|
|
steps:
|
2025-01-16 17:22:43 +01:00
|
|
|
# Checkout the repository
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2025-01-17 10:07:24 +01:00
|
|
|
- name: Debug
|
2025-01-17 10:13:53 +01:00
|
|
|
run: |
|
|
|
|
docker ps
|
2025-01-17 10:15:36 +01:00
|
|
|
apt update
|
2025-01-17 10:16:15 +01:00
|
|
|
apt install telnet -y
|
2025-01-17 10:13:53 +01:00
|
|
|
telnet localhost 8089
|
2025-01-17 10:07:24 +01:00
|
|
|
|
2025-01-16 17:22:43 +01:00
|
|
|
# Set up Node.js
|
|
|
|
- uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: lts/*
|
|
|
|
|
|
|
|
# Install project dependencies
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
# Build the Angular project
|
|
|
|
- name: Build Angular Project
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
# Start Angular development server
|
2025-01-16 17:24:43 +01:00
|
|
|
- name: Start Angular Development Server in Background
|
|
|
|
run: nohup npm start > angular.log 2>&1 &
|
2025-01-16 17:22:43 +01:00
|
|
|
env:
|
2025-01-16 17:24:43 +01:00
|
|
|
PORT: 4200 # Ensure the server runs on a predictable port
|
2025-01-16 17:22:43 +01:00
|
|
|
|
|
|
|
# Install Playwright and dependencies
|
|
|
|
- name: Install Playwright Browsers
|
|
|
|
run: npx playwright install --with-deps
|
|
|
|
|
|
|
|
# Run Playwright tests
|
|
|
|
- name: Run Playwright Tests
|
|
|
|
run: npx playwright test
|
|
|
|
env:
|
|
|
|
CI: true # Ensures Playwright runs in CI mode
|
|
|
|
|
|
|
|
# Upload Playwright report
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
with:
|
|
|
|
name: playwright-report
|
|
|
|
path: playwright-report/
|
|
|
|
retention-days: 30
|