#!/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[@]}"