ci: update Playwright workflow for Angular project setup
Some checks failed
Playwright Tests / test (pull_request) Has been cancelled

This commit is contained in:
Jan Gleytenhoover 2025-01-16 17:22:43 +01:00
parent 6c1ec524ec
commit 0cecd1cd2b
Signed by: jank
GPG key ID: 50620ADD22CD330B

View file

@ -1,27 +1,54 @@
name: Playwright Tests name: Playwright Tests
on: on:
push: push:
branches: [ main, master ] branches: [ main, master ]
pull_request: pull_request:
branches: [ main, master ] branches: [ main, master ]
jobs: jobs:
test: test:
timeout-minutes: 60 timeout-minutes: 60
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 # Checkout the repository
- uses: actions/setup-node@v4 - uses: actions/checkout@v4
with:
node-version: lts/* # Set up Node.js
- name: Install dependencies - uses: actions/setup-node@v4
run: npm ci with:
- name: Install Playwright Browsers node-version: lts/*
run: npx playwright install --with-deps
- name: Run Playwright tests # Install project dependencies
run: npx playwright test - name: Install dependencies
- uses: actions/upload-artifact@v3 run: npm ci
if: ${{ !cancelled() }}
with: # Build the Angular project
name: playwright-report - name: Build Angular Project
path: playwright-report/ run: npm run build
retention-days: 30
# Start Angular development server
- name: Start Angular Development Server
run: npm start
env:
PORT: 4200 # Ensures the server runs on a predictable port
continue-on-error: true
# 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