Files
serverAppConfigs/tests/e2e/run.sh
T
Frank 1c725ea024 e2e: run.sh keeps playwright arg passthrough with the default project set
The default-project-set rewrite dropped non---project args (e.g. --list),
so 'run.sh --list' silently RAN the whole suite instead of listing.
Args now ride alongside the default set; an explicit --project still
takes over. Verified: default --list = 33 tests listed; opt-in --list =
34 with the frankbook walk.
2026-10-05 18:18:21 -07:00

54 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Playwright e2e for the homepage and the Anubis -> Authentik guard chain.
# Drives the LIVE fleet, so it needs real credentials and is deliberately NOT
# part of ./tests/run.sh. Credentials live in tests/e2e/.env.local
# (git-ignored; see .env.local.example). Usage:
#
# tests/e2e/run.sh # full suite (frankbook project excluded)
# tests/e2e/run.sh --project guest # any playwright args pass through
#
# The frankbook project (19-frankbook.spec.ts — the *arr/qBittorrent walk)
# is NOT in the default project set: its links terminate on FrankBook-Pro,
# which sleeps when idle, so it must not gate unrelated deploys. deploy.sh
# sets E2E_INCLUDE_FRANKBOOK=1 when a frankbook trigger path changed. An
# explicit --project argument in "$@" bypasses the default set entirely.
set -euo pipefail
cd "$(dirname "$0")"
if [ ! -f .env.local ]; then
echo "tests/e2e/.env.local missing — copy .env.local.example and fill in the IdP credentials" >&2
exit 1
fi
if [ ! -d node_modules ]; then
if [ -f package-lock.json ]; then
npm ci --no-audit --no-fund
else
npm install --no-audit --no-fund
fi
fi
npx playwright install chromium
# Default project set; the frankbook project joins only when deploy.sh saw a
# frankbook trigger path (E2E_INCLUDE_FRANKBOOK=1). Other playwright args
# (--list, --grep, file filters) pass through alongside the default set; an
# explicit --project in "$@" takes over untouched.
DEFAULT_PROJECTS=(setup standard admin guest)
if [[ "${E2E_INCLUDE_FRANKBOOK:-0}" == "1" ]]; then
DEFAULT_PROJECTS+=(frankbook)
fi
has_project=0
for arg in "$@"; do
case "$arg" in
--project|--project=*) has_project=1 ;;
esac
done
PROJECT_ARGS=()
if [[ "$has_project" -eq 0 ]]; then
for project in "${DEFAULT_PROJECTS[@]}"; do
PROJECT_ARGS+=(--project "$project")
done
fi
exec npx playwright test "$@" "${PROJECT_ARGS[@]}"