Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2933b7c
Fixed Type errors
O-Bots Feb 21, 2026
0cbe734
Organizing testing utilities
O-Bots Feb 22, 2026
a2a23b7
Added Database checks to the onboarding flow
O-Bots Feb 22, 2026
4d46b72
Updated Onboarding flow
O-Bots Feb 23, 2026
78bfe6a
Added compatibility page setup
O-Bots Feb 25, 2026
11716b2
Merge remote-tracking branch 'upstream/main'
O-Bots Feb 25, 2026
33c2141
Fix
O-Bots Feb 27, 2026
64634d5
Merge branch 'main' of https://github.com/CompassConnections/Compass
O-Bots Feb 27, 2026
383ef1b
.
O-Bots Feb 27, 2026
dc1e882
Merge branch 'main' of https://github.com/CompassConnections/Compass
O-Bots Feb 27, 2026
b85234d
Fix: Typo
O-Bots Feb 27, 2026
e5b3600
Fix: Faker usernames can no longer generate symbols
O-Bots Feb 27, 2026
e06af45
Fix: Changed how work area is verified
O-Bots Feb 27, 2026
3cec27c
.
O-Bots Feb 27, 2026
a2f1d21
.
O-Bots Feb 27, 2026
42b15ba
Fix: Trying to work in headed mode
O-Bots Feb 27, 2026
199d392
Fix: Change back to headless
O-Bots Feb 27, 2026
6219f28
Fix: Added timeout after workArea selection
O-Bots Feb 27, 2026
c516af5
.
O-Bots Feb 27, 2026
c29a92a
Merge branch 'main' into main
MartinBraquet Feb 28, 2026
2790fd0
Clean e2e
MartinBraquet Feb 28, 2026
8cf1933
Improve E2E setup
MartinBraquet Feb 28, 2026
2f7d8c9
Prettier
MartinBraquet Feb 28, 2026
f0808e4
Log
MartinBraquet Feb 28, 2026
6ba25b5
Fix: should pull test account from unique identifier like email, user…
MartinBraquet Feb 28, 2026
e3c4666
Source env vars in playwright directly
MartinBraquet Feb 28, 2026
757b899
Clean e2e data
MartinBraquet Feb 28, 2026
b9b2174
Clean test account id to be the same for email and username
MartinBraquet Feb 28, 2026
35fbd23
Fix import warning
MartinBraquet Feb 28, 2026
79e480f
Add error handling
MartinBraquet Feb 28, 2026
b90fc76
Add log
MartinBraquet Feb 28, 2026
6a01d30
Temp remove env load
MartinBraquet Feb 28, 2026
f6dca71
Update
MartinBraquet Feb 28, 2026
dd3e1ee
Add logs and safeguards against using remote supabase during e2e tests
MartinBraquet Feb 28, 2026
8b2fa10
Fix playwright report path in C@
MartinBraquet Feb 28, 2026
16a693b
Remove locale log
MartinBraquet Feb 28, 2026
269adb3
Check if userInformationFromDb loading with name instead of username …
MartinBraquet Feb 28, 2026
60cdeab
Remove login log
MartinBraquet Feb 28, 2026
d69ce9b
Check if initial work area names were the issue
MartinBraquet Feb 28, 2026
0da8f5b
Ignore if no files found
MartinBraquet Feb 28, 2026
b2077a3
Cache Firebase emulators in CI
MartinBraquet Feb 28, 2026
28302aa
Reload env vars in playwright
MartinBraquet Feb 28, 2026
d6b3fbe
It did not break tests...
MartinBraquet Feb 28, 2026
744133c
Clean verifyWorkArea
MartinBraquet Feb 28, 2026
b77a362
Add caching for node modules in CI
MartinBraquet Feb 28, 2026
e19a4fa
Add caching for node modules in CI (2)
MartinBraquet Feb 28, 2026
2266e53
Do not raise if emulator not running during db seed
MartinBraquet Feb 28, 2026
728245a
Do not raise if using firebase emulator
MartinBraquet Feb 28, 2026
e441572
Fix supabase cache in CI
MartinBraquet Feb 28, 2026
cb41197
Add Cache Playwright browsers in CI
MartinBraquet Feb 28, 2026
166bbe2
Fix
MartinBraquet Feb 28, 2026
a3f93ce
Test cache
MartinBraquet Feb 28, 2026
3a19a6b
Turn off unused supabase services to speed things up
MartinBraquet Feb 28, 2026
3a4ad94
Back to good one
MartinBraquet Feb 28, 2026
ad0c677
Set CI=true
MartinBraquet Feb 28, 2026
86b8ef4
api is required for client connection
MartinBraquet Mar 1, 2026
038b994
Add safeguards for missing supabase env vars
MartinBraquet Mar 1, 2026
07c91c7
Remove echo
MartinBraquet Mar 1, 2026
dbc594d
Remove supabase cache
MartinBraquet Mar 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd-android-live-update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CD Android Live Update
on:
push:
branches: [ main, master ]
branches: [main, master]
paths:
- 'android/capawesome.json'
- '.github/workflows/cd-android-live-update.yml'
Expand Down Expand Up @@ -73,4 +73,4 @@ jobs:
CAPAWESOME_TOKEN: ${{ secrets.CAPAWESOME_TOKEN }}
commitRef: ${{ github.head_ref || github.ref_name }}
commitSha: ${{ github.sha }}
run: yarn android-live-update
run: yarn android-live-update
2 changes: 1 addition & 1 deletion .github/workflows/cd-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ jobs:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.compassconnections.app
releaseFiles: android/app/build/outputs/bundle/release/app-release.aab
track: internal
track: internal
4 changes: 2 additions & 2 deletions .github/workflows/cd-api.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: API Release
on:
push:
branches: [ main, master ]
branches: [main, master]
paths:
- 'backend/api/package.json'
- '.github/workflows/cd-api.yml'
Expand Down Expand Up @@ -92,4 +92,4 @@ jobs:
- name: Run deploy script
run: |
chmod +x backend/api/deploy-api.sh
backend/api/deploy-api.sh
backend/api/deploy-api.sh
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: GitHub Release

on:
push:
branches: [ main, master ]
branches: [main, master]
paths:
- 'package.json'
- '.github/workflows/cd.yml'
Expand Down
66 changes: 55 additions & 11 deletions .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Firebase emulators
uses: actions/cache@v4
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-${{ hashFiles('firebase.json') }}
restore-keys: firebase-emulators-

# - name: Cache Docker layers
# uses: ScribeMD/docker-cache@0.5.0
# with:
# key: docker-${{ runner.os }}-${{ hashFiles('supabase/config.toml') }}

- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('yarn.lock') }}

- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('package.json') }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -28,22 +53,40 @@ jobs:
distribution: 'temurin'
java-version: '21' # Required for firebase-tools@15+

- name: Setup Supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
HUSKY: 0

- name: Install Playwright browsers
run: npx playwright install chromium --with-deps

- name: Start Supabase # optional step, as if supabase is stopped, it would be started in test:e2e, but done here to avoid cluttering the logs of the E2E tests
run: |
echo "::group::Supabase start (docker pull logs)"
npx supabase start
echo "::endgroup::"
# Docker load from cache is actually slower than pulling the images every time with supabase start
# - name: Cache Supabase Docker images
# uses: actions/cache@v4
# with:
# path: /tmp/supabase-docker
# key: supabase-docker-${{ hashFiles('supabase/config.toml') }}
#
# - name: Load cached Docker images
# run: |
# if [ -d /tmp/supabase-docker ]; then
# for tar in /tmp/supabase-docker/*.tar; do
# [ -f "$tar" ] && docker load -i "$tar"
# done
# fi

- name: Start Supabase
run: ./scripts/supabase_start.sh

# - name: Save Supabase Docker images
# run: |
# mkdir -p /tmp/supabase-docker
# docker images --format '{{.Repository}}:{{.Tag}}' \
# | grep -E 'supabase|postgrest|gotrue|realtime|storage' \
# | grep -v '<none>' \
# | xargs -I{} sh -c \
# 'docker save {} -o /tmp/supabase-docker/$(echo {} | tr "/:" "--").tar'

- name: Run E2E tests
env:
Expand All @@ -58,7 +101,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
path: tests/reports/playwright-report/
retention-days: 7

- name: Upload test results
Expand All @@ -68,3 +111,4 @@ jobs:
name: test-results
path: test-results/
retention-days: 7
if-no-files-found: ignore
3 changes: 2 additions & 1 deletion backend/shared/src/firebase-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const getServiceAccountCredentials = () => {
try {
return JSON.parse(readFileSync(keyPath, {encoding: 'utf8'}))
} catch (e) {
throw new Error(`Failed to load service account key from ${keyPath}: ${e}`)
if (!process.env.NEXT_PUBLIC_ISOLATED_ENV && !process.env.FIREBASE_AUTH_EMULATOR_HOST)
throw new Error(`Failed to load service account key from ${keyPath}: ${e}`)
}
}

Expand Down
8 changes: 8 additions & 0 deletions backend/shared/src/supabase/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ const newClient = (
console.log('Creating Supabase direct client')
}

if (!databaseUrl && process.env.NEXT_PUBLIC_ISOLATED_ENV) {
throw new Error(
`You are running isolated tests (NEXT_PUBLIC_ISOLATED_ENV=true), so you do not want to call the remote supabase. ${{
databaseUrl,
}}`,
)
}

const config: any = databaseUrl
? {
// Use connection string for local/dev Postgres
Expand Down
12 changes: 12 additions & 0 deletions common/src/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,15 @@ export const INVERTED_RACE_CHOICES = invert(RACE_CHOICES)
export const INVERTED_MBTI_CHOICES = invert(MBTI_CHOICES)
export const INVERTED_GENDERS = invert(GENDERS)
export const INVERTED_LAST_ONLINE_CHOICES = invert(LAST_ONLINE_CHOICES)

//Exported types for test files to use when referencing the keys of the choices objects
export type ConnectionTypeKey = keyof typeof RELATIONSHIP_CHOICES
export type RelationshipStatusKey = keyof typeof RELATIONSHIP_STATUS_CHOICES
export type RelationshipStyleKey = keyof typeof ROMANTIC_CHOICES
export type PoliticalBeliefsKey = keyof typeof POLITICAL_CHOICES
export type DietKey = keyof typeof DIET_CHOICES
export type EducationKey = keyof typeof EDUCATION_CHOICES
export type ReligionKey = keyof typeof RELIGION_CHOICES
export type LanguageKey = keyof typeof LANGUAGE_CHOICES
export type EthnicityKey = keyof typeof RACE_CHOICES
export type PersonalityKey = keyof typeof MBTI_CHOICES
1 change: 1 addition & 0 deletions common/src/supabase/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function createClient(
key: string,
opts?: SupabaseClientOptionsGeneric<'public'>,
) {
if (key === 'null') throw new Error(`Invalid supabase anon key: ${key}`)
// Allow passing a full Supabase URL directly (e.g., http://localhost:54321)
const url = /:\/\//.test(instanceIdOrUrl)
? instanceIdOrUrl
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test:e2e:ui": "./scripts/e2e.sh --ui",
"test:e2e:debug": "./scripts/e2e.sh --debug",
"test:e2e:services": "./scripts/e2e_services.sh",
"test:db:reset": "npx supabase start && ./scripts/combine-migrations.sh && npx supabase db reset && yarn test:db:seed",
"test:db:reset": "./scripts/test_db_reset.sh",
"test:db:reset-postgres": "docker compose -f scripts/docker-compose.test.yml down -v && docker compose -f scripts/docker-compose.test.yml up -d",
"test:db:migrate": "./scripts/test_db_migration.sh",
"test:db:seed": "./scripts/seed.sh",
Expand Down
36 changes: 34 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
import {defineConfig, devices} from '@playwright/test'
import {execSync} from 'child_process'
import {config} from 'dotenv'

// Load static env vars from .env.test
config({path: '.env.test', quiet: true})

// Dynamically pull Supabase vars
function getSupabaseEnv() {
try {
const raw = execSync('npx supabase status --output json 2>/dev/null', {encoding: 'utf-8'})
const status = JSON.parse(raw)
if (!status.API_URL) throw new Error('No supabase API URL')
if (!status.ANON_KEY) throw new Error('No supabase ANON_KEY')
if (!status.DB_URL) throw new Error('No supabase DB_URL')
return {
NEXT_PUBLIC_SUPABASE_URL: status.API_URL,
NEXT_PUBLIC_SUPABASE_ANON_KEY: status.ANON_KEY,
DATABASE_URL: status.DB_URL,
}
} catch (e) {
console.error(e)
throw new Error('Failed to get Supabase status. Is it running?')
}
}

const supabaseEnv = getSupabaseEnv()

// Inject into process.env so Playwright and your app code can read them
Object.assign(process.env, supabaseEnv)

export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// No retries by default (even in CI) because it slows the CI pipeline and masks real bugs
// If there is a known intermittent browser timing issue for some tests, it's fine to give 1 retry to those flaky tests
retries: process.env.CI ? 0 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [['html', {outputFolder: `tests/reports/playwright-report`, open: 'on-failure'}]],
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
// headless: false,
},
projects: [
{
Expand All @@ -27,7 +59,7 @@ export default defineConfig({
// use: { ...devices['Desktop Safari'] },
// },
],
timeout: 60000,
timeout: 120000,
expect: {
timeout: 120000,
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/combine-migrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ while IFS= read -r file; do
cat "$file"
} > "$OUTPUT"

echo "✅ $file -> $OUTPUT"
# echo "✅ $file -> $OUTPUT"

COUNTER=$((COUNTER + 100))
done <<< "$FILES"
Expand Down
19 changes: 2 additions & 17 deletions scripts/e2e-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,19 @@ 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"; }

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
Expand Down Expand Up @@ -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
Expand Down
36 changes: 24 additions & 12 deletions scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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..."
Expand All @@ -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+=($!)
Expand Down
9 changes: 9 additions & 0 deletions scripts/e2e_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Loading