This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/ci/e2e-smoke-test.sh
Jeffrey Smith e4f0bdbd36
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m48s
CI/CD / test-sqlite (push) Successful in 2m49s
CI/CD / build-and-deploy (push) Successful in 28s
Feat v0.7.7 api tokens ext permissions (#61)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
2026-04-02 19:11:47 +00:00

75 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# ═══════════════════════════════════════════════
# E2E Smoke Test — CI Entrypoint
# ═══════════════════════════════════════════════
#
# Authenticates as admin, then runs a Playwright navigation smoke
# test against every installed surface. Asserts shell topbar
# renders, no JS console errors, and the home link works.
#
# Prerequisites:
# - Server running at $SERVER_URL (default: http://localhost:3000)
# - npx playwright install chromium
# - ADMIN_USER / ADMIN_PASS env vars (default: admin/admin)
#
# Exit codes: 0 = all surfaces passed, 1 = failures detected
set -euo pipefail
SERVER_URL="${SERVER_URL:-http://localhost:3000}"
ADMIN_USER="${ADMIN_USER:-admin}"
ADMIN_PASS="${ADMIN_PASS:-admin}"
SCREENSHOT_DIR="${SCREENSHOT_DIR:-/tmp/e2e-screenshots}"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${YELLOW}═══ E2E Smoke Test ═══${NC}"
echo " Server: ${SERVER_URL}"
# ── Ensure screenshot dir ────────────────────
mkdir -p "${SCREENSHOT_DIR}"
# ── Authenticate ─────────────────────────────
# Try PAT first (from bootstrap), fall back to login
PAT_FILE="/tmp/armature-admin-pat.txt"
TOKEN=""
if [ -f "$PAT_FILE" ]; then
TOKEN=$(cat "$PAT_FILE")
echo -e "${GREEN}Authenticated via bootstrap PAT${NC}"
fi
if [ -z "$TOKEN" ]; then
echo -e "${YELLOW}Authenticating via login...${NC}"
TOKEN=$(curl -sf -X POST "${SERVER_URL}/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d "{\"login\":\"${ADMIN_USER}\",\"password\":\"${ADMIN_PASS}\"}" \
| node -e "process.stdin.resume(); let d=''; process.stdin.on('data',c=>d+=c); process.stdin.on('end',()=>{try{console.log(JSON.parse(d).token)}catch(e){process.exit(1)}})")
fi
if [ -z "$TOKEN" ]; then
echo -e "${RED}Failed to authenticate${NC}"
exit 1
fi
echo -e "${GREEN}Authenticated${NC}"
# ── Run via Playwright ───────────────────────
echo -e "${YELLOW}Running E2E smoke tests via Playwright...${NC}"
node "$(dirname "$0")/e2e-smoke-driver.js" \
--server="${SERVER_URL}" \
--token="${TOKEN}" \
--screenshots="${SCREENSHOT_DIR}"
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}═══ All E2E smoke tests passed ═══${NC}"
else
echo -e "${RED}═══ E2E smoke tests FAILED ═══${NC}"
echo -e "${YELLOW}Screenshots saved to: ${SCREENSHOT_DIR}${NC}"
fi
exit $EXIT_CODE