8e472ac996
CI/CD - ERP Core / scripts (pull_request) Failing after 12m21s
CI/CD - ERP Core / e2e-typecheck (pull_request) Failing after 13m13s
CI/CD - ERP Core / frontend (pull_request) Failing after 14m5s
CI/CD - ERP Core / backend (pull_request) Failing after 14m57s
CI/CD - ERP Core / detect (pull_request) Failing after 13m42s
CI/CD - ERP Core / Build & Deploy (pull_request) Failing after 12m47s
CI/CD - ERP Core / ci-ok (pull_request) Failing after 14m58s
36 lines
1.7 KiB
Bash
36 lines
1.7 KiB
Bash
#!/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"
|