Files
Compass/tests/e2e/web/utils/accountInformation.ts
MartinBraquet 309cbe7f2b Use unique user ID for each e2e test to fix race condition
Before, each test would delete all existing users—including the ones still used in concurrent tests
2026-02-28 14:37:43 +01:00

163 lines
4.0 KiB
TypeScript

import {faker} from '@faker-js/faker'
import {
Causes,
ChildrenExpectation,
ConnectionType,
Diet,
Education,
Ethnicity,
Gender,
InterestedIn,
Interests,
Language,
Personality,
Platforms,
PoliticalBeliefs,
RelationshipStatus,
RelationshipStyle,
Religion,
} 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?: Ethnicity
interested_in?: InterestedIn
Interested_in_ages?: InterestedInAges
connection_type?: ConnectionType
relationship_status?: RelationshipStatus
relationship_style?: RelationshipStyle
number_of_kids?: string
children_expectation?: ChildrenExpectation
interests?: (Interests | string)[]
causes?: (Causes | string)[]
education_level?: Education
university?: string
job_title?: string
company?: string
work_area?: string[]
beliefs?: BeliefDetails
personality_type?: Personality
big_five_personality_traits?: FiveBigPersonalityTraits
diet?: Diet
is_smoker?: boolean
alcohol_consumed_per_month?: string
languages?: Language[]
social_media?: Socials[]
}
type Height = {
feet: string
inches: string
centimeters: string
}
type InterestedInAges = {
min: string
max?: string
}
type BeliefDetails = {
political?: {
belief?: PoliticalBeliefs
details?: string
}
religious?: {
belief?: Religion
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: () => ({
email: `faker+${crypto.randomUUID()}@test.com`,
password: faker.internet.password(),
display_name: faker.internet.displayName(),
username: `user_${crypto.randomUUID().slice(0, 8)}`,
}),
account_one: () => ({
// Use a non-real TLD like @test.compass to make it obvious these are test accounts and prevent accidental emails
email: `onboarding+${crypto.randomUUID()}@test.compass`,
password: 'CompassTest',
display_name: 'Compass Onboarding',
username: `TheGreatOnboarding_${crypto.randomUUID().slice(0, 8)}`,
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',
interests: ['Chess', 'Eating'],
causes: ['Animal Rights', 'Free Spotify'],
education_level: 'Bachelors',
university: 'Open-Source University',
job_title: 'Unemployed',
company: 'Home',
work_area: ['Living Room', 'University'],
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',
},
],
}),
}