Files
Compass/scripts/e2e-dev.sh
Okechi Jones-Williams b18a6d7ff3 [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>
2026-03-01 01:25:56 +01:00

63 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"/..
export NEXT_PUBLIC_ISOLATED_ENV=true
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
print_status() { echo -e "${GREEN}[E2E-DEV]${NC} $1"; }
print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Check services are running (fail fast with helpful message)
check_services() {
local missing=0
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
fi
if ! curl -s http://localhost:8088/health > /dev/null 2>&1; then
print_error "Backend API is not running. Run: yarn --cwd=backend/api dev"
missing=1
fi
if ! curl -s http://localhost:3000 > /dev/null 2>&1; then
print_error "Next.js is not running. Run: yarn --cwd=web dev"
missing=1
fi
if [ $missing -eq 1 ]; then
echo ""
echo "Start everything with: yarn test:e2e:services"
echo "Or start full clean run: yarn test:e2e"
exit 1
fi
}
print_status "Checking services..."
check_services
print_status "All services running ✅"
# Run tests - pass all args through to playwright
# Examples:
# yarn test:e2e:dev → all e2e tests
# yarn test:e2e:dev tests/e2e/auth.spec.ts → specific file
# yarn test:e2e:dev --grep "login" → tests matching pattern
# yarn test:e2e:dev --ui → open Playwright UI
if [ $# -eq 0 ]; then
# No arguments: run all tests in tests/e2e
print_status "Running: npx playwright test tests/e2e"
npx playwright test tests/e2e
else
# Arguments provided: pass them directly to playwright
print_status "Running: npx playwright test $@"
npx playwright test "$@"
fi