Files
Compass/playwright.config.ts
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

67 lines
1.9 KiB
TypeScript

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,
// 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: [
{
name: 'main',
use: {
...devices['Desktop Chrome'],
},
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
],
timeout: 120000,
expect: {
timeout: 120000,
},
})