From 58dfabf11f69def6d03262526bc10059e004f4f1 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sun, 22 Feb 2026 18:34:09 +0000 Subject: [PATCH 01/49] Added Database checks to the onboarding flow --- tests/e2e/web/pages/signUpPage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/web/pages/signUpPage.ts b/tests/e2e/web/pages/signUpPage.ts index ce53777f..75de5414 100644 --- a/tests/e2e/web/pages/signUpPage.ts +++ b/tests/e2e/web/pages/signUpPage.ts @@ -670,7 +670,7 @@ export class SignUpPage { async setLanguages(language: LanguageTuple[] | undefined) { if (!language || language.length === 0) return - await this.page.getByRole('checkbox', {name: `English`}).click() + await this.page.getByRole('checkbox', {name: `English`}).click(); for (let i = 0; i < language.length; i++) { await expect(this.page.getByRole('checkbox', {name: `${language[i][0]}`})).toBeVisible() await this.page.getByRole('checkbox', {name: `${language[i][0]}`}).click() From 11f8477da2162d287b330403224d471727bbf581 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 25 Feb 2026 15:19:06 +0000 Subject: [PATCH 02/49] Added compatibility page setup Added more compatibility questions --- tests/e2e/web/pages/profilePage.ts | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/e2e/web/pages/profilePage.ts b/tests/e2e/web/pages/profilePage.ts index 3a63d128..dfc85f8e 100644 --- a/tests/e2e/web/pages/profilePage.ts +++ b/tests/e2e/web/pages/profilePage.ts @@ -272,19 +272,19 @@ export class ProfilePage { } async clickStartAnsweringButton() { - await expect(this.startAnsweringButton).toBeVisible() - await this.startAnsweringButton.click() - } + await expect(this.startAnsweringButton).toBeVisible(); + await this.startAnsweringButton.click(); + }; async clickDoThisLaterButton() { - await expect(this.doThisLaterLink).toBeVisible() - await this.doThisLaterLink.click() - } + await expect(this.doThisLaterLink).toBeVisible(); + await this.doThisLaterLink.click(); + }; async clickShareButton() { - await expect(this.shareButton).toBeVisible() - await this.shareButton.click() - } + await expect(this.shareButton).toBeVisible(); + await this.shareButton.click(); + }; async clickEditProfileButton() { await expect(this.editProfileButton).toBeVisible() @@ -302,20 +302,20 @@ export class ProfilePage { } async selectOptionFromProfileDropdown(option: ProfileDropdownOptions) { - await expect(this.profileOptionsDropdown).toBeVisible() - await this.profileOptionsDropdown.click() + await expect(this.profileOptionsDropdown).toBeVisible(); + await this.profileOptionsDropdown.click(); if (option === 'Public') { - await expect(this.listProfilePubliclyDropdownOption).toBeVisible() - await this.listProfilePubliclyDropdownOption.click() + await expect(this.listProfilePubliclyDropdownOption).toBeVisible(); + await this.listProfilePubliclyDropdownOption.click(); } else if (option === 'Disable') { - await expect(this.disableProfileDropdownOption).toBeVisible() - await this.disableProfileDropdownOption.click() + await expect(this.disableProfileDropdownOption).toBeVisible(); + await this.disableProfileDropdownOption.click(); } else if (option === 'Private') { - await expect(this.limitProfileToMembersDropdownOption).toBeVisible() - await this.limitProfileToMembersDropdownOption.click() - } - } + await expect(this.limitProfileToMembersDropdownOption).toBeVisible(); + await this.limitProfileToMembersDropdownOption.click(); + }; + }; async verifyDisplayName(displayName?: string) { await expect(this.displayNameAndAgeSection).toBeVisible() From dd01e0b3d002da8684b84ddfc9fe42e91733a585 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 4 Mar 2026 01:30:41 +0000 Subject: [PATCH 03/49] Finished up the onboarding flow suite Added compatibility question tests and verifications Updated tests to cover Keywords and Headline changes recently made Updated tests to cover all of the big5 personality traits --- tests/e2e/web/utils/accountInformation.ts | 2 +- .../answer-compatibility-question-content.tsx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/e2e/web/utils/accountInformation.ts b/tests/e2e/web/utils/accountInformation.ts index 2d2c4134..97281ab9 100644 --- a/tests/e2e/web/utils/accountInformation.ts +++ b/tests/e2e/web/utils/accountInformation.ts @@ -252,4 +252,4 @@ export const testAccounts: AccountConfig = { }, } }, -} +} \ No newline at end of file diff --git a/web/components/answers/answer-compatibility-question-content.tsx b/web/components/answers/answer-compatibility-question-content.tsx index 24e65326..e1c43f9d 100644 --- a/web/components/answers/answer-compatibility-question-content.tsx +++ b/web/components/answers/answer-compatibility-question-content.tsx @@ -34,6 +34,7 @@ export const IMPORTANCE_CHOICES = { Important: 2, 'Very Important': 3, } as const +} as const type ImportanceColorsType = { [key: number]: string @@ -165,6 +166,9 @@ export function AnswerCompatibilityQuestionContent(props: { {shortenedPopularity && ( +
{compatibilityQuestion.question}
+ {shortenedPopularity && ( + ) => @@ -298,6 +303,7 @@ export const SelectAnswer = (props: { const {value, setValue, options} = props return ( clsx( disabled @@ -336,6 +343,7 @@ export const MultiSelectAnswers = (props: { return ( Date: Wed, 4 Mar 2026 15:44:07 +0000 Subject: [PATCH 04/49] . --- tests/e2e/web/pages/profilePage.ts | 38 +++++++++++------------ tests/e2e/web/pages/signUpPage.ts | 2 +- tests/e2e/web/utils/accountInformation.ts | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/e2e/web/pages/profilePage.ts b/tests/e2e/web/pages/profilePage.ts index dfc85f8e..3a63d128 100644 --- a/tests/e2e/web/pages/profilePage.ts +++ b/tests/e2e/web/pages/profilePage.ts @@ -272,19 +272,19 @@ export class ProfilePage { } async clickStartAnsweringButton() { - await expect(this.startAnsweringButton).toBeVisible(); - await this.startAnsweringButton.click(); - }; + await expect(this.startAnsweringButton).toBeVisible() + await this.startAnsweringButton.click() + } async clickDoThisLaterButton() { - await expect(this.doThisLaterLink).toBeVisible(); - await this.doThisLaterLink.click(); - }; + await expect(this.doThisLaterLink).toBeVisible() + await this.doThisLaterLink.click() + } async clickShareButton() { - await expect(this.shareButton).toBeVisible(); - await this.shareButton.click(); - }; + await expect(this.shareButton).toBeVisible() + await this.shareButton.click() + } async clickEditProfileButton() { await expect(this.editProfileButton).toBeVisible() @@ -302,20 +302,20 @@ export class ProfilePage { } async selectOptionFromProfileDropdown(option: ProfileDropdownOptions) { - await expect(this.profileOptionsDropdown).toBeVisible(); - await this.profileOptionsDropdown.click(); + await expect(this.profileOptionsDropdown).toBeVisible() + await this.profileOptionsDropdown.click() if (option === 'Public') { - await expect(this.listProfilePubliclyDropdownOption).toBeVisible(); - await this.listProfilePubliclyDropdownOption.click(); + await expect(this.listProfilePubliclyDropdownOption).toBeVisible() + await this.listProfilePubliclyDropdownOption.click() } else if (option === 'Disable') { - await expect(this.disableProfileDropdownOption).toBeVisible(); - await this.disableProfileDropdownOption.click(); + await expect(this.disableProfileDropdownOption).toBeVisible() + await this.disableProfileDropdownOption.click() } else if (option === 'Private') { - await expect(this.limitProfileToMembersDropdownOption).toBeVisible(); - await this.limitProfileToMembersDropdownOption.click(); - }; - }; + await expect(this.limitProfileToMembersDropdownOption).toBeVisible() + await this.limitProfileToMembersDropdownOption.click() + } + } async verifyDisplayName(displayName?: string) { await expect(this.displayNameAndAgeSection).toBeVisible() diff --git a/tests/e2e/web/pages/signUpPage.ts b/tests/e2e/web/pages/signUpPage.ts index 75de5414..ce53777f 100644 --- a/tests/e2e/web/pages/signUpPage.ts +++ b/tests/e2e/web/pages/signUpPage.ts @@ -670,7 +670,7 @@ export class SignUpPage { async setLanguages(language: LanguageTuple[] | undefined) { if (!language || language.length === 0) return - await this.page.getByRole('checkbox', {name: `English`}).click(); + await this.page.getByRole('checkbox', {name: `English`}).click() for (let i = 0; i < language.length; i++) { await expect(this.page.getByRole('checkbox', {name: `${language[i][0]}`})).toBeVisible() await this.page.getByRole('checkbox', {name: `${language[i][0]}`}).click() diff --git a/tests/e2e/web/utils/accountInformation.ts b/tests/e2e/web/utils/accountInformation.ts index 97281ab9..2d2c4134 100644 --- a/tests/e2e/web/utils/accountInformation.ts +++ b/tests/e2e/web/utils/accountInformation.ts @@ -252,4 +252,4 @@ export const testAccounts: AccountConfig = { }, } }, -} \ No newline at end of file +} From eb7825c502113f8aebfb3e5f259fe75b86da9756 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 11 Mar 2026 17:04:54 +0000 Subject: [PATCH 05/49] Fix: Merge conflict --- .../answer-compatibility-question-content.tsx | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/web/components/answers/answer-compatibility-question-content.tsx b/web/components/answers/answer-compatibility-question-content.tsx index e1c43f9d..24e65326 100644 --- a/web/components/answers/answer-compatibility-question-content.tsx +++ b/web/components/answers/answer-compatibility-question-content.tsx @@ -34,7 +34,6 @@ export const IMPORTANCE_CHOICES = { Important: 2, 'Very Important': 3, } as const -} as const type ImportanceColorsType = { [key: number]: string @@ -166,9 +165,6 @@ export function AnswerCompatibilityQuestionContent(props: { {shortenedPopularity && ( -
{compatibilityQuestion.question}
- {shortenedPopularity && ( - ) => @@ -303,7 +298,6 @@ export const SelectAnswer = (props: { const {value, setValue, options} = props return ( clsx( disabled @@ -343,7 +336,6 @@ export const MultiSelectAnswers = (props: { return ( Date: Fri, 13 Mar 2026 19:32:32 +0000 Subject: [PATCH 06/49] . --- playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright.config.ts b/playwright.config.ts index ec94cf50..4d0416a5 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -28,7 +28,7 @@ function getSupabaseEnv() { const supabaseEnv = getSupabaseEnv() // Inject into process.env so Playwright and your app code can read them -Object.assign(process.env, supabaseEnv) +// Object.assign(process.env, supabaseEnv) export default defineConfig({ testDir: './tests/e2e', From 4e6d4f37bf708aeafd735eb91f27eb200189d371 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sun, 15 Mar 2026 17:57:48 +0000 Subject: [PATCH 07/49] Fix: Added fix for None discriptive error issue #36 Updated signUp.spec.ts to use new fixture Updated Account information variable names Deleted "deleteUserFixture.ts" as it was incorporated into the "base.ts" file --- tests/e2e/web/pages/signUpPage.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/e2e/web/pages/signUpPage.ts b/tests/e2e/web/pages/signUpPage.ts index ce53777f..4a3f109d 100644 --- a/tests/e2e/web/pages/signUpPage.ts +++ b/tests/e2e/web/pages/signUpPage.ts @@ -733,3 +733,8 @@ export class SignUpPage { await expect(this.usernameError).toBeVisible() } } + + async verifyUsernameError() { + await expect(this.usernameError).toBeVisible() + } +} \ No newline at end of file From 17072c958763d8c6fb5eca7e84eadd0d3f466fa7 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sun, 15 Mar 2026 19:48:29 +0000 Subject: [PATCH 08/49] Linting and Prettier --- tests/e2e/web/pages/signUpPage.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/e2e/web/pages/signUpPage.ts b/tests/e2e/web/pages/signUpPage.ts index 4a3f109d..33328d8d 100644 --- a/tests/e2e/web/pages/signUpPage.ts +++ b/tests/e2e/web/pages/signUpPage.ts @@ -729,11 +729,6 @@ export class SignUpPage { await expect(this.displayNameError).toBeVisible() } - async verifyUsernameError() { - await expect(this.usernameError).toBeVisible() - } -} - async verifyUsernameError() { await expect(this.usernameError).toBeVisible() } From 5129e8e343c9ad0f32a028bb0782f1df184feeed Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 15 Mar 2026 23:11:08 +0100 Subject: [PATCH 09/49] Minor cleaning --- playwright.config.ts | 2 +- tests/e2e/web/specs/signUp.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index 4d0416a5..ec94cf50 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -28,7 +28,7 @@ function getSupabaseEnv() { const supabaseEnv = getSupabaseEnv() // Inject into process.env so Playwright and your app code can read them -// Object.assign(process.env, supabaseEnv) +Object.assign(process.env, supabaseEnv) export default defineConfig({ testDir: './tests/e2e', diff --git a/tests/e2e/web/specs/signUp.spec.ts b/tests/e2e/web/specs/signUp.spec.ts index a266bb17..53562129 100644 --- a/tests/e2e/web/specs/signUp.spec.ts +++ b/tests/e2e/web/specs/signUp.spec.ts @@ -28,4 +28,4 @@ test.describe('when an error occurs', () => { await app.signUp.verifyUsernameError() await expect(app.signUp.nextButtonLocator).toBeDisabled() }) -}) \ No newline at end of file +}) From 224f0c8bba8ce18d036a99176f337bda48aa31b3 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Tue, 17 Mar 2026 18:38:32 +0000 Subject: [PATCH 10/49] Added Google account to the Onboarding flow --- playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright.config.ts b/playwright.config.ts index ec94cf50..4d0416a5 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -28,7 +28,7 @@ function getSupabaseEnv() { const supabaseEnv = getSupabaseEnv() // Inject into process.env so Playwright and your app code can read them -Object.assign(process.env, supabaseEnv) +// Object.assign(process.env, supabaseEnv) export default defineConfig({ testDir: './tests/e2e', From 0016c69a25bb0255267d279f696425569096b291 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 18 Mar 2026 18:18:56 +0000 Subject: [PATCH 11/49] Added account cleanup for google accounts --- tests/e2e/web/fixtures/base.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/web/fixtures/base.ts b/tests/e2e/web/fixtures/base.ts index 4fe2f1dd..408bcf89 100644 --- a/tests/e2e/web/fixtures/base.ts +++ b/tests/e2e/web/fixtures/base.ts @@ -35,6 +35,7 @@ export const test = base.extend<{ const account = testAccounts.google_account_two() const getAuthObject = await getAuthAccountInfo(page) await use(account) + console.log('Cleaning up google account...') await deleteUser('Google', undefined, getAuthObject()) }, From 7bb8eeac7f3656c201002126d7c36b5669a85f28 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 25 Mar 2026 00:59:08 +0000 Subject: [PATCH 12/49] Started work on Sign-in tests Updated seedDatabase.ts to throw an error if the user already exists, to also add display names and usernames so they seedUser func acts like a normal basic user Some organising of the google auth code --- .vscode/settings.json | 3 +++ tests/e2e/web/fixtures/base.ts | 1 - tests/e2e/web/specs/postSignIn.spec.ts | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 tests/e2e/web/specs/postSignIn.spec.ts diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..db1ed83a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "codium.codeCompletion.enable": false +} \ No newline at end of file diff --git a/tests/e2e/web/fixtures/base.ts b/tests/e2e/web/fixtures/base.ts index 408bcf89..4fe2f1dd 100644 --- a/tests/e2e/web/fixtures/base.ts +++ b/tests/e2e/web/fixtures/base.ts @@ -35,7 +35,6 @@ export const test = base.extend<{ const account = testAccounts.google_account_two() const getAuthObject = await getAuthAccountInfo(page) await use(account) - console.log('Cleaning up google account...') await deleteUser('Google', undefined, getAuthObject()) }, diff --git a/tests/e2e/web/specs/postSignIn.spec.ts b/tests/e2e/web/specs/postSignIn.spec.ts new file mode 100644 index 00000000..12029006 --- /dev/null +++ b/tests/e2e/web/specs/postSignIn.spec.ts @@ -0,0 +1,19 @@ +import {test, expect} from '../fixtures/signInFixture' +import * as fs from "fs"; + +test.describe('when given valid input', () => { + test('should be logged in and see settings page', async ({ + authenticatedPage, + homePage, + }) => { + await homePage.gotToHomePage() + // await authenticatedPage.goto('/settings') + + // await expect(authenticatedPage.getByRole('heading', { name: 'Theme' })).toBeVisible() + }) +}); + +test.describe('when an error occurs', () => { + test('placeholder', async () => {}); +}); + From 89efb0ff014c4c1987b6816ee6d55eaeaee13dc6 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 25 Mar 2026 01:09:24 +0000 Subject: [PATCH 13/49] Linting and Prettier --- tests/e2e/web/specs/postSignIn.spec.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/e2e/web/specs/postSignIn.spec.ts b/tests/e2e/web/specs/postSignIn.spec.ts index 12029006..d9766b35 100644 --- a/tests/e2e/web/specs/postSignIn.spec.ts +++ b/tests/e2e/web/specs/postSignIn.spec.ts @@ -1,19 +1,15 @@ import {test, expect} from '../fixtures/signInFixture' -import * as fs from "fs"; +import * as fs from 'fs' test.describe('when given valid input', () => { - test('should be logged in and see settings page', async ({ - authenticatedPage, - homePage, - }) => { + test('should be logged in and see settings page', async ({authenticatedPage, homePage}) => { await homePage.gotToHomePage() // await authenticatedPage.goto('/settings') // await expect(authenticatedPage.getByRole('heading', { name: 'Theme' })).toBeVisible() }) -}); +}) test.describe('when an error occurs', () => { - test('placeholder', async () => {}); -}); - + test('placeholder', async () => {}) +}) From ef63832ab8660d2cc07248296f8ca5925c8cf71f Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 26 Mar 2026 15:13:11 +0000 Subject: [PATCH 14/49] Added checks to the deleteUser func to check if the accout exists Added account deletion checks --- tests/e2e/web/specs/onboardingFlow.spec.ts | 71 ++++++++++++++++++++++ tests/e2e/web/specs/postSignIn.spec.ts | 15 ----- tests/e2e/web/specs/signIn.spec.ts | 8 +++ 3 files changed, 79 insertions(+), 15 deletions(-) delete mode 100644 tests/e2e/web/specs/postSignIn.spec.ts diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 0466074c..c124bae9 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -251,6 +251,77 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(fakerAccount.username) }) + test('should successfully delete an account created via email and password', async ({ + homePage, + onboardingPage, + signUpPage, + authPage, + profilePage, + settingsPage, + fakerAccount, + }) => { + await registerWithEmail(homePage, authPage, fakerAccount) + await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, fakerAccount) + + //Verify displayed information is correct + await profilePage.verifyDisplayName(fakerAccount.display_name) + + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) + + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey("Delete me") + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) + + test('should successfully delete an account created via google auth', async ({ + homePage, + onboardingPage, + signUpPage, + authPage, + profilePage, + settingsPage, + googleAccountTwo, + }) => { + console.log( + `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, + ) + await homePage.gotToRegisterPage() + await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here + await authPage.signInToGoogleAccount( + googleAccountTwo.email, + googleAccountTwo.display_name, + googleAccountTwo.username, + ) + await onboardingPage.clickSkipOnboardingButton() + await signUpPage.fillDisplayName(googleAccountTwo.display_name) + await signUpPage.fillUsername(googleAccountTwo.username) + await signUpPage.clickNextButton() + await signUpPage.clickNextButton() //Skip optional information + await profilePage.clickCloseButton() + await onboardingPage.clickRefineProfileButton() + + //Verify displayed information is correct + await profilePage.verifyDisplayName(googleAccountTwo.display_name) + + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountTwo) + + await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) + await expect(dbInfo.user.username).toContain(googleAccountTwo.username) + + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey("Delete me") + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) + test('should successfully enter optional information after completing flow', async ({ app, fakerAccount, diff --git a/tests/e2e/web/specs/postSignIn.spec.ts b/tests/e2e/web/specs/postSignIn.spec.ts deleted file mode 100644 index d9766b35..00000000 --- a/tests/e2e/web/specs/postSignIn.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {test, expect} from '../fixtures/signInFixture' -import * as fs from 'fs' - -test.describe('when given valid input', () => { - test('should be logged in and see settings page', async ({authenticatedPage, homePage}) => { - await homePage.gotToHomePage() - // await authenticatedPage.goto('/settings') - - // await expect(authenticatedPage.getByRole('heading', { name: 'Theme' })).toBeVisible() - }) -}) - -test.describe('when an error occurs', () => { - test('placeholder', async () => {}) -}) diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 0b596b2d..a4d16533 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -45,4 +45,12 @@ test.describe('when given invalid input', () => { page.getByText('Failed to sign in with your email and password', {exact: true}), ).toBeVisible() }) + + test('login check', async ({}) => { + + }); +}) + +test.describe('when an error occurs', () => { + test('placeholder', async () => {}) }) From e0561b532b43990cda4c736694c346f6bbd3a912 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 26 Mar 2026 15:14:57 +0000 Subject: [PATCH 15/49] Linting and Prettier --- tests/e2e/web/pages/signUpPage.ts | 2 +- tests/e2e/web/specs/onboardingFlow.spec.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/e2e/web/pages/signUpPage.ts b/tests/e2e/web/pages/signUpPage.ts index 33328d8d..ce53777f 100644 --- a/tests/e2e/web/pages/signUpPage.ts +++ b/tests/e2e/web/pages/signUpPage.ts @@ -732,4 +732,4 @@ export class SignUpPage { async verifyUsernameError() { await expect(this.usernameError).toBeVisible() } -} \ No newline at end of file +} diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index c124bae9..a5dfc511 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -268,13 +268,13 @@ test.describe('when given valid input', () => { //Verify database info const dbInfo = await userInformationFromDb(fakerAccount) - + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) await expect(dbInfo.user.username).toContain(fakerAccount.username) - + await homePage.clickSettingsLink() await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey("Delete me") + await settingsPage.fillDeleteAccountSurvey('Delete me') await settingsPage.clickDeleteAccountButton() await homePage.verifyHomePageLinks() }) @@ -314,10 +314,10 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - + await homePage.clickSettingsLink() await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey("Delete me") + await settingsPage.fillDeleteAccountSurvey('Delete me') await settingsPage.clickDeleteAccountButton() await homePage.verifyHomePageLinks() }) From 9571d9b0cded3007f2f1a62f52f91c82c0095241 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 14:44:41 +0100 Subject: [PATCH 16/49] Formatting update, fixed homePage locator for signin --- tests/e2e/web/specs/onboardingFlow.spec.ts | 332 ++++++++++----------- 1 file changed, 166 insertions(+), 166 deletions(-) diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index a5dfc511..7df2d9fe 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -129,89 +129,89 @@ test.describe('when given valid input', () => { await app.profile.verifyBio(onboardingAccount.bio) await app.profile.verifyCompatibilityAnswers(compatQuestionOne) - //Verify Database Information - const dbInfo = await userInformationFromDb(onboardingAccount) - console.log(dbInfo.profile) - - await expect(dbInfo.user.name).toBe(onboardingAccount.display_name) - await expect(dbInfo.user.username).toBe(onboardingAccount.username) - await expect(dbInfo.profile.bio_text).toBe(onboardingAccount.bio) - await expect(dbInfo.profile.gender).toEqual(onboardingAccount.gender?.[1]) - await expect(dbInfo.profile.headline).toEqual(onboardingAccount.headline) - await expect(dbInfo.profile.keywords).toEqual( - expect.arrayContaining(onboardingAccount.keywords?.split(', ') ?? []), - ) - await expect(String(dbInfo.profile.age)).toEqual(onboardingAccount.age) - await expect(dbInfo.profile.height_in_inches).toEqual( - Number(onboardingAccount.height?.feet) * 12, - ) - await expect(dbInfo.profile.ethnicity).toContain(onboardingAccount.ethnicity_origin?.[1]) - await expect(dbInfo.profile.pref_gender).toContain(onboardingAccount.interested_in?.[1]) - await expect(String(dbInfo.profile.pref_age_min)).toContain( - onboardingAccount.Interested_in_ages?.min, - ) - await expect(String(dbInfo.profile.pref_age_max)).toContain( - onboardingAccount.Interested_in_ages?.max, - ) - await expect(dbInfo.profile.pref_relation_styles).toContain( - `${onboardingAccount.connection_type?.[1]}`.toLowerCase(), - ) - await expect(dbInfo.profile.relationship_status).toContain( - onboardingAccount.relationship_status?.[1], - ) - await expect(dbInfo.profile.pref_romantic_styles).toContain( - onboardingAccount.relationship_style?.[1], - ) - await expect(dbInfo.profile.has_kids).toEqual(Number(onboardingAccount.number_of_kids)) - await expect(dbInfo.profile.wants_kids_strength).toEqual( - onboardingAccount.children_expectation?.[1], - ) - await expect(dbInfo.profile.education_level).toContain( - `${onboardingAccount.education_level?.[1]}`.toLowerCase(), - ) - await expect(dbInfo.profile.university).toContain(onboardingAccount.university) - await expect(dbInfo.profile.occupation_title).toContain(onboardingAccount.job_title) - await expect(dbInfo.profile.company).toContain(onboardingAccount.company) - await expect(dbInfo.profile.political_beliefs).toContain( - onboardingAccount.beliefs?.political?.belief?.[1], - ) - await expect(dbInfo.profile.political_details).toContain( - onboardingAccount.beliefs?.political?.details, - ) - await expect(dbInfo.profile.religion).toContain( - onboardingAccount.beliefs?.religious?.belief?.[1], - ) - await expect(dbInfo.profile.religious_beliefs).toContain( - onboardingAccount.beliefs?.religious?.details, - ) - await expect(dbInfo.profile.mbti).toContain( - `${onboardingAccount.personality_type}`.toLowerCase(), - ) - await expect(dbInfo.profile.big5_openness).toEqual( - onboardingAccount.big_five_personality_traits?.openness, - ) - await expect(dbInfo.profile.big5_conscientiousness).toEqual( - onboardingAccount.big_five_personality_traits?.conscientiousness, - ) - await expect(dbInfo.profile.big5_extraversion).toEqual( - onboardingAccount.big_five_personality_traits?.extraversion, - ) - await expect(dbInfo.profile.big5_agreeableness).toEqual( - onboardingAccount.big_five_personality_traits?.agreeableness, - ) - await expect(dbInfo.profile.big5_neuroticism).toEqual( - onboardingAccount.big_five_personality_traits?.neuroticism, - ) - await expect(dbInfo.profile.diet).toContain(onboardingAccount.diet?.[1].toLowerCase()) - await expect(dbInfo.profile.is_smoker).toEqual(onboardingAccount.is_smoker) - await expect(dbInfo.profile.languages).toHaveLength(2) - await expect(dbInfo.profile.languages).toEqual( - expect.arrayContaining(onboardingAccount.languages?.map(([_, l]) => l.toLowerCase()) ?? []), - ) - await expect(String(dbInfo.profile.drinks_per_month)).toEqual( - onboardingAccount.alcohol_consumed_per_month, - ) - }) + //Verify Database Information + const dbInfo = await userInformationFromDb(onboardingAccount) + console.log(dbInfo.profile) + + await expect(dbInfo.user.name).toBe(onboardingAccount.display_name) + await expect(dbInfo.user.username).toBe(onboardingAccount.username) + await expect(dbInfo.profile.bio_text).toBe(onboardingAccount.bio) + await expect(dbInfo.profile.gender).toEqual(onboardingAccount.gender?.[1]) + await expect(dbInfo.profile.headline).toEqual(onboardingAccount.headline) + await expect(dbInfo.profile.keywords).toEqual( + expect.arrayContaining(onboardingAccount.keywords?.split(', ') ?? []), + ) + await expect(String(dbInfo.profile.age)).toEqual(onboardingAccount.age) + await expect(dbInfo.profile.height_in_inches).toEqual( + Number(onboardingAccount.height?.feet) * 12, + ) + await expect(dbInfo.profile.ethnicity).toContain(onboardingAccount.ethnicity_origin?.[1]) + await expect(dbInfo.profile.pref_gender).toContain(onboardingAccount.interested_in?.[1]) + await expect(String(dbInfo.profile.pref_age_min)).toContain( + onboardingAccount.Interested_in_ages?.min, + ) + await expect(String(dbInfo.profile.pref_age_max)).toContain( + onboardingAccount.Interested_in_ages?.max, + ) + await expect(dbInfo.profile.pref_relation_styles).toContain( + `${onboardingAccount.connection_type?.[1]}`.toLowerCase(), + ) + await expect(dbInfo.profile.relationship_status).toContain( + onboardingAccount.relationship_status?.[1], + ) + await expect(dbInfo.profile.pref_romantic_styles).toContain( + onboardingAccount.relationship_style?.[1], + ) + await expect(dbInfo.profile.has_kids).toEqual(Number(onboardingAccount.number_of_kids)) + await expect(dbInfo.profile.wants_kids_strength).toEqual( + onboardingAccount.children_expectation?.[1], + ) + await expect(dbInfo.profile.education_level).toContain( + `${onboardingAccount.education_level?.[1]}`.toLowerCase(), + ) + await expect(dbInfo.profile.university).toContain(onboardingAccount.university) + await expect(dbInfo.profile.occupation_title).toContain(onboardingAccount.job_title) + await expect(dbInfo.profile.company).toContain(onboardingAccount.company) + await expect(dbInfo.profile.political_beliefs).toContain( + onboardingAccount.beliefs?.political?.belief?.[1], + ) + await expect(dbInfo.profile.political_details).toContain( + onboardingAccount.beliefs?.political?.details, + ) + await expect(dbInfo.profile.religion).toContain( + onboardingAccount.beliefs?.religious?.belief?.[1], + ) + await expect(dbInfo.profile.religious_beliefs).toContain( + onboardingAccount.beliefs?.religious?.details, + ) + await expect(dbInfo.profile.mbti).toContain( + `${onboardingAccount.personality_type}`.toLowerCase(), + ) + await expect(dbInfo.profile.big5_openness).toEqual( + onboardingAccount.big_five_personality_traits?.openness, + ) + await expect(dbInfo.profile.big5_conscientiousness).toEqual( + onboardingAccount.big_five_personality_traits?.conscientiousness, + ) + await expect(dbInfo.profile.big5_extraversion).toEqual( + onboardingAccount.big_five_personality_traits?.extraversion, + ) + await expect(dbInfo.profile.big5_agreeableness).toEqual( + onboardingAccount.big_five_personality_traits?.agreeableness, + ) + await expect(dbInfo.profile.big5_neuroticism).toEqual( + onboardingAccount.big_five_personality_traits?.neuroticism, + ) + await expect(dbInfo.profile.diet).toContain(onboardingAccount.diet?.[1].toLowerCase()) + await expect(dbInfo.profile.is_smoker).toEqual(onboardingAccount.is_smoker) + await expect(dbInfo.profile.languages).toHaveLength(2) + await expect(dbInfo.profile.languages).toEqual( + expect.arrayContaining(onboardingAccount.languages?.map(([_, l]) => l.toLowerCase()) ?? []), + ) + await expect(String(dbInfo.profile.drinks_per_month)).toEqual( + onboardingAccount.alcohol_consumed_per_month, + ) + }) test('should successfully complete the onboarding flow with google account', async ({ app, @@ -230,12 +230,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(googleAccountOne.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountOne) + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountOne) - await expect(dbInfo.user.name).toContain(googleAccountOne.display_name) - await expect(dbInfo.user.username).toContain(googleAccountOne.username) - }) + await expect(dbInfo.user.name).toContain(googleAccountOne.display_name) + await expect(dbInfo.user.username).toContain(googleAccountOne.username) + }) test('should successfully skip the onboarding flow', async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) @@ -244,12 +244,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test('should successfully delete an account created via email and password', async ({ homePage, @@ -263,64 +263,64 @@ test.describe('when given valid input', () => { await registerWithEmail(homePage, authPage, fakerAccount) await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, fakerAccount) - //Verify displayed information is correct - await profilePage.verifyDisplayName(fakerAccount.display_name) + //Verify displayed information is correct + await profilePage.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() - }) + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey('Delete me') + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) - test('should successfully delete an account created via google auth', async ({ - homePage, - onboardingPage, - signUpPage, - authPage, - profilePage, - settingsPage, - googleAccountTwo, - }) => { - console.log( - `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, - ) - await homePage.gotToRegisterPage() - await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here - await authPage.signInToGoogleAccount( - googleAccountTwo.email, - googleAccountTwo.display_name, - googleAccountTwo.username, - ) - await onboardingPage.clickSkipOnboardingButton() - await signUpPage.fillDisplayName(googleAccountTwo.display_name) - await signUpPage.fillUsername(googleAccountTwo.username) - await signUpPage.clickNextButton() - await signUpPage.clickNextButton() //Skip optional information - await profilePage.clickCloseButton() - await onboardingPage.clickRefineProfileButton() + test('should successfully delete an account created via google auth', async ({ + homePage, + onboardingPage, + signUpPage, + authPage, + profilePage, + settingsPage, + googleAccountTwo, + }) => { + console.log( + `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, + ) + await homePage.gotToRegisterPage() + await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here + await authPage.signInToGoogleAccount( + googleAccountTwo.email, + googleAccountTwo.display_name, + googleAccountTwo.username, + ) + await onboardingPage.clickSkipOnboardingButton() + await signUpPage.fillDisplayName(googleAccountTwo.display_name) + await signUpPage.fillUsername(googleAccountTwo.username) + await signUpPage.clickNextButton() + await signUpPage.clickNextButton() //Skip optional information + await profilePage.clickCloseButton() + await onboardingPage.clickRefineProfileButton() - //Verify displayed information is correct - await profilePage.verifyDisplayName(googleAccountTwo.display_name) + //Verify displayed information is correct + await profilePage.verifyDisplayName(googleAccountTwo.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountTwo) + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountTwo) - await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) - await expect(dbInfo.user.username).toContain(googleAccountTwo.username) + await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) + await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() - }) + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey('Delete me') + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) test('should successfully enter optional information after completing flow', async ({ app, @@ -347,15 +347,15 @@ test.describe('when given valid input', () => { fakerAccount.age, ) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - await expect(dbInfo.profile.gender).toEqual(fakerAccount.gender?.[1]) - await expect(String(dbInfo.profile.age)).toEqual(fakerAccount.age) - await expect(dbInfo.profile.height_in_inches).toEqual(Number(fakerAccount.height?.feet) * 12) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + await expect(dbInfo.profile.gender).toEqual(fakerAccount.gender?.[1]) + await expect(String(dbInfo.profile.age)).toEqual(fakerAccount.age) + await expect(dbInfo.profile.height_in_inches).toEqual(Number(fakerAccount.height?.feet) * 12) + }) test('should successfully use the start answering option', async ({ app, @@ -380,12 +380,12 @@ test.describe('when given valid input', () => { await app.profile.verifyDisplayName(fakerAccount.display_name) await app.profile.verifyCompatibilityAnswers(compatTwoQuestionOne) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test.describe('should successfully complete the onboarding flow after using the back button', () => { test("the first time it's an option", async ({app, fakerAccount}) => { @@ -405,12 +405,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test("the second time it's an option", async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) @@ -429,14 +429,14 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) }) }) -}) // test.describe('when an error occurs', () => { // test('placeholder', async ({}) => {}) From 42d28da29963aef1800732deb6464d9d20bc4a59 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 16:58:26 +0100 Subject: [PATCH 17/49] . --- .env.test | 5 ++++- playwright.config.ts | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.env.test b/.env.test index 517612ef..447439e3 100644 --- a/.env.test +++ b/.env.test @@ -16,4 +16,7 @@ NEXT_PUBLIC_FIREBASE_EMULATOR=true NODE_ENV=test PORT=8088 -ENVIRONMENT=DEV \ No newline at end of file +ENVIRONMENT=DEV + +# Playwright +DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT=true \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts index 4d0416a5..2522ddeb 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -25,10 +25,12 @@ function getSupabaseEnv() { } } -const supabaseEnv = getSupabaseEnv() - -// Inject into process.env so Playwright and your app code can read them -// Object.assign(process.env, supabaseEnv) +if (process.env.DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT !== 'true') { + 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', From ca42cfc26c895702a9c6dc649758641183094036 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 17:00:33 +0100 Subject: [PATCH 18/49] . --- playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright.config.ts b/playwright.config.ts index 2522ddeb..59ab836c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -25,7 +25,7 @@ function getSupabaseEnv() { } } -if (process.env.DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT !== 'true') { +if (process.env.DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT !== 'false') { const supabaseEnv = getSupabaseEnv() // Inject into process.env so Playwright and your app code can read them From 27ef668f194c90c05961be1eaef71895d1b7cf92 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 17:02:56 +0100 Subject: [PATCH 19/49] . --- .env.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.test b/.env.test index 447439e3..cb1fcaa3 100644 --- a/.env.test +++ b/.env.test @@ -19,4 +19,4 @@ PORT=8088 ENVIRONMENT=DEV # Playwright -DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT=true \ No newline at end of file +DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT=false \ No newline at end of file From b3e3413620c0712bee043941d74a78b2d1ba33c0 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 23:10:31 +0100 Subject: [PATCH 20/49] Coderabbitai fix's --- playwright.config.ts | 2 +- tests/e2e/web/specs/onboardingFlow.spec.ts | 332 ++++++++++----------- 2 files changed, 167 insertions(+), 167 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index 59ab836c..cfc503d9 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -27,7 +27,7 @@ function getSupabaseEnv() { if (process.env.DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT !== 'false') { const supabaseEnv = getSupabaseEnv() - + // Inject into process.env so Playwright and your app code can read them Object.assign(process.env, supabaseEnv) } diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 7df2d9fe..a9a5cc5c 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -129,89 +129,89 @@ test.describe('when given valid input', () => { await app.profile.verifyBio(onboardingAccount.bio) await app.profile.verifyCompatibilityAnswers(compatQuestionOne) - //Verify Database Information - const dbInfo = await userInformationFromDb(onboardingAccount) - console.log(dbInfo.profile) - - await expect(dbInfo.user.name).toBe(onboardingAccount.display_name) - await expect(dbInfo.user.username).toBe(onboardingAccount.username) - await expect(dbInfo.profile.bio_text).toBe(onboardingAccount.bio) - await expect(dbInfo.profile.gender).toEqual(onboardingAccount.gender?.[1]) - await expect(dbInfo.profile.headline).toEqual(onboardingAccount.headline) - await expect(dbInfo.profile.keywords).toEqual( - expect.arrayContaining(onboardingAccount.keywords?.split(', ') ?? []), - ) - await expect(String(dbInfo.profile.age)).toEqual(onboardingAccount.age) - await expect(dbInfo.profile.height_in_inches).toEqual( - Number(onboardingAccount.height?.feet) * 12, - ) - await expect(dbInfo.profile.ethnicity).toContain(onboardingAccount.ethnicity_origin?.[1]) - await expect(dbInfo.profile.pref_gender).toContain(onboardingAccount.interested_in?.[1]) - await expect(String(dbInfo.profile.pref_age_min)).toContain( - onboardingAccount.Interested_in_ages?.min, - ) - await expect(String(dbInfo.profile.pref_age_max)).toContain( - onboardingAccount.Interested_in_ages?.max, - ) - await expect(dbInfo.profile.pref_relation_styles).toContain( - `${onboardingAccount.connection_type?.[1]}`.toLowerCase(), - ) - await expect(dbInfo.profile.relationship_status).toContain( - onboardingAccount.relationship_status?.[1], - ) - await expect(dbInfo.profile.pref_romantic_styles).toContain( - onboardingAccount.relationship_style?.[1], - ) - await expect(dbInfo.profile.has_kids).toEqual(Number(onboardingAccount.number_of_kids)) - await expect(dbInfo.profile.wants_kids_strength).toEqual( - onboardingAccount.children_expectation?.[1], - ) - await expect(dbInfo.profile.education_level).toContain( - `${onboardingAccount.education_level?.[1]}`.toLowerCase(), - ) - await expect(dbInfo.profile.university).toContain(onboardingAccount.university) - await expect(dbInfo.profile.occupation_title).toContain(onboardingAccount.job_title) - await expect(dbInfo.profile.company).toContain(onboardingAccount.company) - await expect(dbInfo.profile.political_beliefs).toContain( - onboardingAccount.beliefs?.political?.belief?.[1], - ) - await expect(dbInfo.profile.political_details).toContain( - onboardingAccount.beliefs?.political?.details, - ) - await expect(dbInfo.profile.religion).toContain( - onboardingAccount.beliefs?.religious?.belief?.[1], - ) - await expect(dbInfo.profile.religious_beliefs).toContain( - onboardingAccount.beliefs?.religious?.details, - ) - await expect(dbInfo.profile.mbti).toContain( - `${onboardingAccount.personality_type}`.toLowerCase(), - ) - await expect(dbInfo.profile.big5_openness).toEqual( - onboardingAccount.big_five_personality_traits?.openness, - ) - await expect(dbInfo.profile.big5_conscientiousness).toEqual( - onboardingAccount.big_five_personality_traits?.conscientiousness, - ) - await expect(dbInfo.profile.big5_extraversion).toEqual( - onboardingAccount.big_five_personality_traits?.extraversion, - ) - await expect(dbInfo.profile.big5_agreeableness).toEqual( - onboardingAccount.big_five_personality_traits?.agreeableness, - ) - await expect(dbInfo.profile.big5_neuroticism).toEqual( - onboardingAccount.big_five_personality_traits?.neuroticism, - ) - await expect(dbInfo.profile.diet).toContain(onboardingAccount.diet?.[1].toLowerCase()) - await expect(dbInfo.profile.is_smoker).toEqual(onboardingAccount.is_smoker) - await expect(dbInfo.profile.languages).toHaveLength(2) - await expect(dbInfo.profile.languages).toEqual( - expect.arrayContaining(onboardingAccount.languages?.map(([_, l]) => l.toLowerCase()) ?? []), - ) - await expect(String(dbInfo.profile.drinks_per_month)).toEqual( - onboardingAccount.alcohol_consumed_per_month, - ) - }) + //Verify Database Information + const dbInfo = await userInformationFromDb(onboardingAccount) + console.log(dbInfo.profile) + + await expect(dbInfo.user.name).toBe(onboardingAccount.display_name) + await expect(dbInfo.user.username).toBe(onboardingAccount.username) + await expect(dbInfo.profile.bio_text).toBe(onboardingAccount.bio) + await expect(dbInfo.profile.gender).toEqual(onboardingAccount.gender?.[1]) + await expect(dbInfo.profile.headline).toEqual(onboardingAccount.headline) + await expect(dbInfo.profile.keywords).toEqual( + expect.arrayContaining(onboardingAccount.keywords?.split(', ') ?? []), + ) + await expect(String(dbInfo.profile.age)).toEqual(onboardingAccount.age) + await expect(dbInfo.profile.height_in_inches).toEqual( + Number(onboardingAccount.height?.feet) * 12, + ) + await expect(dbInfo.profile.ethnicity).toContain(onboardingAccount.ethnicity_origin?.[1]) + await expect(dbInfo.profile.pref_gender).toContain(onboardingAccount.interested_in?.[1]) + await expect(String(dbInfo.profile.pref_age_min)).toContain( + onboardingAccount.Interested_in_ages?.min, + ) + await expect(String(dbInfo.profile.pref_age_max)).toContain( + onboardingAccount.Interested_in_ages?.max, + ) + await expect(dbInfo.profile.pref_relation_styles).toContain( + `${onboardingAccount.connection_type?.[1]}`.toLowerCase(), + ) + await expect(dbInfo.profile.relationship_status).toContain( + onboardingAccount.relationship_status?.[1], + ) + await expect(dbInfo.profile.pref_romantic_styles).toContain( + onboardingAccount.relationship_style?.[1], + ) + await expect(dbInfo.profile.has_kids).toEqual(Number(onboardingAccount.number_of_kids)) + await expect(dbInfo.profile.wants_kids_strength).toEqual( + onboardingAccount.children_expectation?.[1], + ) + await expect(dbInfo.profile.education_level).toContain( + `${onboardingAccount.education_level?.[1]}`.toLowerCase(), + ) + await expect(dbInfo.profile.university).toContain(onboardingAccount.university) + await expect(dbInfo.profile.occupation_title).toContain(onboardingAccount.job_title) + await expect(dbInfo.profile.company).toContain(onboardingAccount.company) + await expect(dbInfo.profile.political_beliefs).toContain( + onboardingAccount.beliefs?.political?.belief?.[1], + ) + await expect(dbInfo.profile.political_details).toContain( + onboardingAccount.beliefs?.political?.details, + ) + await expect(dbInfo.profile.religion).toContain( + onboardingAccount.beliefs?.religious?.belief?.[1], + ) + await expect(dbInfo.profile.religious_beliefs).toContain( + onboardingAccount.beliefs?.religious?.details, + ) + await expect(dbInfo.profile.mbti).toContain( + `${onboardingAccount.personality_type}`.toLowerCase(), + ) + await expect(dbInfo.profile.big5_openness).toEqual( + onboardingAccount.big_five_personality_traits?.openness, + ) + await expect(dbInfo.profile.big5_conscientiousness).toEqual( + onboardingAccount.big_five_personality_traits?.conscientiousness, + ) + await expect(dbInfo.profile.big5_extraversion).toEqual( + onboardingAccount.big_five_personality_traits?.extraversion, + ) + await expect(dbInfo.profile.big5_agreeableness).toEqual( + onboardingAccount.big_five_personality_traits?.agreeableness, + ) + await expect(dbInfo.profile.big5_neuroticism).toEqual( + onboardingAccount.big_five_personality_traits?.neuroticism, + ) + await expect(dbInfo.profile.diet).toContain(onboardingAccount.diet?.[1].toLowerCase()) + await expect(dbInfo.profile.is_smoker).toEqual(onboardingAccount.is_smoker) + await expect(dbInfo.profile.languages).toHaveLength(2) + await expect(dbInfo.profile.languages).toEqual( + expect.arrayContaining(onboardingAccount.languages?.map(([_, l]) => l.toLowerCase()) ?? []), + ) + await expect(String(dbInfo.profile.drinks_per_month)).toEqual( + onboardingAccount.alcohol_consumed_per_month, + ) + }) test('should successfully complete the onboarding flow with google account', async ({ app, @@ -230,12 +230,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(googleAccountOne.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountOne) + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountOne) - await expect(dbInfo.user.name).toContain(googleAccountOne.display_name) - await expect(dbInfo.user.username).toContain(googleAccountOne.username) - }) + await expect(dbInfo.user.name).toContain(googleAccountOne.display_name) + await expect(dbInfo.user.username).toContain(googleAccountOne.username) + }) test('should successfully skip the onboarding flow', async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) @@ -244,12 +244,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test('should successfully delete an account created via email and password', async ({ homePage, @@ -263,64 +263,64 @@ test.describe('when given valid input', () => { await registerWithEmail(homePage, authPage, fakerAccount) await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, fakerAccount) - //Verify displayed information is correct - await profilePage.verifyDisplayName(fakerAccount.display_name) + //Verify displayed information is correct + await profilePage.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() - }) + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey('Delete me') + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) - test('should successfully delete an account created via google auth', async ({ - homePage, - onboardingPage, - signUpPage, - authPage, - profilePage, - settingsPage, - googleAccountTwo, - }) => { - console.log( - `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, - ) - await homePage.gotToRegisterPage() - await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here - await authPage.signInToGoogleAccount( - googleAccountTwo.email, - googleAccountTwo.display_name, - googleAccountTwo.username, - ) - await onboardingPage.clickSkipOnboardingButton() - await signUpPage.fillDisplayName(googleAccountTwo.display_name) - await signUpPage.fillUsername(googleAccountTwo.username) - await signUpPage.clickNextButton() - await signUpPage.clickNextButton() //Skip optional information - await profilePage.clickCloseButton() - await onboardingPage.clickRefineProfileButton() + test('should successfully delete an account created via google auth', async ({ + homePage, + onboardingPage, + signUpPage, + authPage, + profilePage, + settingsPage, + googleAccountTwo, + }) => { + console.log( + `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, + ) + await homePage.goToRegisterPage() + await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here + await authPage.signInToGoogleAccount( + googleAccountTwo.email, + googleAccountTwo.display_name, + googleAccountTwo.username, + ) + await onboardingPage.clickSkipOnboardingButton() + await signUpPage.fillDisplayName(googleAccountTwo.display_name) + await signUpPage.fillUsername(googleAccountTwo.username) + await signUpPage.clickNextButton() + await signUpPage.clickNextButton() //Skip optional information + await profilePage.clickCloseButton() + await onboardingPage.clickRefineProfileButton() - //Verify displayed information is correct - await profilePage.verifyDisplayName(googleAccountTwo.display_name) + //Verify displayed information is correct + await profilePage.verifyDisplayName(googleAccountTwo.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountTwo) + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountTwo) - await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) - await expect(dbInfo.user.username).toContain(googleAccountTwo.username) + await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) + await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() - }) + await homePage.clickSettingsLink() + await settingsPage.clickDeleteAccountButton() + await settingsPage.fillDeleteAccountSurvey('Delete me') + await settingsPage.clickDeleteAccountButton() + await homePage.verifyHomePageLinks() + }) test('should successfully enter optional information after completing flow', async ({ app, @@ -347,15 +347,15 @@ test.describe('when given valid input', () => { fakerAccount.age, ) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - await expect(dbInfo.profile.gender).toEqual(fakerAccount.gender?.[1]) - await expect(String(dbInfo.profile.age)).toEqual(fakerAccount.age) - await expect(dbInfo.profile.height_in_inches).toEqual(Number(fakerAccount.height?.feet) * 12) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + await expect(dbInfo.profile.gender).toEqual(fakerAccount.gender?.[1]) + await expect(String(dbInfo.profile.age)).toEqual(fakerAccount.age) + await expect(dbInfo.profile.height_in_inches).toEqual(Number(fakerAccount.height?.feet) * 12) + }) test('should successfully use the start answering option', async ({ app, @@ -380,12 +380,12 @@ test.describe('when given valid input', () => { await app.profile.verifyDisplayName(fakerAccount.display_name) await app.profile.verifyCompatibilityAnswers(compatTwoQuestionOne) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test.describe('should successfully complete the onboarding flow after using the back button', () => { test("the first time it's an option", async ({app, fakerAccount}) => { @@ -405,12 +405,12 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + }) test("the second time it's an option", async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) @@ -429,14 +429,14 @@ test.describe('when given valid input', () => { //Verify displayed information is correct await app.profile.verifyDisplayName(fakerAccount.display_name) - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - }) + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) }) }) +}) // test.describe('when an error occurs', () => { // test('placeholder', async ({}) => {}) From 6e7cd77d072ccdea70f2ce72f71dbc2b0a785058 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 3 Apr 2026 16:21:16 +0200 Subject: [PATCH 21/49] Fix --- .env.test | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.test b/.env.test index cb1fcaa3..517612ef 100644 --- a/.env.test +++ b/.env.test @@ -16,7 +16,4 @@ NEXT_PUBLIC_FIREBASE_EMULATOR=true NODE_ENV=test PORT=8088 -ENVIRONMENT=DEV - -# Playwright -DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT=false \ No newline at end of file +ENVIRONMENT=DEV \ No newline at end of file From 7daf458001b1aa59d25cf24b991ca1c37ad60027 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 3 Apr 2026 16:55:28 +0200 Subject: [PATCH 22/49] Improve test utilities and stabilize onboarding flow tests --- tests/e2e/web/pages/authPage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/web/pages/authPage.ts b/tests/e2e/web/pages/authPage.ts index c4f82b94..e1874122 100644 --- a/tests/e2e/web/pages/authPage.ts +++ b/tests/e2e/web/pages/authPage.ts @@ -56,7 +56,7 @@ export class AuthPage { if (display_name) await popup.getByLabel('Display name').fill(display_name) if (username) await popup.getByLabel('Screen name', {exact: true}).fill(username) await Promise.all([ - popup.waitForEvent('close'), + // popup.waitForEvent('close'), popup.getByText('Sign in with Google.com', {exact: true}).click(), ]) } From 1d898f34fcce78ef779b8d91952531735feaf947 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Fri, 3 Apr 2026 20:57:40 +0100 Subject: [PATCH 23/49] Changes requested --- playwright.config.ts | 9 ++++---- tests/e2e/web/pages/authPage.ts | 6 ++---- tests/e2e/web/specs/onboardingFlow.spec.ts | 24 ++++++---------------- tests/e2e/web/utils/deleteUser.ts | 17 ++++++++++----- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index cfc503d9..a2a6726c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -25,12 +25,11 @@ function getSupabaseEnv() { } } -if (process.env.DIRECT_SUPABASE_SETUP_IN_PLAYWRIGHT !== 'false') { - const supabaseEnv = getSupabaseEnv() - // Inject into process.env so Playwright and your app code can read them - Object.assign(process.env, supabaseEnv) -} +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', diff --git a/tests/e2e/web/pages/authPage.ts b/tests/e2e/web/pages/authPage.ts index e1874122..7bccdf38 100644 --- a/tests/e2e/web/pages/authPage.ts +++ b/tests/e2e/web/pages/authPage.ts @@ -55,10 +55,8 @@ export class AuthPage { await popup.getByLabel('Email').fill(email) if (display_name) await popup.getByLabel('Display name').fill(display_name) if (username) await popup.getByLabel('Screen name', {exact: true}).fill(username) - await Promise.all([ - // popup.waitForEvent('close'), - popup.getByText('Sign in with Google.com', {exact: true}).click(), - ]) + await popup.getByText('Sign in with Google.com', {exact: true}).click() + await popup.waitForEvent('close') } async clickSignUpWithEmailButton() { diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index a9a5cc5c..3f49f522 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -212,7 +212,7 @@ test.describe('when given valid input', () => { onboardingAccount.alcohol_consumed_per_month, ) }) - + test('should successfully complete the onboarding flow with google account', async ({ app, googleAccountOne, @@ -272,11 +272,7 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.name).toContain(fakerAccount.display_name) await expect(dbInfo.user.username).toContain(fakerAccount.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() + await deleteProfileFromSettings(homePage, settingsPage) }) test('should successfully delete an account created via google auth', async ({ @@ -287,10 +283,12 @@ test.describe('when given valid input', () => { profilePage, settingsPage, googleAccountTwo, + headless, }) => { console.log( `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, ) + test.skip(headless, 'Google popup auth test requires headed mode') await homePage.goToRegisterPage() await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here await authPage.signInToGoogleAccount( @@ -298,13 +296,7 @@ test.describe('when given valid input', () => { googleAccountTwo.display_name, googleAccountTwo.username, ) - await onboardingPage.clickSkipOnboardingButton() - await signUpPage.fillDisplayName(googleAccountTwo.display_name) - await signUpPage.fillUsername(googleAccountTwo.username) - await signUpPage.clickNextButton() - await signUpPage.clickNextButton() //Skip optional information - await profilePage.clickCloseButton() - await onboardingPage.clickRefineProfileButton() + await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, googleAccountTwo) //Verify displayed information is correct await profilePage.verifyDisplayName(googleAccountTwo.display_name) @@ -315,11 +307,7 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - await homePage.clickSettingsLink() - await settingsPage.clickDeleteAccountButton() - await settingsPage.fillDeleteAccountSurvey('Delete me') - await settingsPage.clickDeleteAccountButton() - await homePage.verifyHomePageLinks() + await deleteProfileFromSettings(homePage, settingsPage) }) test('should successfully enter optional information after completing flow', async ({ diff --git a/tests/e2e/web/utils/deleteUser.ts b/tests/e2e/web/utils/deleteUser.ts index d7376fe3..ed088fac 100644 --- a/tests/e2e/web/utils/deleteUser.ts +++ b/tests/e2e/web/utils/deleteUser.ts @@ -1,5 +1,5 @@ -import {deleteFromDb} from '../../utils/databaseUtils' -import {deleteAccount, firebaseLoginEmailPassword} from '../../utils/firebaseUtils' +import {deleteFromDb, userInformationFromDb} from '../../utils/databaseUtils' +import {deleteAccount, firebaseLoginEmailPassword, findUser} from '../../utils/firebaseUtils' import {UserAccountInformation} from './accountInformation' import {AuthObject} from './networkUtils' @@ -13,9 +13,16 @@ export async function deleteUser( let loginInfo if (authType === 'Email/Password') { loginInfo = await firebaseLoginEmailPassword(account?.email, account?.password) - await deleteAccount(loginInfo?.data.idToken) - await deleteFromDb(loginInfo?.data.localId) - } else if (authType === 'Google' && authInfo) { + try { + await deleteAccount(loginInfo?.data.idToken) + const userDbCheck = await userInformationFromDb(account) + if (userDbCheck) { + await deleteFromDb(loginInfo?.data.localId) + } + } catch (dbError) {} + }else if (authType === 'Google' && authInfo) { + const googleAuthUser = await findUser(authInfo.idToken) + if (!googleAuthUser) return await deleteAccount(authInfo.idToken) await deleteFromDb(authInfo.localId) } From ce0c7cd8905d1d2a2b541b470b8773533d107245 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sat, 4 Apr 2026 19:17:45 +0100 Subject: [PATCH 24/49] Changed POM/Fixture structure to use an app class to instantiate the page objects --- tests/e2e/web/specs/onboardingFlow.spec.ts | 59 ---------------------- 1 file changed, 59 deletions(-) diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 3f49f522..9a3561be 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -251,65 +251,6 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(fakerAccount.username) }) - test('should successfully delete an account created via email and password', async ({ - homePage, - onboardingPage, - signUpPage, - authPage, - profilePage, - settingsPage, - fakerAccount, - }) => { - await registerWithEmail(homePage, authPage, fakerAccount) - await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, fakerAccount) - - //Verify displayed information is correct - await profilePage.verifyDisplayName(fakerAccount.display_name) - - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) - - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - - await deleteProfileFromSettings(homePage, settingsPage) - }) - - test('should successfully delete an account created via google auth', async ({ - homePage, - onboardingPage, - signUpPage, - authPage, - profilePage, - settingsPage, - googleAccountTwo, - headless, - }) => { - console.log( - `Starting "should successfully delete an account created via google auth" with ${googleAccountTwo.username}`, - ) - test.skip(headless, 'Google popup auth test requires headed mode') - await homePage.goToRegisterPage() - await authPage.fillPasswordField('') //The test only passes when this is added...something is weird here - await authPage.signInToGoogleAccount( - googleAccountTwo.email, - googleAccountTwo.display_name, - googleAccountTwo.username, - ) - await skipOnboardingHeadToProfile(onboardingPage, signUpPage, profilePage, googleAccountTwo) - - //Verify displayed information is correct - await profilePage.verifyDisplayName(googleAccountTwo.display_name) - - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountTwo) - - await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) - await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - - await deleteProfileFromSettings(homePage, settingsPage) - }) - test('should successfully enter optional information after completing flow', async ({ app, fakerAccount, From fae4fd7dae0edcaa8d19c021481e75656816a8e8 Mon Sep 17 00:00:00 2001 From: Martin Braquet Date: Sat, 4 Apr 2026 20:37:38 +0200 Subject: [PATCH 25/49] Apply suggestion from @MartinBraquet --- playwright.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/playwright.config.ts b/playwright.config.ts index a2a6726c..ec94cf50 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -25,7 +25,6 @@ function getSupabaseEnv() { } } - const supabaseEnv = getSupabaseEnv() // Inject into process.env so Playwright and your app code can read them From 6e1b84662a9d335fc8aca43133c34c2d38e61e99 Mon Sep 17 00:00:00 2001 From: Martin Braquet Date: Sat, 4 Apr 2026 20:38:36 +0200 Subject: [PATCH 26/49] Delete .vscode/settings.json --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index db1ed83a..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "codium.codeCompletion.enable": false -} \ No newline at end of file From 90c3f22a2c5f4db783a49ed3e4c3cafc6b082b13 Mon Sep 17 00:00:00 2001 From: Martin Braquet Date: Sat, 4 Apr 2026 20:43:22 +0200 Subject: [PATCH 27/49] Apply suggestion from @MartinBraquet --- tests/e2e/web/utils/deleteUser.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/e2e/web/utils/deleteUser.ts b/tests/e2e/web/utils/deleteUser.ts index ed088fac..5aa6a965 100644 --- a/tests/e2e/web/utils/deleteUser.ts +++ b/tests/e2e/web/utils/deleteUser.ts @@ -13,16 +13,9 @@ export async function deleteUser( let loginInfo if (authType === 'Email/Password') { loginInfo = await firebaseLoginEmailPassword(account?.email, account?.password) - try { - await deleteAccount(loginInfo?.data.idToken) - const userDbCheck = await userInformationFromDb(account) - if (userDbCheck) { - await deleteFromDb(loginInfo?.data.localId) - } - } catch (dbError) {} - }else if (authType === 'Google' && authInfo) { - const googleAuthUser = await findUser(authInfo.idToken) - if (!googleAuthUser) return + await deleteAccount(loginInfo?.data.idToken) + await deleteFromDb(loginInfo?.data.localId) + } else if (authType === 'Google' && authInfo) { await deleteAccount(authInfo.idToken) await deleteFromDb(authInfo.localId) } From 3918830fb6a7e419a0bf73de8a1fadffb0eecb4c Mon Sep 17 00:00:00 2001 From: Martin Braquet Date: Sat, 4 Apr 2026 20:54:03 +0200 Subject: [PATCH 28/49] Apply suggestion from @MartinBraquet --- tests/e2e/web/utils/deleteUser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/web/utils/deleteUser.ts b/tests/e2e/web/utils/deleteUser.ts index 5aa6a965..a2cc229f 100644 --- a/tests/e2e/web/utils/deleteUser.ts +++ b/tests/e2e/web/utils/deleteUser.ts @@ -13,7 +13,7 @@ export async function deleteUser( let loginInfo if (authType === 'Email/Password') { loginInfo = await firebaseLoginEmailPassword(account?.email, account?.password) - await deleteAccount(loginInfo?.data.idToken) + await deleteAccount(loginInfo?.data.idToken) await deleteFromDb(loginInfo?.data.localId) } else if (authType === 'Google' && authInfo) { await deleteAccount(authInfo.idToken) From d6c2b032b02b37204486f7f71702ef0b21144b1a Mon Sep 17 00:00:00 2001 From: Martin Braquet Date: Sat, 4 Apr 2026 20:55:14 +0200 Subject: [PATCH 29/49] Apply suggestion from @MartinBraquet --- tests/e2e/web/utils/deleteUser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/web/utils/deleteUser.ts b/tests/e2e/web/utils/deleteUser.ts index a2cc229f..d7376fe3 100644 --- a/tests/e2e/web/utils/deleteUser.ts +++ b/tests/e2e/web/utils/deleteUser.ts @@ -1,5 +1,5 @@ -import {deleteFromDb, userInformationFromDb} from '../../utils/databaseUtils' -import {deleteAccount, firebaseLoginEmailPassword, findUser} from '../../utils/firebaseUtils' +import {deleteFromDb} from '../../utils/databaseUtils' +import {deleteAccount, firebaseLoginEmailPassword} from '../../utils/firebaseUtils' import {UserAccountInformation} from './accountInformation' import {AuthObject} from './networkUtils' From 19e65cbe6c842d52dbb81fd5d120389dda217dc5 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sat, 4 Apr 2026 19:57:07 +0100 Subject: [PATCH 30/49] Linting and Prettier --- tests/e2e/web/specs/onboardingFlow.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 9a3561be..0466074c 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -212,7 +212,7 @@ test.describe('when given valid input', () => { onboardingAccount.alcohol_consumed_per_month, ) }) - + test('should successfully complete the onboarding flow with google account', async ({ app, googleAccountOne, From ede380a4e0c8491cfeb91f868a8a857d46a356c3 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Mon, 11 May 2026 13:11:47 +0100 Subject: [PATCH 31/49] Updated People page --- tests/e2e/web/specs/onboardingFlow.spec.ts | 15 ++++-- tests/e2e/web/specs/signIn.spec.ts | 61 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 0466074c..97fba1fd 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -237,7 +237,10 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(googleAccountOne.username) }) - test('should successfully skip the onboarding flow', async ({app, fakerAccount}) => { + test('should successfully skip the onboarding flow', async ({ + app, + fakerAccount + }) => { await app.registerWithEmail(fakerAccount) await app.skipOnboardingHeadToProfile(fakerAccount) @@ -317,7 +320,10 @@ test.describe('when given valid input', () => { }) test.describe('should successfully complete the onboarding flow after using the back button', () => { - test("the first time it's an option", async ({app, fakerAccount}) => { + test("the first time it's an option", async ({ + app, + fakerAccount + }) => { await app.registerWithEmail(fakerAccount) await app.onboarding.clickContinueButton() await app.onboarding.clickBackButton() @@ -341,7 +347,10 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(fakerAccount.username) }) - test("the second time it's an option", async ({app, fakerAccount}) => { + test("the second time it's an option", async ({ + app, + fakerAccount + }) => { await app.registerWithEmail(fakerAccount) await app.onboarding.clickContinueButton() await app.onboarding.clickContinueButton() diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index a4d16533..fb2b779b 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -3,11 +3,72 @@ import {expect, test} from '../fixtures/signInFixture' test.describe('when given valid input', () => { test('should be able to sign in to an available account', async ({ app, +<<<<<<< HEAD signedOutAccount: account, }) => { await app.signinWithEmail(account) await app.home.goToHomePage() await app.home.verifySignedInHomePage(account.display_name) +======= + dev_one_account + }) => { + await app.signinWithEmail(dev_one_account) + await app.home.goToHomePage() + await app.home.verifySignedInHomePage(dev_one_account.display_name) + }) + + // test('Trial', async ({ + // app, + // dev_one_account + // }) => { + // await app.signinWithEmail(dev_one_account) + // await app.home.clickPeopleLink() + // }) + + test('should successfully delete an account created via email and password', async ({ + app, + signedOutAccount: account, + }) => { + await app.registerWithEmail(fakerAccount) + await app.skipOnboardingHeadToProfile(fakerAccount) + + //Verify displayed information is correct + await app.profile.verifyDisplayName(fakerAccount.display_name) + + //Verify database info + const dbInfo = await userInformationFromDb(fakerAccount) + + await expect(dbInfo.user.name).toContain(fakerAccount.display_name) + await expect(dbInfo.user.username).toContain(fakerAccount.username) + + await app.deleteProfileFromSettings() + }) + + test('should successfully delete an account created via google auth', async ({ + app, + googleAccountTwo, + headless, + }) => { + test.skip(headless, 'Google popup auth test requires headed mode') + await app.home.goToRegisterPage() + await app.auth.signInToGoogleAccount( + googleAccountTwo.email, + googleAccountTwo.display_name, + googleAccountTwo.username, + ) + await app.skipOnboardingHeadToProfile(googleAccountTwo) + + //Verify displayed information is correct + await app.profile.verifyDisplayName(googleAccountTwo.display_name) + + //Verify database info + const dbInfo = await userInformationFromDb(googleAccountTwo) + + await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) + await expect(dbInfo.user.username).toContain(googleAccountTwo.username) + + await app.deleteProfileFromSettings() +>>>>>>> 35402a77 (Updated People page) }) test('the profile count should update successfully when applying a filter', async ({ From 9bf34a5cf7e7f4329f1fae95b495bc7619d2395c Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Mon, 11 May 2026 13:32:14 +0100 Subject: [PATCH 32/49] Fix app.ts --- tests/e2e/web/specs/signIn.spec.ts | 67 ++---------------------------- 1 file changed, 3 insertions(+), 64 deletions(-) diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index fb2b779b..7537d21a 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -3,72 +3,11 @@ import {expect, test} from '../fixtures/signInFixture' test.describe('when given valid input', () => { test('should be able to sign in to an available account', async ({ app, -<<<<<<< HEAD - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.goToHomePage() - await app.home.verifySignedInHomePage(account.display_name) -======= - dev_one_account + signedOutAccount, }) => { - await app.signinWithEmail(dev_one_account) + await app.signinWithEmail(signedOutAccount) await app.home.goToHomePage() - await app.home.verifySignedInHomePage(dev_one_account.display_name) - }) - - // test('Trial', async ({ - // app, - // dev_one_account - // }) => { - // await app.signinWithEmail(dev_one_account) - // await app.home.clickPeopleLink() - // }) - - test('should successfully delete an account created via email and password', async ({ - app, - signedOutAccount: account, - }) => { - await app.registerWithEmail(fakerAccount) - await app.skipOnboardingHeadToProfile(fakerAccount) - - //Verify displayed information is correct - await app.profile.verifyDisplayName(fakerAccount.display_name) - - //Verify database info - const dbInfo = await userInformationFromDb(fakerAccount) - - await expect(dbInfo.user.name).toContain(fakerAccount.display_name) - await expect(dbInfo.user.username).toContain(fakerAccount.username) - - await app.deleteProfileFromSettings() - }) - - test('should successfully delete an account created via google auth', async ({ - app, - googleAccountTwo, - headless, - }) => { - test.skip(headless, 'Google popup auth test requires headed mode') - await app.home.goToRegisterPage() - await app.auth.signInToGoogleAccount( - googleAccountTwo.email, - googleAccountTwo.display_name, - googleAccountTwo.username, - ) - await app.skipOnboardingHeadToProfile(googleAccountTwo) - - //Verify displayed information is correct - await app.profile.verifyDisplayName(googleAccountTwo.display_name) - - //Verify database info - const dbInfo = await userInformationFromDb(googleAccountTwo) - - await expect(dbInfo.user.name).toContain(googleAccountTwo.display_name) - await expect(dbInfo.user.username).toContain(googleAccountTwo.username) - - await app.deleteProfileFromSettings() ->>>>>>> 35402a77 (Updated People page) + await app.home.verifySignedInHomePage(signedOutAccount.display_name) }) test('the profile count should update successfully when applying a filter', async ({ From c1dacbd331704764fac06e27821d7c01888db493 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Tue, 12 May 2026 18:48:32 +0100 Subject: [PATCH 33/49] Updated peoplePage.ts: continued adding functions to use filters Updated filters.tsx: added data testid --- tests/e2e/web/specs/signIn.spec.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 7537d21a..2d4c2b2f 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -3,11 +3,11 @@ import {expect, test} from '../fixtures/signInFixture' test.describe('when given valid input', () => { test('should be able to sign in to an available account', async ({ app, - signedOutAccount, + signedOutAccount: account, }) => { - await app.signinWithEmail(signedOutAccount) + await app.signinWithEmail(account) await app.home.goToHomePage() - await app.home.verifySignedInHomePage(signedOutAccount.display_name) + await app.home.verifySignedInHomePage(account.display_name) }) test('the profile count should update successfully when applying a filter', async ({ @@ -52,5 +52,13 @@ test.describe('when given invalid input', () => { }) test.describe('when an error occurs', () => { - test('placeholder', async () => {}) + test('placeholder', async () => { }) + test('Trial', async ({ + app, + signedOutAccount: account + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + await app.people.setDisplayFilter({cardSize: "Large", filters: [["Gender", true]]}) + }) }) From 492ee7a737debb74fe9adc43c7140f4d6525381f Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 2 Apr 2026 23:10:31 +0100 Subject: [PATCH 34/49] Coderabbitai fix's --- tests/e2e/web/pages/authPage.ts | 6 ++-- tests/e2e/web/utils/testCleanupHelpers.ts | 34 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/web/utils/testCleanupHelpers.ts diff --git a/tests/e2e/web/pages/authPage.ts b/tests/e2e/web/pages/authPage.ts index 7bccdf38..c4f82b94 100644 --- a/tests/e2e/web/pages/authPage.ts +++ b/tests/e2e/web/pages/authPage.ts @@ -55,8 +55,10 @@ export class AuthPage { await popup.getByLabel('Email').fill(email) if (display_name) await popup.getByLabel('Display name').fill(display_name) if (username) await popup.getByLabel('Screen name', {exact: true}).fill(username) - await popup.getByText('Sign in with Google.com', {exact: true}).click() - await popup.waitForEvent('close') + await Promise.all([ + popup.waitForEvent('close'), + popup.getByText('Sign in with Google.com', {exact: true}).click(), + ]) } async clickSignUpWithEmailButton() { diff --git a/tests/e2e/web/utils/testCleanupHelpers.ts b/tests/e2e/web/utils/testCleanupHelpers.ts new file mode 100644 index 00000000..cff9f47a --- /dev/null +++ b/tests/e2e/web/utils/testCleanupHelpers.ts @@ -0,0 +1,34 @@ +import {AuthPage} from '../pages/AuthPage' +import {HomePage} from '../pages/homePage' +import {UserAccountInformation} from '../utils/accountInformation' + +export async function registerWithEmail( + homePage: HomePage, + authPage: AuthPage, + account: UserAccountInformation, +) { + await homePage.goToRegisterPage() + await authPage.fillEmailField(account.email) + await authPage.fillPasswordField(account.password) + await authPage.clickSignUpWithEmailButton() +} + +export async function signinWithEmail( + homePage: HomePage, + authPage: AuthPage, + accountOrEmail: UserAccountInformation | string, + password?: string, +) { + const email = typeof accountOrEmail === 'string' ? accountOrEmail : accountOrEmail.email + + const resolvedPassword = typeof accountOrEmail === 'string' ? password : accountOrEmail.password + + if (!email || !resolvedPassword) { + throw new Error('Provide either an `account` or `email` and `password`.') + } + + await homePage.goToSigninPage() + await authPage.fillEmailField(email) + await authPage.fillPasswordField(resolvedPassword) + await authPage.clickSignInWithEmailButton() +} From 8a4aafb8b6c1645e5665705bfbae3b628534a25e Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Tue, 12 May 2026 18:59:26 +0100 Subject: [PATCH 35/49] . --- tests/e2e/web/utils/testCleanupHelpers.ts | 34 ----------------------- 1 file changed, 34 deletions(-) delete mode 100644 tests/e2e/web/utils/testCleanupHelpers.ts diff --git a/tests/e2e/web/utils/testCleanupHelpers.ts b/tests/e2e/web/utils/testCleanupHelpers.ts deleted file mode 100644 index cff9f47a..00000000 --- a/tests/e2e/web/utils/testCleanupHelpers.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {AuthPage} from '../pages/AuthPage' -import {HomePage} from '../pages/homePage' -import {UserAccountInformation} from '../utils/accountInformation' - -export async function registerWithEmail( - homePage: HomePage, - authPage: AuthPage, - account: UserAccountInformation, -) { - await homePage.goToRegisterPage() - await authPage.fillEmailField(account.email) - await authPage.fillPasswordField(account.password) - await authPage.clickSignUpWithEmailButton() -} - -export async function signinWithEmail( - homePage: HomePage, - authPage: AuthPage, - accountOrEmail: UserAccountInformation | string, - password?: string, -) { - const email = typeof accountOrEmail === 'string' ? accountOrEmail : accountOrEmail.email - - const resolvedPassword = typeof accountOrEmail === 'string' ? password : accountOrEmail.password - - if (!email || !resolvedPassword) { - throw new Error('Provide either an `account` or `email` and `password`.') - } - - await homePage.goToSigninPage() - await authPage.fillEmailField(email) - await authPage.fillPasswordField(resolvedPassword) - await authPage.clickSignInWithEmailButton() -} From ab72f172d3af5ea6ed940d1aa8b37866c65eff7e Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 20 May 2026 15:43:10 +0100 Subject: [PATCH 36/49] Updated People page Added data test attributes to search.tsx and profile-grid.tsx --- tests/e2e/web/specs/signIn.spec.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 2d4c2b2f..0b596b2d 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -45,20 +45,4 @@ test.describe('when given invalid input', () => { page.getByText('Failed to sign in with your email and password', {exact: true}), ).toBeVisible() }) - - test('login check', async ({}) => { - - }); -}) - -test.describe('when an error occurs', () => { - test('placeholder', async () => { }) - test('Trial', async ({ - app, - signedOutAccount: account - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - await app.people.setDisplayFilter({cardSize: "Large", filters: [["Gender", true]]}) - }) }) From 00a9a85ae2d3162a722efd617b6342151fb075fd Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 20 May 2026 15:45:57 +0100 Subject: [PATCH 37/49] Lint and Prettier --- tests/e2e/web/specs/onboardingFlow.spec.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/e2e/web/specs/onboardingFlow.spec.ts b/tests/e2e/web/specs/onboardingFlow.spec.ts index 97fba1fd..0466074c 100644 --- a/tests/e2e/web/specs/onboardingFlow.spec.ts +++ b/tests/e2e/web/specs/onboardingFlow.spec.ts @@ -237,10 +237,7 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(googleAccountOne.username) }) - test('should successfully skip the onboarding flow', async ({ - app, - fakerAccount - }) => { + test('should successfully skip the onboarding flow', async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) await app.skipOnboardingHeadToProfile(fakerAccount) @@ -320,10 +317,7 @@ test.describe('when given valid input', () => { }) test.describe('should successfully complete the onboarding flow after using the back button', () => { - test("the first time it's an option", async ({ - app, - fakerAccount - }) => { + test("the first time it's an option", async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) await app.onboarding.clickContinueButton() await app.onboarding.clickBackButton() @@ -347,10 +341,7 @@ test.describe('when given valid input', () => { await expect(dbInfo.user.username).toContain(fakerAccount.username) }) - test("the second time it's an option", async ({ - app, - fakerAccount - }) => { + test("the second time it's an option", async ({app, fakerAccount}) => { await app.registerWithEmail(fakerAccount) await app.onboarding.clickContinueButton() await app.onboarding.clickContinueButton() From b32f46873628c7df95f8136848b00f567f8ee0f4 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 21 May 2026 16:40:11 +0100 Subject: [PATCH 38/49] . --- tests/e2e/web/specs/signIn.spec.ts | 2 +- tests/e2e/web/specs/signUp.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 0b596b2d..ef52ac1d 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -45,4 +45,4 @@ test.describe('when given invalid input', () => { page.getByText('Failed to sign in with your email and password', {exact: true}), ).toBeVisible() }) -}) +}) \ No newline at end of file diff --git a/tests/e2e/web/specs/signUp.spec.ts b/tests/e2e/web/specs/signUp.spec.ts index 53562129..a266bb17 100644 --- a/tests/e2e/web/specs/signUp.spec.ts +++ b/tests/e2e/web/specs/signUp.spec.ts @@ -28,4 +28,4 @@ test.describe('when an error occurs', () => { await app.signUp.verifyUsernameError() await expect(app.signUp.nextButtonLocator).toBeDisabled() }) -}) +}) \ No newline at end of file From 178dfdc1b7081e59b506a50cd037b58df8589522 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sat, 23 May 2026 10:27:51 +0100 Subject: [PATCH 39/49] Continued work on filter tests Added testid attributes to people page so the info from the results can be accessed --- common/src/choices.ts | 2 +- tests/e2e/web/pages/peoplePage.ts | 43 +++++++++++++++++++++--------- tests/e2e/web/specs/signIn.spec.ts | 26 +++++++++++++++++- tests/e2e/web/specs/signUp.spec.ts | 2 +- web/components/filters/filters.tsx | 5 +++- web/components/icons.tsx | 15 ++++++++--- web/components/profile-grid.tsx | 1 + 7 files changed, 74 insertions(+), 20 deletions(-) diff --git a/common/src/choices.ts b/common/src/choices.ts index a6685338..4b419d68 100644 --- a/common/src/choices.ts +++ b/common/src/choices.ts @@ -213,7 +213,7 @@ export const MBTI_CHOICES = { ESTP: 'estp', ESFJ: 'esfj', ESFP: 'esfp', -} +} as const // MBTI type name mapping export const MBTI_TYPE_NAMES: Record = { diff --git a/tests/e2e/web/pages/peoplePage.ts b/tests/e2e/web/pages/peoplePage.ts index 3dec2a04..ecdf3111 100644 --- a/tests/e2e/web/pages/peoplePage.ts +++ b/tests/e2e/web/pages/peoplePage.ts @@ -56,7 +56,24 @@ export type AdvancedFilter = { export type DisplayFilter = { cardSize?: 'Small' | 'Medium' | 'Large' - filters?: [string, boolean][] + filters?: { + Gender?: boolean + City?: boolean + Age?: boolean + Headline?: boolean + Keywords?: boolean + 'What they seek'?: boolean + Work?: boolean + Interests?: boolean + Causes?: boolean + Diet?: boolean + Smoking?: boolean + Drinks?: boolean + MBTI?: boolean + Languages?: boolean + Bio?: boolean + 'Profile photo'?: boolean + } } export type PeoplePageFilter = { @@ -107,6 +124,7 @@ export class PeoplePage { private readonly profileResults: Locator private readonly profileName: Locator private readonly profileAgeGender: Locator + private readonly profileSeeking: Locator constructor(public readonly page: Page) { this.peopleHeading = page.getByRole('heading', {name: 'People'}) @@ -146,6 +164,7 @@ export class PeoplePage { this.profileResults = page.getByTestId('people-profile-results') this.profileName = page.getByTestId('people-profile-name') this.profileAgeGender = page.getByTestId('people-profile-age-gender') + this.profileSeeking = page.getByTestId('people-profile-seeking') } get profileCountLocator(): Locator { @@ -395,19 +414,14 @@ export class PeoplePage { if (display.cardSize) await this.page.getByRole('button', {name: `${display.cardSize}`}).click() if (!display.filters) return - if (display.filters?.length > 0) { - for (let i = 0; i < display.filters.length; i++) { - const filter = await this.page.getByRole('checkbox', {name: `${display.filters[i][0]}`}) + if (display.filters) { + for (const [name, shouldBeChecked] of Object.entries(display.filters)) { + const filter = await this.page.getByRole('checkbox', {name, exact: true}) await expect(filter).toBeVisible() const isChecked = await filter.isChecked() - if (display.filters[i][1]) { - if (isChecked) continue - if (!isChecked) await filter.click() - } else if (!display.filters[i][1]) { - if (isChecked) await filter.click() - if (!isChecked) continue - } + if (shouldBeChecked && !isChecked) await filter.click() + if (!shouldBeChecked && isChecked) await filter.click() } } } @@ -418,10 +432,13 @@ export class PeoplePage { const chosenProfileNumber = Math.floor(Math.random() * totalResults) const chosenProfile = await this.profileResults.nth(chosenProfileNumber) const profileName = await chosenProfile.getByTestId('people-profile-name').textContent() + const ageGender = await chosenProfile.getByTestId('people-profile-age-gender').textContent() + const seekingInfo = await chosenProfile.getByTestId('people-profile-seeking').textContent() - if (!profileName) return return { - name: profileName, + name: profileName ?? '', + ageGender: ageGender ?? '', + seeking: seekingInfo ?? '', } } diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index ef52ac1d..e3083b48 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -18,12 +18,36 @@ test.describe('when given valid input', () => { await app.home.clickPeopleLink() await app.people.getProfileInfo() + const totalProfiles = await app.people.profileCountLocator.textContent() expect(totalProfiles).toBeTruthy() const totalCount = Number.parseInt(totalProfiles!, 10) expect(Number.isNaN(totalCount)).toBe(false) await app.people.setConnectionTypeFilter(['Collaboration', 'collaboration']) + await app.people.setDisplayFilter({cardSize: 'Large'}) + const filterdProfiles = await app.people.profileCountLocator.textContent() + + if (!totalProfiles || !filterdProfiles) return + await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) + + const results = await app.people.getProfileInfo() + if (!results) return + await expect(results.seeking).toContain('Collaboration') + }) + + test('the age filter should work correctly', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + await app.people.setDisplayFilter({filters: {Age: true}}) + + const totalProfiles = await app.people.profileCountLocator.textContent() + const profileResults = await app.people.getProfileInfo() + const profileAge = parseInt(profileResults.ageGender.match(/\d+/)?.[0] ?? '0') + const age = profileAge <= 60 ? profileAge : 60 + console.log(profileResults, age) + + await app.people.setAgeRangeFilter({min: String(age), max: String(age)}) // The count updates asynchronously after the filter is applied, so poll until it changes. await expect @@ -45,4 +69,4 @@ test.describe('when given invalid input', () => { page.getByText('Failed to sign in with your email and password', {exact: true}), ).toBeVisible() }) -}) \ No newline at end of file +}) diff --git a/tests/e2e/web/specs/signUp.spec.ts b/tests/e2e/web/specs/signUp.spec.ts index a266bb17..53562129 100644 --- a/tests/e2e/web/specs/signUp.spec.ts +++ b/tests/e2e/web/specs/signUp.spec.ts @@ -28,4 +28,4 @@ test.describe('when an error occurs', () => { await app.signUp.verifyUsernameError() await expect(app.signUp.nextButtonLocator).toBeDisabled() }) -}) \ No newline at end of file +}) diff --git a/web/components/filters/filters.tsx b/web/components/filters/filters.tsx index 4f8fa962..78ac11c6 100644 --- a/web/components/filters/filters.tsx +++ b/web/components/filters/filters.tsx @@ -232,7 +232,10 @@ function Filters(props: { const [noMinAge, noMaxAge] = getNoMinMaxAge(filters.pref_age_min, filters.pref_age_max) return ( - + +
{icon}
diff --git a/web/components/profile-grid.tsx b/web/components/profile-grid.tsx index 9933bb8d..5ee41da0 100644 --- a/web/components/profile-grid.tsx +++ b/web/components/profile-grid.tsx @@ -506,6 +506,7 @@ function ProfilePreview(props: { )} {showSeeking !== false && seekingText && ( } /> From 585f9f28d1af18fd3b2d0a9721b8ea6081e27377 Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Sun, 24 May 2026 16:46:32 +0100 Subject: [PATCH 40/49] Added more filter tests --- tests/e2e/web/pages/peoplePage.ts | 25 +++--- tests/e2e/web/specs/signIn.spec.ts | 121 ++++++++++++++++++++++++++++- 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/tests/e2e/web/pages/peoplePage.ts b/tests/e2e/web/pages/peoplePage.ts index ecdf3111..57e24380 100644 --- a/tests/e2e/web/pages/peoplePage.ts +++ b/tests/e2e/web/pages/peoplePage.ts @@ -1,7 +1,6 @@ import {expect, Locator, Page} from '@playwright/test' import { ConnectionTypeTuple, - GenderTuple, EducationTuple, DietTuple, PsychedelicsTuple, @@ -11,6 +10,7 @@ import { ReligionTuple, PersonalityKey, LastActiveTuple, + InterestedInGenderTuple, } from 'common/choices' import {MinMaxNumbers} from '../utils/accountInformation' @@ -25,7 +25,7 @@ export type LifestyleFilter = { cause?: string diet?: DietTuple alcohol?: MinMaxNumbers - smoker?: string + smoker?: "Yes" | "No" | "Either" psychedelics?: PsychedelicsTuple cannabis?: CannabisTuple language?: LanguageTuple @@ -79,7 +79,7 @@ export type DisplayFilter = { export type PeoplePageFilter = { connectionFilter?: ConnectionTypeTuple ageFilter?: MinMaxNumbers - genderFilter?: GenderTuple + genderFilter?: InterestedInGenderTuple backgroundFilter?: BackgroundFilter lifestyleFilter?: LifestyleFilter valuesAndBeliefsFilter?: BeliefsFilter @@ -282,7 +282,7 @@ export class PeoplePage { await this.sliderHelper(ageRange) } - async setGenderTypeFilter(genderType: GenderTuple) { + async setGenderTypeFilter(genderType: InterestedInGenderTuple) { await this.selectOption(this.genderDropdown, genderType[0]) // await expect(this.genderDropdown).toBeVisible() // await this.genderDropdown.click() @@ -442,10 +442,17 @@ export class PeoplePage { } } - async verifyNumberOfMatchingProfiles(count: number) { - await expect(this.profileCount).toBeVisible() - const actualCount = await this.profileCount.textContent() - if (!actualCount) return - expect(parseInt(actualCount)).toStrictEqual(count) + async verifyProfileCount(totalProfiles: string) { + const exists = await this.profileCountLocator.count() > 0 + + if (exists) { + const filterdProfiles = await this.profileCountLocator.textContent() + + if (!totalProfiles || !filterdProfiles) return + await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) + } else { + const noProfilesFound = await this.page.getByText('No profiles found.', { exact: true }) + await expect(noProfilesFound).toBeVisible() + } } } diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index e3083b48..29c81f20 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -36,7 +36,14 @@ test.describe('when given valid input', () => { await expect(results.seeking).toContain('Collaboration') }) - test('the age filter should work correctly', async ({app, signedOutAccount: account}) => { + /** + * Test fails due to ui not updating + * works fine manually + */ + test.skip('the age filter should work correctly', async ({ + app, + signedOutAccount: account + }) => { await app.signinWithEmail(account) await app.home.clickPeopleLink() await app.people.setDisplayFilter({filters: {Age: true}}) @@ -56,6 +63,118 @@ test.describe('when given valid input', () => { ) .not.toEqual(totalCount) }) + + test('the gender filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setGenderTypeFilter(["Women", "female"]) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the education filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setBackgroundFilter({education: ["College", "some-college"]}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the diet filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({diet: ["Vegetarian", "veg"]}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the smoker filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({smoker: 'Yes'}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the psychedelics filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({psychedelics: ["Regularly (weekly+)", "regularly"]}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the cannabis filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({cannabis: ["Occasionally (a few times a year)", "occasionally"]}) + await app.people.setDisplayFilter({ cardSize: 'Large' }) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the politics filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setValuesAndBeliefsFilter({political: ["Progressive", "progressive"]}) + await app.people.setDisplayFilter({ cardSize: 'Large' }) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('the religion filter should work correctly', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setValuesAndBeliefsFilter({religious: ["Jewish", "jewish"]}) + await app.people.setDisplayFilter({ cardSize: 'Large' }) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) }) test.describe('when given invalid input', () => { From 4c2bd90431284cbb54a290bb669efbe717b1ebce Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Mon, 25 May 2026 16:08:03 +0100 Subject: [PATCH 41/49] Added tests for hiding profiles --- tests/e2e/web/pages/peoplePage.ts | 18 +- tests/e2e/web/specs/signIn.spec.ts | 370 ++++++++++++++++------------- 2 files changed, 223 insertions(+), 165 deletions(-) diff --git a/tests/e2e/web/pages/peoplePage.ts b/tests/e2e/web/pages/peoplePage.ts index 57e24380..c089e37b 100644 --- a/tests/e2e/web/pages/peoplePage.ts +++ b/tests/e2e/web/pages/peoplePage.ts @@ -25,7 +25,7 @@ export type LifestyleFilter = { cause?: string diet?: DietTuple alcohol?: MinMaxNumbers - smoker?: "Yes" | "No" | "Either" + smoker?: 'Yes' | 'No' | 'Either' psychedelics?: PsychedelicsTuple cannabis?: CannabisTuple language?: LanguageTuple @@ -170,6 +170,15 @@ export class PeoplePage { get profileCountLocator(): Locator { return this.profileCount } + get profileNameLocator(): Locator { + return this.profileName + } + get profileAgeGenderLocator(): Locator { + return this.profileAgeGender + } + get profileSeekingLocator(): Locator { + return this.profileSeeking + } async sliderHelper(range: MinMaxNumbers, locator?: Locator) { let minSlider @@ -436,6 +445,7 @@ export class PeoplePage { const seekingInfo = await chosenProfile.getByTestId('people-profile-seeking').textContent() return { + profile: chosenProfile ?? '', name: profileName ?? '', ageGender: ageGender ?? '', seeking: seekingInfo ?? '', @@ -443,15 +453,15 @@ export class PeoplePage { } async verifyProfileCount(totalProfiles: string) { - const exists = await this.profileCountLocator.count() > 0 + const exists = (await this.profileCountLocator.count()) > 0 if (exists) { const filterdProfiles = await this.profileCountLocator.textContent() - + if (!totalProfiles || !filterdProfiles) return await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) } else { - const noProfilesFound = await this.page.getByText('No profiles found.', { exact: true }) + const noProfilesFound = await this.page.getByText('No profiles found.', {exact: true}) await expect(noProfilesFound).toBeVisible() } } diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 29c81f20..00813de9 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -10,170 +10,218 @@ test.describe('when given valid input', () => { await app.home.verifySignedInHomePage(account.display_name) }) - test('the profile count should update successfully when applying a filter', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - await app.people.getProfileInfo() - - - const totalProfiles = await app.people.profileCountLocator.textContent() - expect(totalProfiles).toBeTruthy() - const totalCount = Number.parseInt(totalProfiles!, 10) - expect(Number.isNaN(totalCount)).toBe(false) - - await app.people.setConnectionTypeFilter(['Collaboration', 'collaboration']) - await app.people.setDisplayFilter({cardSize: 'Large'}) - const filterdProfiles = await app.people.profileCountLocator.textContent() - - if (!totalProfiles || !filterdProfiles) return - await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) - - const results = await app.people.getProfileInfo() - if (!results) return - await expect(results.seeking).toContain('Collaboration') + test.describe('the applied filter should', () => { + test('update the profile count', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setConnectionTypeFilter(['Collaboration', 'collaboration']) + await app.people.setDisplayFilter({cardSize: 'Large'}) + const filterdProfiles = await app.people.profileCountLocator.textContent() + + if (!totalProfiles || !filterdProfiles) return + await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) + + const results = await app.people.getProfileInfo() + if (!results) return + await expect(results.seeking).toContain('Collaboration') + }) + + /** + * Test fails due to ui not updating + * works fine manually + */ + test.skip('show profiles with the correct age', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + await app.people.setDisplayFilter({filters: {Age: true}}) + + const totalProfiles = await app.people.profileCountLocator.textContent() + const profileResults = await app.people.getProfileInfo() + const profileAge = parseInt(profileResults.ageGender.match(/\d+/)?.[0] ?? '0') + const age = profileAge <= 60 ? profileAge : 60 + console.log(profileResults, age) + + await app.people.setAgeRangeFilter({min: String(age), max: String(age)}) + + const filterdProfiles = await app.people.profileCountLocator.textContent() + + if (!totalProfiles || !filterdProfiles) return + await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles)) + }) + + test('show profiles with the correct gender', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setGenderTypeFilter(['Women', 'female']) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct education level', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setBackgroundFilter({education: ['College', 'some-college']}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct diet', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({diet: ['Vegetarian', 'veg']}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct smoking preference', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({smoker: 'Yes'}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct psychedelics preference', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({psychedelics: ['Regularly (weekly+)', 'regularly']}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct cannabis preference', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setLifestyleFilter({ + cannabis: ['Occasionally (a few times a year)', 'occasionally'], + }) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct political preference', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setValuesAndBeliefsFilter({political: ['Progressive', 'progressive']}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) + + test('show profiles with the correct relegion preference', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + + const totalProfiles = await app.people.profileCountLocator.textContent() + await app.people.setValuesAndBeliefsFilter({religious: ['Jewish', 'jewish']}) + await app.people.setDisplayFilter({cardSize: 'Large'}) + if (!totalProfiles) return + await app.people.verifyProfileCount(totalProfiles) + }) }) - /** - * Test fails due to ui not updating - * works fine manually - */ - test.skip('the age filter should work correctly', async ({ - app, - signedOutAccount: account - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - await app.people.setDisplayFilter({filters: {Age: true}}) - - const totalProfiles = await app.people.profileCountLocator.textContent() - const profileResults = await app.people.getProfileInfo() - const profileAge = parseInt(profileResults.ageGender.match(/\d+/)?.[0] ?? '0') - const age = profileAge <= 60 ? profileAge : 60 - console.log(profileResults, age) - - await app.people.setAgeRangeFilter({min: String(age), max: String(age)}) - - // The count updates asynchronously after the filter is applied, so poll until it changes. - await expect - .poll(async () => - Number.parseInt((await app.people.profileCountLocator.textContent())!, 10), + test.describe('the hide profile feature', () => { + test('should correctly hide a profile', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + const results = await app.people.getProfileInfo() + if (!results) return + const hideProfileButton = await results.profile.getByRole('button', { + name: 'Hide this profile', + }) + await expect(hideProfileButton).toBeVisible() + await hideProfileButton.click() + await expect( + app.page.getByText(`You won't see ${results.name} in your search results anymore.`), + ).toBeVisible() + }) + + test('should be reverseable using undo', async ({app, signedOutAccount: account}) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + const results = await app.people.getProfileInfo() + if (!results) return + const hideProfileButton = await results.profile.getByRole('button', { + name: 'Hide this profile', + }) + await expect(hideProfileButton).toBeVisible() + await hideProfileButton.click() + const hideProfileMessage = await app.page.getByText( + `You won't see ${results.name} in your search results anymore.`, ) - .not.toEqual(totalCount) - }) - - test('the gender filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setGenderTypeFilter(["Women", "female"]) - await app.people.setDisplayFilter({cardSize: 'Large'}) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the education filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setBackgroundFilter({education: ["College", "some-college"]}) - await app.people.setDisplayFilter({cardSize: 'Large'}) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the diet filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setLifestyleFilter({diet: ["Vegetarian", "veg"]}) - await app.people.setDisplayFilter({cardSize: 'Large'}) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the smoker filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setLifestyleFilter({smoker: 'Yes'}) - await app.people.setDisplayFilter({cardSize: 'Large'}) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the psychedelics filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setLifestyleFilter({psychedelics: ["Regularly (weekly+)", "regularly"]}) - await app.people.setDisplayFilter({cardSize: 'Large'}) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the cannabis filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setLifestyleFilter({cannabis: ["Occasionally (a few times a year)", "occasionally"]}) - await app.people.setDisplayFilter({ cardSize: 'Large' }) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the politics filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setValuesAndBeliefsFilter({political: ["Progressive", "progressive"]}) - await app.people.setDisplayFilter({ cardSize: 'Large' }) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) - }) - - test('the religion filter should work correctly', async ({ - app, - signedOutAccount: account, - }) => { - await app.signinWithEmail(account) - await app.home.clickPeopleLink() - - const totalProfiles = await app.people.profileCountLocator.textContent() - await app.people.setValuesAndBeliefsFilter({religious: ["Jewish", "jewish"]}) - await app.people.setDisplayFilter({ cardSize: 'Large' }) - if (!totalProfiles) return - await app.people.verifyProfileCount(totalProfiles) + await expect(hideProfileMessage).toBeVisible() + await app.people.page.getByRole('button', {name: 'Undo'}).click() + await expect(hideProfileMessage).not.toBeVisible() + const profile = await app.people.page.getByRole('heading', {name: `${results.name}`}) + await expect(profile).toBeVisible() + }) + + test('should be reverseable using manage hidden profiles feature in settings', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + const results = await app.people.getProfileInfo() + if (!results) return + const hideProfileButton = await results.profile.getByRole('button', { + name: 'Hide this profile', + }) + await expect(hideProfileButton).toBeVisible() + await hideProfileButton.click() + const hideProfileMessage = await app.page.getByText( + `You won't see ${results.name} in your search results anymore.`, + ) + await expect(hideProfileMessage).toBeVisible() + await app.home.clickSettingsLink() + await app.settings.clickManageHiddenProfilesButton() + await app.settings.verifyHiddenProfiles([results.name]) + await app.settings.unhideProfiles(results.name) + await app.settings.clickCloseButton() + await app.home.clickPeopleLink() + const profile = await app.people.page.getByRole('heading', {name: `${results.name}`}) + await expect(profile).toBeVisible() + }) }) }) From 00e7662d609483538813d4db1c31d5215ec2ddca Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Wed, 27 May 2026 20:01:43 +0100 Subject: [PATCH 42/49] Added a context manager to test with multiple accounts interacting with each other Added an option to verify the users email when creating an account --- tests/e2e/utils/contextManager.ts | 27 ++++++++++++ tests/e2e/utils/firebaseUtils.ts | 30 +++++++++++++ tests/e2e/utils/seedDatabase.ts | 4 +- tests/e2e/web/SPEC_CONFIG.ts | 3 ++ tests/e2e/web/fixtures/signInFixture.ts | 43 ++++++++++++++++++- tests/e2e/web/pages/app.ts | 10 ++++- .../web/specs/firebaseAccountCreationTest.ts | 26 ++++++++--- tests/e2e/web/specs/signIn.spec.ts | 12 ++++++ 8 files changed, 145 insertions(+), 10 deletions(-) create mode 100644 tests/e2e/utils/contextManager.ts diff --git a/tests/e2e/utils/contextManager.ts b/tests/e2e/utils/contextManager.ts new file mode 100644 index 00000000..33f9dbec --- /dev/null +++ b/tests/e2e/utils/contextManager.ts @@ -0,0 +1,27 @@ +import {Browser, BrowserContext} from '@playwright/test' +import {App} from '../web/pages/app' + +export class ContextManager { + private contexts: Map = new Map() + + constructor(private browser: Browser) {} + + async createContext(name: string): Promise { + const context = await this.browser.newContext() + const page = await context.newPage() + const app = new App(page) + this.contexts.set(name, app) + return app + } + + getContext(name: string): App | undefined { + return this.contexts.get(name) + } + + async closeAll(): Promise { + for (const app of this.contexts.values()) { + await app.page.context().close() + } + this.contexts.clear() + } +} diff --git a/tests/e2e/utils/firebaseUtils.ts b/tests/e2e/utils/firebaseUtils.ts index c3dd114e..0fedeb7c 100644 --- a/tests/e2e/utils/firebaseUtils.ts +++ b/tests/e2e/utils/firebaseUtils.ts @@ -37,6 +37,36 @@ export async function findUser(idToken: string) { } } +export async function sendVerificationEmail(idToken: string) { + await axios.post(`${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.SEND_EMAIL_VERIFICATION}`, { + requestType: 'VERIFY_EMAIL', + idToken, + }) +} +export async function getOobCode(oobCodes: any[], email: string) { + return oobCodes.find((item) => item.email.toLowerCase() === email.toLowerCase())?.oobCode +} + +export async function verifyEmail(email: string, password: string) { + try { + const loginInfo = await firebaseLoginEmailPassword(email, password) + await sendVerificationEmail(loginInfo.data.idToken) + const oobResponse = await axios.get(`${config.FIREBASE_URL.FIREBASE_EMULATOR_API}`) + const oobCode = await getOobCode(oobResponse.data.oobCodes, email) + console.log(oobCode) + + const response = await axios.post( + `${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.CONFIRM_EMAIL_VERIFICATION}`, + { + oobCode, + }, + ) + } catch (err: any) { + console.log(err) + throw err + } +} + export async function firebaseSignUp(email: string, password: string) { try { const response = await axios.post(`${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.SIGNUP}`, { diff --git a/tests/e2e/utils/seedDatabase.ts b/tests/e2e/utils/seedDatabase.ts index f6524346..a9c9a4ea 100644 --- a/tests/e2e/utils/seedDatabase.ts +++ b/tests/e2e/utils/seedDatabase.ts @@ -9,7 +9,7 @@ import {insert} from 'shared/supabase/utils' import {getUser} from 'shared/utils' import UserAccountInformationForSeeding from '../backend/utils/userInformation' -import {firebaseSignUp} from './firebaseUtils' +import {firebaseSignUp, verifyEmail} from './firebaseUtils' /** * Function used to populate the database with profiles. @@ -151,6 +151,7 @@ export async function seedUser( profileType?: string | undefined, displayName?: string | undefined, userName?: string | undefined, + verifyUserEmail?: boolean, ) { const userInfo = new UserAccountInformationForSeeding() if (email) userInfo.email = email @@ -162,4 +163,5 @@ export async function seedUser( // Fall back to the pre-generated faker id when Firebase is unreachable const created = await seedDbUser(userInfo, profileType ?? 'full') if (created) debug('User created in Supabase:', userInfo.email) + if (verifyUserEmail) await verifyEmail(userInfo.email, userInfo.password) } diff --git a/tests/e2e/web/SPEC_CONFIG.ts b/tests/e2e/web/SPEC_CONFIG.ts index 3b08779b..38bd3a8d 100644 --- a/tests/e2e/web/SPEC_CONFIG.ts +++ b/tests/e2e/web/SPEC_CONFIG.ts @@ -2,10 +2,13 @@ export const config = { BASE_URL: 'http://localhost:3000', FIREBASE_URL: { BASE: 'http://localhost:9099/identitytoolkit.googleapis.com/v1', + FIREBASE_EMULATOR_API: 'http://localhost:9099/emulator/v1/projects/compass-57c3c/oobCodes', SIGNUP: '/accounts:signUp?key=fake-api-key', SIGN_IN_PASSWORD: '/accounts:signInWithPassword?key=fake-api-key', ACCOUNT_LOOKUP: '/accounts:lookup?key=fake-api-key', DELETE: '/accounts:delete?key=fake-api-key', + SEND_EMAIL_VERIFICATION: '/accounts:sendOobCode?key=fake-api-key', + CONFIRM_EMAIL_VERIFICATION: '/accounts:update?key=fake-api-key', }, USERS: { DEV_1: { diff --git a/tests/e2e/web/fixtures/signInFixture.ts b/tests/e2e/web/fixtures/signInFixture.ts index a55ecbdc..fa30f5be 100644 --- a/tests/e2e/web/fixtures/signInFixture.ts +++ b/tests/e2e/web/fixtures/signInFixture.ts @@ -7,7 +7,9 @@ import {deleteUser} from '../utils/deleteUser' export const test = base.extend<{ app: App - dev_one_account: UserAccountInformation + devOneAccount: UserAccountInformation + devTwoAccount: UserAccountInformation + specAccount: UserAccountInformation fakerAccount: UserAccountInformation googleAccountOne: UserAccountInformation googleAccountTwo: UserAccountInformation @@ -43,6 +45,45 @@ export const test = base.extend<{ await use(account) await deleteUser('Email/Password', account) }, + devOneAccount: async ({}, use) => { + const account = testAccounts.dev_one_account() + await seedUser( + account.email, + account.password, + undefined, + account.display_name, + account.username, + true, + ) + await use(account) + await deleteUser('Email/Password', account) + }, + devTwoAccount: async ({}, use) => { + const account = testAccounts.dev_two_account() + await seedUser( + account.email, + account.password, + undefined, + account.display_name, + account.username, + true, + ) + await use(account) + await deleteUser('Email/Password', account) + }, + specAccount: async ({}, use) => { + const account = testAccounts.spec_account() + await seedUser( + account.email, + account.password, + undefined, + account.display_name, + account.username, + true, + ) + await use(account) + await deleteUser('Email/Password', account) + }, fakerAccount: async ({}, use) => { const account = testAccounts.faker_account() await use(account) diff --git a/tests/e2e/web/pages/app.ts b/tests/e2e/web/pages/app.ts index 49048762..da66dec9 100644 --- a/tests/e2e/web/pages/app.ts +++ b/tests/e2e/web/pages/app.ts @@ -1,6 +1,7 @@ -import {Page} from '@playwright/test' +import {BrowserContext, Page} from '@playwright/test' import {UserAccountInformation} from '../utils/accountInformation' +import {ContextManager} from '../../utils/contextManager' import {AuthPage} from './authPage' import {CompatibilityPage} from './compatibilityPage' import {HomePage} from './homePage' @@ -25,6 +26,8 @@ export class App { readonly social: SocialPage readonly people: PeoplePage readonly notifs: NotificationPage + readonly contextManager: ContextManager + readonly context: BrowserContext constructor(public readonly page: Page) { this.auth = new AuthPage(page) @@ -38,6 +41,11 @@ export class App { this.social = new SocialPage(page) this.people = new PeoplePage(page) this.notifs = new NotificationPage(page) + this.context = page.context() + + const browser = page.context().browser() + if (!browser) throw new Error('Could not get Browser from page.context().browser()') + this.contextManager = new ContextManager(browser) } async deleteProfileFromSettings() { diff --git a/tests/e2e/web/specs/firebaseAccountCreationTest.ts b/tests/e2e/web/specs/firebaseAccountCreationTest.ts index 964b32dd..c4688b17 100644 --- a/tests/e2e/web/specs/firebaseAccountCreationTest.ts +++ b/tests/e2e/web/specs/firebaseAccountCreationTest.ts @@ -1,15 +1,27 @@ import axios from 'axios' import {config} from '../SPEC_CONFIG' +import { + firebaseLoginEmailPassword, + getOobCode, + getUserId, + sendVerificationEmail, +} from '../../utils/firebaseUtils' async function setup() { - const results = await axios.post(`${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.SIGNUP}`, { - email: 'trial_test@email.com', - password: 'trialTestPassword', - returnSecureToken: true, - }) + const loginInfo = await firebaseLoginEmailPassword('AnotherTest@email.com', 'Password') + await sendVerificationEmail(loginInfo.data.idToken) + const oobResponse = await axios.get(`${config.FIREBASE_URL.FIREBASE_EMULATOR_API}`) + const oobCode = await getOobCode(oobResponse.data.oobCodes, 'AnotherTest@email.com') + console.log(oobCode) - console.log('Auth created: ', 'trial_test@email.com') - console.log('Id: ', results.data.localId) + const response = await axios.post( + `${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.CONFIRM_EMAIL_VERIFICATION}`, + { + oobCode, + }, + ) + console.log(response) + console.log(response.status) } setup() diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 00813de9..2f1e2d0d 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -1,4 +1,5 @@ import {expect, test} from '../fixtures/signInFixture' +import {ContextManager} from '../../utils/contextManager' test.describe('when given valid input', () => { test('should be able to sign in to an available account', async ({ @@ -223,6 +224,17 @@ test.describe('when given valid input', () => { await expect(profile).toBeVisible() }) }) + + test.describe('a verified account should', () => { + test('be able to send a message', async ({app, devOneAccount, devTwoAccount}) => { + const devOne = await app.contextManager.createContext('devOne') + const devTwo = await app.contextManager.createContext('devTwo') + await devOne.signinWithEmail(devOneAccount) + await devOne.home.clickPeopleLink() + await devTwo.signinWithEmail(devTwoAccount) + await devTwo.home.clickPeopleLink() + }) + }) }) test.describe('when given invalid input', () => { From 23eedd0fbb0ced2e20eca2ab6688ab5fd5c9fe1b Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 28 May 2026 19:15:48 +0100 Subject: [PATCH 43/49] Added Tests for sending/recieving messages Added tests for staring/favoriting profiles Added testIds where necessary Added messagesPage.ts Updated peoplePage.ts --- tests/e2e/web/pages/app.ts | 4 + tests/e2e/web/pages/messagesPage.ts | 97 +++++++++++++++++++ tests/e2e/web/pages/peoplePage.ts | 65 ++++++++++++- tests/e2e/web/specs/signIn.spec.ts | 45 ++++++++- web/components/chat/chat-message.tsx | 1 + web/components/comments/comment-input.tsx | 1 + web/components/profile-grid.tsx | 5 +- web/components/searches/button.tsx | 8 +- web/components/select-users.tsx | 3 +- .../widgets/hide-profile-button.tsx | 1 + web/components/widgets/star-button.tsx | 1 + web/pages/messages/[channelId].tsx | 1 + web/pages/messages/index.tsx | 6 +- 13 files changed, 226 insertions(+), 12 deletions(-) create mode 100644 tests/e2e/web/pages/messagesPage.ts diff --git a/tests/e2e/web/pages/app.ts b/tests/e2e/web/pages/app.ts index da66dec9..89aaea31 100644 --- a/tests/e2e/web/pages/app.ts +++ b/tests/e2e/web/pages/app.ts @@ -13,6 +13,8 @@ import {SignUpPage} from './signUpPage' import {SocialPage} from './socialPage' import {PeoplePage} from './peoplePage' import {NotificationPage} from './notificationsPage' +import { MessagesPage } from './messagesPage' + export class App { readonly auth: AuthPage @@ -26,6 +28,7 @@ export class App { readonly social: SocialPage readonly people: PeoplePage readonly notifs: NotificationPage + readonly messages: MessagesPage readonly contextManager: ContextManager readonly context: BrowserContext @@ -41,6 +44,7 @@ export class App { this.social = new SocialPage(page) this.people = new PeoplePage(page) this.notifs = new NotificationPage(page) + this.messages = new MessagesPage(page) this.context = page.context() const browser = page.context().browser() diff --git a/tests/e2e/web/pages/messagesPage.ts b/tests/e2e/web/pages/messagesPage.ts new file mode 100644 index 00000000..16f99893 --- /dev/null +++ b/tests/e2e/web/pages/messagesPage.ts @@ -0,0 +1,97 @@ +import {expect, Locator, Page} from '@playwright/test' + +export class MessagesPage { + private readonly messagesPageHeader: Locator + private readonly messagesTable: Locator + private readonly messagesRow: Locator + private readonly messagesUsername: Locator + private readonly messagesTimestamp: Locator + private readonly newMessageButton: Locator + private readonly newMessageSearchUsers: Locator + private readonly newMessageSearchResults: Locator + private readonly newMessageSearchCreateButton: Locator + private readonly newMessageStart: Locator + private readonly messageInput: Locator + private readonly messageSubmit: Locator + private readonly conversation: Locator + private readonly conversationMessage: Locator + + constructor(public readonly page: Page) { + this.messagesPageHeader = page.getByRole('heading', { name: 'Messages' }) + this.messagesTable = page.getByTestId('messages-table') + this.messagesRow = page.getByTestId('messages-row') + this.messagesUsername = page.getByTestId('messages-username') + this.messagesTimestamp = page.getByTestId('messages-timestamp') + this.newMessageButton = page.getByRole('button', { name: 'New Message' }) + this.newMessageSearchUsers = page.getByRole('textbox', { name: 'Search users...' }) + this.newMessageSearchResults = page.getByTestId('search-results') + this.newMessageSearchCreateButton = page.getByRole('button', { name: 'Create' }) + this.newMessageStart = page.getByText('No messages yet.', { exact: true }) + this.messageInput = page.locator('.tiptap') + this.messageSubmit = page.getByTestId('conversation-message-submit') + this.conversation = page.getByTestId('conversation') + this.conversationMessage = page.getByTestId('conversation-message') + } + + async verifyMessagesPage() { + await expect(this.messagesPageHeader).toBeVisible() + } + + async createNewMessage(username: string []) { + await expect(this.newMessageButton).toBeVisible() + await this.newMessageButton.click() + await expect(this.newMessageSearchUsers).toBeVisible() + for (let i = 0; i < username.length; i++) { + await this.newMessageSearchUsers.fill(username[i]) + await expect(this.newMessageSearchResults).toBeVisible() + const results = await this.newMessageSearchResults.getByTestId('search-results-username').all() + + for (let i = 0; i < results.length; i++) { + const usernameResults = await results[i].textContent() + if (usernameResults?.toLowerCase() === username[i].toLowerCase()) await results[i].click() + break + } + } + + await expect(this.newMessageSearchCreateButton).toBeVisible() + await this.newMessageSearchCreateButton.click() + } + + async sendMessage(message: string) { + await expect(this.messageInput).toBeVisible() + await this.messageInput.fill(message) + await expect(this.messageSubmit).toBeVisible() + await this.messageSubmit.click() + } + + async findMessageConversation(displayName: string) { + await expect(this.messagesTable).toBeVisible() + const doMessagesExist = await this.messagesRow.count() > 0 + if (doMessagesExist) { + const messages = await this.messagesRow.getByTestId('messages-username').all() + + for (let i = 0; i < messages.length; i++) { + await expect(messages[i]).toBeVisible() + const messageFromUser = await messages[i].textContent() + if (messageFromUser?.toLowerCase() === displayName.toLowerCase()) await messages[i].click() + } + } else { + throw new Error('There are no messages on this account') + } + } + + async verifyMessage(messageContent: string) { + await expect(this.conversation).toBeVisible() + const messageCount = await this.conversationMessage.count() > 0 + if (messageCount) { + const messages = await this.conversationMessage.all() + for (let i = 0; i < messages.length; i++) { + const message = await messages[i].textContent() + if (message?.toLowerCase() === messageContent.toLowerCase()) return true + } + return false + } else { + throw new Error('There are no messages in this conversation') + } + } +} \ No newline at end of file diff --git a/tests/e2e/web/pages/peoplePage.ts b/tests/e2e/web/pages/peoplePage.ts index c089e37b..9c463c02 100644 --- a/tests/e2e/web/pages/peoplePage.ts +++ b/tests/e2e/web/pages/peoplePage.ts @@ -88,7 +88,10 @@ export type PeoplePageFilter = { export class PeoplePage { private readonly peopleHeading: Locator + private readonly savedPeopleHeading: Locator + private readonly savedPeopleList: Locator private readonly searchBox: Locator + private readonly savedPeopleButton: Locator private readonly profileCount: Locator private readonly resetFilters: Locator private readonly yourFiltersCheckbox: Locator @@ -122,13 +125,20 @@ export class PeoplePage { private readonly displayDropdown: Locator private readonly profileGrid: Locator private readonly profileResults: Locator + private readonly profileHide: Locator + private readonly profileStar: Locator + private readonly profileMessage: Locator + private readonly messageInput: Locator private readonly profileName: Locator private readonly profileAgeGender: Locator private readonly profileSeeking: Locator constructor(public readonly page: Page) { this.peopleHeading = page.getByRole('heading', {name: 'People'}) + this.savedPeopleHeading = page.getByRole('heading', { name: 'Saved People' }) + this.savedPeopleList = page.getByTestId('saved-person') this.searchBox = page.getByRole('textbox', {name: 'Search anything...'}) + this.savedPeopleButton = page.getByRole('button', { name: 'Saved People' }) this.profileCount = page.getByTestId('people-profile-count') this.resetFilters = page.getByRole('button', {name: 'Reset filters'}) this.yourFiltersCheckbox = page.getByText('Your filters', {exact: true}) @@ -162,6 +172,10 @@ export class PeoplePage { this.displayDropdown = page.getByRole('button', {name: 'Display'}) this.profileGrid = page.getByTestId('people-profile-grid') this.profileResults = page.getByTestId('people-profile-results') + this.profileHide = page.getByTestId('hide-profile-button') + this.profileStar = page.getByTestId('star-profile-button') + this.profileMessage = page.getByTestId('message-profile-button') + this.messageInput = page.locator('.tiptap') this.profileName = page.getByTestId('people-profile-name') this.profileAgeGender = page.getByTestId('people-profile-age-gender') this.profileSeeking = page.getByTestId('people-profile-seeking') @@ -247,12 +261,16 @@ export class PeoplePage { await expect(this.peopleHeading).toBeVisible() } - //Doesn't actually work, need to find out why + async clickSavedPeopleButton() { + await expect(this.savedPeopleButton).toBeVisible() + await this.savedPeopleButton.click() + } + async useSearch(item: string) { await expect(this.searchBox).toBeVisible() await this.searchBox.click() await this.searchBox.fill(item) - await this.page.keyboard.press('Enter') + await this.page.waitForTimeout(1000) } async resetFilter() { @@ -443,12 +461,18 @@ export class PeoplePage { const profileName = await chosenProfile.getByTestId('people-profile-name').textContent() const ageGender = await chosenProfile.getByTestId('people-profile-age-gender').textContent() const seekingInfo = await chosenProfile.getByTestId('people-profile-seeking').textContent() + const hideProfile = await chosenProfile.getByTestId('hide-profile-button') + const starProfile = await chosenProfile.getByTestId('star-profile-button') + const messageProfile = await chosenProfile.getByTestId('message-profile-button') return { profile: chosenProfile ?? '', name: profileName ?? '', ageGender: ageGender ?? '', seeking: seekingInfo ?? '', + hide: hideProfile ?? '', + star: starProfile ?? '', + message: messageProfile ?? '', } } @@ -465,4 +489,41 @@ export class PeoplePage { await expect(noProfilesFound).toBeVisible() } } + + async selectProfile(displayName: string) { + await expect(this.profileGrid).toBeVisible() + await this.profileName.getByText(displayName).click() + } + + async messageProfile(displayName: string, message: string) { + await expect(this.profileGrid).toBeVisible() + const profiles = await this.profileResults.all() + + for (let i = 0; i < profiles.length; i++) { + const profileName = await profiles[i].getByTestId('people-profile-name').textContent(); + if (profileName?.toLowerCase() === displayName.toLowerCase()) { + await profiles[i].getByTestId('message-profile-button').click() + await expect(this.messageInput).toBeVisible() + await this.messageInput.fill(message) + await this.page.getByTestId('conversation-message-submit').click() + } + } + } + + async verifySavedPerson(displayName: string) { + await expect(this.savedPeopleHeading).toBeVisible() + const isThereSavedPeople = await this.savedPeopleList.count() > 0 + + if (isThereSavedPeople) { + const listOfPeople = await this.savedPeopleList.all() + for (let i = 0; i < listOfPeople.length; i++) { + await expect(listOfPeople[i]).toBeVisible() + const profileName = await listOfPeople[i].textContent() + if (profileName?.toLowerCase() === displayName.toLowerCase()) return true + } + return false + } else { + throw new Error('There are no profiles in the saved people list') + } + } } diff --git a/tests/e2e/web/specs/signIn.spec.ts b/tests/e2e/web/specs/signIn.spec.ts index 2f1e2d0d..0158d48e 100644 --- a/tests/e2e/web/specs/signIn.spec.ts +++ b/tests/e2e/web/specs/signIn.spec.ts @@ -1,5 +1,4 @@ import {expect, test} from '../fixtures/signInFixture' -import {ContextManager} from '../../utils/contextManager' test.describe('when given valid input', () => { test('should be able to sign in to an available account', async ({ @@ -11,6 +10,19 @@ test.describe('when given valid input', () => { await app.home.verifySignedInHomePage(account.display_name) }) + test('should be able to save/favorite people', async ({ + app, + signedOutAccount: account, + }) => { + await app.signinWithEmail(account) + await app.home.clickPeopleLink() + const profile = await app.people.getProfileInfo() + await expect(profile.star).toBeVisible() + await profile.star.click() + await app.people.clickSavedPeopleButton() + await app.people.verifySavedPerson(profile.name) + }) + test.describe('the applied filter should', () => { test('update the profile count', async ({app, signedOutAccount: account}) => { await app.signinWithEmail(account) @@ -226,14 +238,39 @@ test.describe('when given valid input', () => { }) test.describe('a verified account should', () => { - test('be able to send a message', async ({app, devOneAccount, devTwoAccount}) => { + test('be able to send a message from the messages page', async ({app, devOneAccount, devTwoAccount}) => { const devOne = await app.contextManager.createContext('devOne') const devTwo = await app.contextManager.createContext('devTwo') await devOne.signinWithEmail(devOneAccount) - await devOne.home.clickPeopleLink() await devTwo.signinWithEmail(devTwoAccount) - await devTwo.home.clickPeopleLink() + + await devOne.home.clickMessagesLink() + await devOne.messages.createNewMessage([devTwoAccount.display_name]) + await devOne.messages.sendMessage('This is a message') + + await devTwo.home.clickMessagesLink() + await devTwo.messages.findMessageConversation(devOneAccount.display_name) + await devTwo.messages.verifyMessage('This is a message') }) + + test('be able to send a message from the people page', async ({app, devOneAccount, devTwoAccount}) => { + const devOne = await app.contextManager.createContext('devOne') + const devTwo = await app.contextManager.createContext('devTwo') + await devOne.signinWithEmail(devOneAccount) + await devTwo.signinWithEmail(devTwoAccount) + + await devOne.home.clickPeopleLink() + await devOne.people.useSearch(devTwoAccount.display_name) + const message = "This is a message".repeat(20) + await devOne.people.messageProfile(devTwoAccount.display_name, message) + await devOne.messages.verifyMessage(message) + + await devTwo.home.clickMessagesLink() + await devTwo.messages.findMessageConversation(devOneAccount.display_name) + await devTwo.messages.verifyMessage(message) + }) + + }) }) diff --git a/web/components/chat/chat-message.tsx b/web/components/chat/chat-message.tsx index 7d2b1d21..38f3bc25 100644 --- a/web/components/chat/chat-message.tsx +++ b/web/components/chat/chat-message.tsx @@ -95,6 +95,7 @@ export function ChatMessageItem(props: { isMe && 'flex-row-reverse', firstOfUser ? 'mt-2' : 'mt-1', )} + data-testid="conversation-message" > {!isMe && !hideAvatar && ( submit('comment')} diff --git a/web/components/profile-grid.tsx b/web/components/profile-grid.tsx index 5ee41da0..455438cd 100644 --- a/web/components/profile-grid.tsx +++ b/web/components/profile-grid.tsx @@ -431,7 +431,10 @@ function ProfilePreview(props: { /> )} {user && ( -
+
{visibleUsers.map((u) => ( -
+
@@ -243,7 +243,10 @@ function StarModal(props: { />
-
+
{u.name}
@{u.username}
@@ -251,6 +254,7 @@ function StarModal(props: {