New Playwright-based smoke test that visits every installed surface and asserts: shell topbar renders, no JS console errors, home link exists. Captures full-page screenshot + console log on failure. Baseline screenshots captured for all surfaces (informational). Follows the existing surface-test-driver.js/run-surface-tests.sh pattern: shell script authenticates, Node driver navigates. New files: - ci/e2e-smoke-test.sh — auth + invoke driver - ci/e2e-smoke-driver.js — Playwright navigation assertions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
2.4 KiB
Bash
Executable File
64 lines
2.4 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 ─────────────────────────────
|
|
echo -e "${YELLOW}Authenticating...${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)}})")
|
|
|
|
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
|