Pulse/tests/integration/scripts/setup.sh
rcourtman c728539f07 Restore completed Core E2E verdicts: shard CI, drop release tag from test image
Every main push since the v6 branch flip was cancelled at the 45-minute
job timeout with no verdict. The flip brought the full 94-spec suite onto
main (the last green run, 2026-06-29, ran only 2 specs on the v5 main),
and it runs sequentially against a release-tagged image whose mock-fixture
gate returns 403 without a demo entitlement. Dozens of specs fail, retry
twice each, and burn the budget: of the 31 minutes of suite time in run
28907574469, 18.8 minutes were failing attempts.

- Add GO_BUILD_TAGS build arg (default release) and build the pulse:test
  e2e image with it empty, matching the dev harness the suite is green
  under. Shipped images keep the release tag; release-gate behavior keeps
  its dedicated -tags release Go tests.
- Shard Playwright 4 ways across a CI matrix (214/202/205/203 tests per
  shard) with per-shard report artifacts and an aggregate verdict job.
- Cap CI at 20 failures so an env-broken run reports red in minutes
  instead of grinding into a no-verdict cancellation.
2026-07-08 08:00:55 +01:00

112 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
#
# Setup script for Pulse update integration tests
# Prepares the test environment and installs dependencies
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEST_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "==================================="
echo "Pulse Update Integration Test Setup"
echo "==================================="
echo ""
# Check prerequisites
echo "Checking prerequisites..."
# Check Docker
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
echo "✅ Docker is available"
# Check Docker Compose
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
echo "✅ Docker Compose is available"
# Check Node.js
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed. Please install Node.js 18+ first."
exit 1
fi
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
echo "❌ Node.js version 18 or higher is required (found: $(node -v))"
exit 1
fi
echo "✅ Node.js $(node -v) is available"
# Check Go
if ! command -v go &> /dev/null; then
echo "⚠️ Go is not installed. Mock server build may fail."
else
echo "✅ Go $(go version | awk '{print $3}') is available"
fi
echo ""
echo "Installing npm dependencies..."
cd "$TEST_ROOT"
if [ -f "package-lock.json" ]; then
npm ci
else
npm install
fi
echo ""
echo "Installing Playwright browsers..."
npx playwright install chromium
npx playwright install-deps chromium
echo ""
echo "Building mock GitHub server..."
cd "$TEST_ROOT/mock-github-server"
if [ -f "go.mod" ]; then
go mod download
echo "✅ Go dependencies downloaded"
fi
echo ""
echo "Building Docker images..."
cd "$TEST_ROOT"
# Build mock GitHub server image
docker build -t pulse-mock-github:test ./mock-github-server
echo "✅ Mock GitHub server image built"
# Build Pulse test image (from root of repo)
cd "$TEST_ROOT/../.."
if [ -f "Dockerfile" ]; then
# Test image drops the release build tag so the suite can enable mock
# fixtures without a demo entitlement.
docker build -t pulse:test --build-arg GO_BUILD_TAGS="" -f Dockerfile .
echo "✅ Pulse test image built"
else
echo "⚠️ Pulse Dockerfile not found. Using published image instead."
fi
echo ""
echo "==================================="
echo "✅ Setup complete!"
echo "==================================="
echo ""
echo "Next steps:"
echo " 1. Run all tests: npm test"
echo " 2. Run specific test: npx playwright test tests/01-happy-path.spec.ts"
echo " 3. View UI: npm run test:ui"
echo " 4. Debug mode: npm run test:debug"
echo ""
echo "Docker commands:"
echo " Start services: npm run docker:up"
echo " Stop services: npm run docker:down"
echo " View logs: npm run docker:logs"
echo ""