Files
holiday-property-booking/.gitea/workflows/playwright.yml
Chris Dumas 909e8062f4
Some checks failed
Deploy Holiday Property Booking / deploy (push) Successful in 3m0s
Playwright Holiday Property Booking / playwright (push) Successful in 10m59s
Test & Build Holiday Property Booking / test-build (push) Has been cancelled
feat: add playwright e2e workflow
2026-05-22 08:40:45 +00:00

76 lines
1.9 KiB
YAML

name: Playwright Holiday Property Booking
on:
pull_request:
branches:
- develop
- qa
push:
branches:
- develop
- qa
jobs:
playwright:
runs-on: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
github-server-url: https://git.dumas.ddns.net
- name: Resolve environment
shell: bash
env:
GITEA_REF: ${{ gitea.ref }}
run: |
set -Eeuo pipefail
case "$GITEA_REF" in
refs/heads/develop)
echo "PLAYWRIGHT_BASE_URL=http://192.168.1.15:7003" >> "$GITHUB_ENV"
echo "PLAYWRIGHT_ENV_NAME=dev" >> "$GITHUB_ENV"
;;
refs/heads/qa)
echo "PLAYWRIGHT_BASE_URL=http://192.168.1.15:6003" >> "$GITHUB_ENV"
echo "PLAYWRIGHT_ENV_NAME=qa" >> "$GITHUB_ENV"
;;
*)
echo "Skipping unmapped ref: $GITEA_REF"
exit 0
;;
esac
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Wait for deployed app
shell: bash
run: |
set -Eeuo pipefail
for attempt in 1 2 3 4 5 6 7 8 9 10; do
if curl --fail --silent --show-error --location --max-time 15 "${PLAYWRIGHT_BASE_URL}/api/health" >/dev/null; then
echo "Application is ready on attempt $attempt"
exit 0
fi
echo "Application not ready on attempt $attempt; retrying..."
sleep 6
done
echo "Application never became ready"
exit 1
- name: Run Playwright suite
run: npm run test:e2e