mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-24 17:41:27 -04:00
[Onboarding Flow] Added database checks to the onboarding flow (#34)
* Fixed Type errors * Organizing testing utilities * Added Database checks to the onboarding flow * Updated Onboarding flow Changed type ChildrenExpectation so that it can be used for database verification * Added compatibility page setup Added more compatibility questions * Fix * . * Fix: Typo * Fix: Faker usernames can no longer generate symbols * Fix: Changed how work area is verified * . * . * Fix: Trying to work in headed mode * Fix: Change back to headless * Fix: Added timeout after workArea selection * . * Clean e2e * Improve E2E setup * Prettier * Log * Fix: should pull test account from unique identifier like email, username or id; not the display name * Source env vars in playwright directly * Clean e2e data * Clean test account id to be the same for email and username * Fix import warning * Add error handling * Add log * Temp remove env load * Update * Add logs and safeguards against using remote supabase during e2e tests * Fix playwright report path in C@ * Remove locale log * Check if userInformationFromDb loading with name instead of username was the issue * Remove login log * Check if initial work area names were the issue * Ignore if no files found * Cache Firebase emulators in CI * Reload env vars in playwright * It did not break tests... * Clean verifyWorkArea * Add caching for node modules in CI * Add caching for node modules in CI (2) * Do not raise if emulator not running during db seed * Do not raise if using firebase emulator * Fix supabase cache in CI * Add Cache Playwright browsers in CI * Fix * Test cache * Turn off unused supabase services to speed things up * Back to good one * Set CI=true * api is required for client connection * Add safeguards for missing supabase env vars * Remove echo * Remove supabase cache --------- Co-authored-by: Martin Braquet <martin.braquet@gmail.com>
This commit is contained in:
committed by
GitHub
parent
c69a438d08
commit
b18a6d7ff3
@@ -72,7 +72,7 @@ while IFS= read -r file; do
|
||||
cat "$file"
|
||||
} > "$OUTPUT"
|
||||
|
||||
echo "✅ $file -> $OUTPUT"
|
||||
# echo "✅ $file -> $OUTPUT"
|
||||
|
||||
COUNTER=$((COUNTER + 100))
|
||||
done <<< "$FILES"
|
||||
|
||||
@@ -4,6 +4,8 @@ set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
export NEXT_PUBLIC_ISOLATED_ENV=true
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
@@ -11,22 +13,10 @@ NC='\033[0m'
|
||||
print_status() { echo -e "${GREEN}[E2E-DEV]${NC} $1"; }
|
||||
print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
get_supabase_status() {
|
||||
SUPABASE_STATUS=$(supabase status --output json 2>/dev/null)
|
||||
}
|
||||
|
||||
get_supabase_status
|
||||
|
||||
# Check services are running (fail fast with helpful message)
|
||||
check_services() {
|
||||
local missing=0
|
||||
|
||||
if [ -z "$(echo "$SUPABASE_STATUS" | jq -r '.API_URL')" ]; then
|
||||
print_error "Supabase is not running. Starting..."
|
||||
yarn test:db:reset
|
||||
get_supabase_status
|
||||
fi
|
||||
|
||||
if ! curl -s http://127.0.0.1:9099 > /dev/null 2>&1; then
|
||||
print_error "Firebase emulator is not running. Run: yarn emulate"
|
||||
missing=1
|
||||
@@ -54,11 +44,6 @@ print_status "Checking services..."
|
||||
check_services
|
||||
print_status "All services running ✅"
|
||||
|
||||
export $(cat .env.test | grep -v '^#' | xargs)
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(echo "$SUPABASE_STATUS" | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(echo "$SUPABASE_STATUS" | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(echo "$SUPABASE_STATUS" | jq -r '.DB_URL')
|
||||
|
||||
# Run tests - pass all args through to playwright
|
||||
# Examples:
|
||||
# yarn test:e2e:dev → all e2e tests
|
||||
|
||||
@@ -5,6 +5,9 @@ set -euo pipefail
|
||||
# Change to project root
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
export NEXT_PUBLIC_ISOLATED_ENV=true
|
||||
export CI=true
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
@@ -60,18 +63,7 @@ supabase stop --no-backup 2>/dev/null || true
|
||||
sleep 2 # Give ports time to free up
|
||||
|
||||
# Build backend (required?)
|
||||
./scripts/build_api.sh
|
||||
|
||||
# Get connection details
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(supabase status --output json | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(supabase status --output json | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(supabase status --output json | jq -r '.DB_URL')
|
||||
|
||||
echo $NEXT_PUBLIC_SUPABASE_URL
|
||||
echo $NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
echo $DATABASE_URL
|
||||
|
||||
print_status "Supabase started at: $DATABASE_URL"
|
||||
#./scripts/build_api.sh
|
||||
|
||||
# Install Playwright browsers
|
||||
print_status "Installing Playwright browsers..."
|
||||
@@ -90,6 +82,26 @@ npx wait-on \
|
||||
# Start Supabase (includes Postgres, Auth, Storage, etc.) and Apply migrations and seed (needs firebase emulator running)
|
||||
yarn test:db:reset
|
||||
|
||||
# Get connection details
|
||||
STATUS_JSON=$(supabase status --output json)
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(echo "$STATUS_JSON" | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(echo "$STATUS_JSON" | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(echo "$STATUS_JSON" | jq -r '.DB_URL')
|
||||
|
||||
print_status "Supabase started at: $DATABASE_URL"
|
||||
|
||||
echo "Supabase env vars:"
|
||||
echo $NEXT_PUBLIC_SUPABASE_URL
|
||||
echo $NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
echo $DATABASE_URL
|
||||
|
||||
for var in NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY DATABASE_URL; do
|
||||
if [ -z "${!var}" ] || [ "${!var}" = "null" ]; then
|
||||
echo "Error: $var is not set or null" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Start backend API
|
||||
print_status "Starting backend API..."
|
||||
yarn --cwd=backend/api dev & PIDS+=($!)
|
||||
|
||||
@@ -8,6 +8,8 @@ set -euo pipefail
|
||||
# Change to project root
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
export NEXT_PUBLIC_ISOLATED_ENV=true
|
||||
|
||||
export $(cat .env.test | grep -v '^#' | xargs)
|
||||
|
||||
# Ensure Supabase local stack is running; if not, reset/start it
|
||||
@@ -24,6 +26,13 @@ export NEXT_PUBLIC_SUPABASE_URL=$(echo "$STATUS_JSON" | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(echo "$STATUS_JSON" | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(echo "$STATUS_JSON" | jq -r '.DB_URL')
|
||||
|
||||
for var in NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY DATABASE_URL; do
|
||||
if [ -z "${!var}" ] || [ "${!var}" = "null" ]; then
|
||||
echo "Error: $var is not set or null" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Build backend (required?)
|
||||
./scripts/build_api.sh
|
||||
|
||||
|
||||
@@ -8,12 +8,10 @@ cd "$(dirname "$0")"/..
|
||||
export $(cat .env.test | grep -v '^#' | xargs)
|
||||
|
||||
# Get connection details
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(supabase status --output json | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(supabase status --output json | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(supabase status --output json | jq -r '.DB_URL')
|
||||
|
||||
# Build backend (required?)
|
||||
#./scripts/build_api.sh
|
||||
STATUS_JSON=$(supabase status --output json)
|
||||
export NEXT_PUBLIC_SUPABASE_URL=$(echo "$STATUS_JSON" | jq -r '.API_URL')
|
||||
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(echo "$STATUS_JSON" | jq -r '.ANON_KEY')
|
||||
export DATABASE_URL=$(echo "$STATUS_JSON" | jq -r '.DB_URL')
|
||||
|
||||
cd tests/e2e/utils
|
||||
|
||||
|
||||
11
scripts/supabase_start.sh
Executable file
11
scripts/supabase_start.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if [ "${CI:-false}" = "true" ]; then
|
||||
npx supabase start --exclude studio
|
||||
else
|
||||
npx supabase start
|
||||
fi
|
||||
13
scripts/test_db_reset.sh
Executable file
13
scripts/test_db_reset.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
./scripts/supabase_start.sh
|
||||
|
||||
./scripts/combine-migrations.sh
|
||||
|
||||
npx supabase db reset
|
||||
|
||||
yarn test:db:seed
|
||||
Reference in New Issue
Block a user