Files
holiday-property-booking/.gitea/workflows/playwright.yml
Chris Dumas e468876d59
Some checks failed
Deploy Holiday Property Booking / deploy (push) Successful in 1m43s
Playwright Holiday Property Booking / playwright (push) Failing after 1m42s
Test & Build Holiday Property Booking / test-build (push) Successful in 1m20s
ci: skip node setup when already present
2026-05-26 08:13:05 +00:00

95 lines
2.5 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: Check existing Node.js
id: node-check
shell: bash
run: |
set -Eeuo pipefail
if command -v node >/dev/null 2>&1; then
node_version="$(node -p 'process.versions.node')"
node_major="${node_version%%.*}"
if [ "$node_major" = "20" ]; then
echo "use_existing_node=true" >> "$GITHUB_OUTPUT"
echo "Node.js $node_version already available; skipping setup-node"
exit 0
fi
fi
echo "use_existing_node=false" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
if: steps.node-check.outputs.use_existing_node != 'true'
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