#!/usr/bin/env bash # deploy.yml › e2e — Playwright suite against the TEST environment. Never release: the suite # creates vendors, items and POs on every run. # shellcheck source=common.sh source "$(dirname "${BASH_SOURCE[0]}")/common.sh" : "${E2E_ADMIN_EMAIL:?secrets.E2E_ADMIN_EMAIL is required}" "${E2E_ADMIN_PASSWORD:?secrets.E2E_ADMIN_PASSWORD is required}" load_env test base_url="${E2E_BASE_URL:-$PUBLIC_URL}" # The container's browsers must match the locked @playwright/test version exactly. pw_version="$(grep -A1 '"node_modules/@playwright/test"' "$E2E_PATH/package-lock.json" | sed -n 's/.*"version": "\([^"]*\)".*/\1/p')" [[ -n "$pw_version" ]] || fail "could not read the locked @playwright/test version" image="mcr.microsoft.com/playwright:v$pw_version-noble" z="$(selinux_mount_suffix)" with_build_lock # Chromium is the second-heaviest workload on the box — never overlap a build log "E2E against $base_url with $image (capped: 2 CPU / 1500 MB)" status=0 docker run --rm --cpus=2 --cpu-shares=512 --memory=1500m --ipc=host \ -e CI=true -e E2E_BASE_URL="$base_url" -e E2E_API_URL="$base_url" \ -e E2E_ADMIN_EMAIL -e E2E_ADMIN_PASSWORD \ -v "$PWD/$E2E_PATH:/e2e$z" -w /e2e "$image" \ bash -ec 'npm ci --no-audit --no-fund && npx playwright test' || status=$? if [[ -d "$E2E_PATH/playwright-report" ]]; then report_dir="$E2E_REPORTS_DIR/$(date -u +%Y%m%dT%H%M%SZ)-run${GITHUB_RUN_NUMBER:-manual}" mkdir -p "$report_dir" cp -r "$E2E_PATH/playwright-report" "$report_dir/" if [[ -d "$E2E_PATH/test-results" ]]; then cp -r "$E2E_PATH/test-results" "$report_dir/"; fi log "report saved on the server: $report_dir/playwright-report/index.html" fi exit "$status"