From ef63832ab8660d2cc07248296f8ca5925c8cf71f Mon Sep 17 00:00:00 2001 From: Okechi Jones-Williams Date: Thu, 26 Mar 2026 15:13:11 +0000 Subject: [PATCH] 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 () => {}) })