Files
Compass/tests/e2e/web/utils/accountInformation.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

171 lines
4.3 KiB
TypeScript

import {faker} from '@faker-js/faker'
import {
ConnectionTypeKey,
DietKey,
EducationKey,
EthnicityKey,
LanguageKey,
PersonalityKey,
PoliticalBeliefsKey,
RelationshipStatusKey,
RelationshipStyleKey,
ReligionKey,
} from 'common/choices'
import {
Causes,
ChildrenExpectation,
Gender,
InterestedIn,
Interests,
Platforms,
} from '../pages/signUpPage'
export type OnboardingUser = {
email: string
password: string
display_name: string
username: string
bio?: string
gender?: Gender
age?: string
height?: Height
ethnicity_origin?: EthnicityKey
interested_in?: InterestedIn
Interested_in_ages?: InterestedInAges
connection_type?: ConnectionTypeKey
relationship_status?: RelationshipStatusKey
relationship_style?: RelationshipStyleKey
number_of_kids?: string
children_expectation?: ChildrenExpectation
interests?: (Interests | string)[]
causes?: (Causes | string)[]
education_level?: EducationKey
university?: string
job_title?: string
company?: string
work_area?: string[]
beliefs?: BeliefDetails
personality_type?: PersonalityKey
big_five_personality_traits?: FiveBigPersonalityTraits
diet?: DietKey
is_smoker?: boolean
alcohol_consumed_per_month?: string
languages?: LanguageKey[]
social_media?: Socials[]
}
type Height = {
feet: string
inches: string
centimeters: string
}
type InterestedInAges = {
min: string
max?: string
}
type BeliefDetails = {
political?: {
belief?: PoliticalBeliefsKey
details?: string
}
religious?: {
belief?: ReligionKey
details?: string
}
}
export type Socials = {
platform: Platforms
urlOrUsername: string
}
type FiveBigPersonalityTraits = {
openness?: number
conscientiousness?: number
extraversion?: number
agreeableness?: number
neuroticism?: number
}
type OnboardingConfig = {
faker_account: () => OnboardingUser
account_one: () => OnboardingUser
}
export const onboarding: OnboardingConfig = {
// Use a function so email is unique per test call
faker_account: () => {
const id = crypto.randomUUID().slice(0, 6)
return {
email: `faker+${id}@test.com`,
password: faker.internet.password(),
display_name: faker.internet.displayName(),
username: `user_${id}`,
}
},
account_one: () => {
const id = crypto.randomUUID().slice(0, 6)
return {
// Use a non-real TLD like @test.compass to make it obvious these are test accounts and prevent accidental emails
email: `onboarding+${id}@test.compass`,
password: 'CompassTest',
display_name: 'Compass Onboarding',
username: `TheGreatOnboarding_${id}`, // username max length is 25 (see /create-user)
bio: 'Born beneath twin moons, this wanderer maps forgotten roads, trades riddles for shelter, and keeps stories in glass bottles. Drawn to ancient libraries and glowing forests, they seek lost spells, quiet taverns, and adventures that rewrite fate. Their compass points to wonder. Ever onward. Always. Go',
gender: 'Woman',
age: '25',
height: {
feet: '6',
inches: '0',
centimeters: '182.88',
},
ethnicity_origin: 'South/Southeast Asian',
interested_in: 'Men',
Interested_in_ages: {
min: '20',
max: '30',
},
connection_type: 'Relationship',
relationship_status: 'In open relationship',
relationship_style: 'Open Relationship',
number_of_kids: '2',
children_expectation: ['Neutral', 2],
interests: ['Chess', 'Eating'],
causes: ['Animal Rights', 'Free Spotify'],
education_level: 'Bachelors',
university: 'Open-Source University',
job_title: 'Unemployed',
company: 'Home',
work_area: ['Engineering', 'Academia'],
beliefs: {
political: {
belief: 'Green / Eco-Socialist',
details: 'This will be details',
},
religious: {
belief: 'Shinto',
details: 'This will be details',
},
},
personality_type: 'ENFJ',
big_five_personality_traits: {
openness: 43,
},
diet: 'Omnivore',
is_smoker: false,
alcohol_consumed_per_month: '4',
languages: ['Akan', 'Cebuano'],
social_media: [
{
platform: 'Bluesky',
urlOrUsername: 'TheGreatConnection',
},
],
}
},
}