Skip to content

Commit 73487af

Browse files
Changed POM/Fixture structure to use an app class to instantiate the page objects (#47)
* Added Database checks to the onboarding flow * Added compatibility page setup Added more compatibility questions * 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 * . * Fix: Merge conflict * . * 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 * Linting and Prettier * Minor cleaning * Organizing helper func * Added Google account to the Onboarding flow * Added account cleanup for google accounts * 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 * Linting and Prettier * Added checks to the deleteUser func to check if the accout exists Added account deletion checks * Linting and Prettier * Added POM's for social and organisation page Updated settings POM * Formatting update, fixed homePage locator for signin * . * . * . * Coderabbitai fix's * Fix * Improve test utilities and stabilize onboarding flow tests * Changes requested * Seperated deletion tests from onboarding * . * Changed POM/Fixture structure to use an app class to instantiate the page objects * Apply suggestion from @MartinBraquet * Apply suggestion from @MartinBraquet * Delete .vscode/settings.json * Apply suggestion from @MartinBraquet * Apply suggestions from code review Co-authored-by: Martin Braquet <martin.braquet@gmail.com> * Apply suggestion from @MartinBraquet * Apply suggestion from @MartinBraquet * Linting and Prettier --------- Co-authored-by: MartinBraquet <martin.braquet@gmail.com>
1 parent 5b6c30b commit 73487af

13 files changed

Lines changed: 266 additions & 402 deletions

File tree

‎.coderabbit.yaml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ reviews:
1717
enabled: true
1818
# Skip auto-review if PR title contains these keywords
1919
ignore_title_keywords:
20-
- "WIP"
20+
- 'WIP'
2121
# Don't auto-review draft PRs
2222
drafts: false
2323
# Only auto-review PRs targeting these branches
@@ -57,17 +57,17 @@ reviews:
5757

5858
# Exclude these paths from reviews (build artifacts and dependencies)
5959
path_filters:
60-
- "!**/node_modules/**" # npm dependencies
61-
- "!**/android/**" # Native Android build files
62-
- "!**/ios/**" # Native iOS build files
63-
- "!**/.expo/**" # Expo build cache
64-
- "!**/.expo-shared/**" # Expo shared config
65-
- "!**/dist/**" # Build output
60+
- '!**/node_modules/**' # npm dependencies
61+
- '!**/android/**' # Native Android build files
62+
- '!**/ios/**' # Native iOS build files
63+
- '!**/.expo/**' # Expo build cache
64+
- '!**/.expo-shared/**' # Expo shared config
65+
- '!**/dist/**' # Build output
6666

6767
# Custom review instructions for specific file patterns
6868
path_instructions:
6969
# TypeScript/JavaScript files - main app code
70-
- path: "**/*.{ts,tsx,js,jsx}"
70+
- path: '**/*.{ts,tsx,js,jsx}'
7171
instructions: |
7272
General practices:
7373
- Summarize the changes clearly.
@@ -78,7 +78,7 @@ reviews:
7878
- Flag any hardcoded strings; they should be in the constants file.
7979
- Check for edge cases like null values or empty arrays.
8080
- Suggest performance optimizations where appropriate.
81-
81+
8282
Mobile best practices:
8383
- Proper use of hooks (useRouter, useFonts, useAssets)
8484
- Accessibility: touch targets min 44x44, screen reader support
@@ -105,7 +105,7 @@ reviews:
105105
const message = t('key', 'english string')
106106
```
107107
108-
- path: "tests/e2e/**/*.ts"
108+
- path: 'tests/e2e/**/*.ts'
109109
instructions: |
110110
Playwright E2E test guidelines for this repo:
111111
- Page objects live in `tests/e2e/web/pages/`. Each class wraps one page/route, holds only `private readonly` Locators, and exposes action methods.

‎backend/api/tests/unit/get-profiles.unit.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ describe('loadProfiles', () => {
316316
})
317317

318318
describe('when an error occurs', () => {
319-
it('throw if there is no compatability', async () => {
319+
it('throw if there is no compatibility', async () => {
320320
const props = {
321321
orderBy: 'compatibility_score',
322322
}

‎docs/TESTING.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ jest.mock('path/to/module')
348348
* This creates an object containing all named exports from ./path/to/module
349349
*/
350350
import * as mockModule from 'path/to/module'
351-
352351
;(mockModule.module as jest.Mock).mockResolvedValue(mockReturnValue)
353352
```
354353

‎tests/e2e/tsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"rootDir": "../../",
34
"module": "commonjs",
45
"jsx": "react-jsx",
56
"moduleResolution": "node",

‎tests/e2e/utils/firebaseUtils.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import axios from 'axios'
2-
32
import {config} from '../web/SPEC_CONFIG'
43

54
export async function firebaseLoginEmailPassword(

‎tests/e2e/web/fixtures/base.ts‎

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
import {test as base} from '@playwright/test'
2-
3-
import {AuthPage} from '../pages/AuthPage'
4-
import {ComatibilityPage} from '../pages/compatibilityPage'
5-
import {HomePage} from '../pages/homePage'
6-
import {OnboardingPage} from '../pages/onboardingPage'
7-
import {OrganizationPage} from '../pages/organizationPage'
8-
import {ProfilePage} from '../pages/profilePage'
9-
import {SettingsPage} from '../pages/settingsPage'
10-
import {SignUpPage} from '../pages/signUpPage'
11-
import {SocialPage} from '../pages/socialPage'
122
import {testAccounts, UserAccountInformation} from '../utils/accountInformation'
133
import {deleteUser} from '../utils/deleteUser'
144
import {getAuthAccountInfo} from '../utils/networkUtils'
5+
import {App} from '../pages/app'
156

167
export const test = base.extend<{
17-
homePage: HomePage
18-
onboardingPage: OnboardingPage
19-
signUpPage: SignUpPage
20-
profilePage: ProfilePage
21-
authPage: AuthPage
22-
settingsPage: SettingsPage
23-
socialPage: SocialPage
24-
organizationPage: OrganizationPage
25-
compatabilityPage: ComatibilityPage
26-
cleanUpUsers: void
8+
app: App
279
onboardingAccount: UserAccountInformation
2810
fakerAccount: UserAccountInformation
2911
specAccount: UserAccountInformation
@@ -62,41 +44,9 @@ export const test = base.extend<{
6244
console.log('Cleaning up spec account...')
6345
await deleteUser('Email/Password', account)
6446
},
65-
onboardingPage: async ({page}, use) => {
66-
const onboardingPage = new OnboardingPage(page)
67-
await use(onboardingPage)
68-
},
69-
homePage: async ({page}, use) => {
70-
const homePage = new HomePage(page)
71-
await use(homePage)
72-
},
73-
signUpPage: async ({page}, use) => {
74-
const signUpPage = new SignUpPage(page)
75-
await use(signUpPage)
76-
},
77-
authPage: async ({page}, use) => {
78-
const authPage = new AuthPage(page)
79-
await use(authPage)
80-
},
81-
profilePage: async ({page}, use) => {
82-
const profilePage = new ProfilePage(page)
83-
await use(profilePage)
84-
},
85-
compatabilityPage: async ({page}, use) => {
86-
const compatibilityPage = new ComatibilityPage(page)
87-
await use(compatibilityPage)
88-
},
89-
settingsPage: async ({page}, use) => {
90-
const settingsPage = new SettingsPage(page)
91-
await use(settingsPage)
92-
},
93-
socialPage: async ({page}, use) => {
94-
const socialPage = new SocialPage(page)
95-
await use(socialPage)
96-
},
97-
organizationPage: async ({page}, use) => {
98-
const organizationPage = new OrganizationPage(page)
99-
await use(organizationPage)
47+
app: async ({page}, use) => {
48+
const appPage = new App(page)
49+
await use(appPage)
10050
},
10151
})
10252

‎tests/e2e/web/fixtures/signInFixture.ts‎

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,17 @@
11
import {test as base} from '@playwright/test'
2-
import {AuthPage} from '../pages/AuthPage'
3-
import {HomePage} from '../pages/homePage'
2+
import {App} from '../pages/app'
43
import {testAccounts, UserAccountInformation} from '../utils/accountInformation'
5-
import { OnboardingPage } from '../pages/onboardingPage'
6-
import { SignUpPage } from '../pages/signUpPage'
7-
import { ProfilePage } from '../pages/profilePage'
8-
import { SettingsPage } from '../pages/settingsPage'
94

105
export const test = base.extend<{
11-
homePage: HomePage
12-
onboardingPage: OnboardingPage
13-
signUpPage: SignUpPage
14-
profilePage: ProfilePage
15-
settingsPage: SettingsPage
16-
authPage: AuthPage
6+
app: App
177
dev_one_account: UserAccountInformation
188
fakerAccount: UserAccountInformation
199
googleAccountOne: UserAccountInformation
2010
googleAccountTwo: UserAccountInformation
2111
}>({
22-
homePage: async ({page}, use) => {
23-
const homePage = new HomePage(page)
24-
await use(homePage)
25-
},
26-
onboardingPage: async ({page}, use) => {
27-
const onboardingPage = new OnboardingPage(page)
28-
await use(onboardingPage)
29-
},
30-
signUpPage: async ({page}, use) => {
31-
const signUpPage = new SignUpPage(page)
32-
await use(signUpPage)
33-
},
34-
profilePage: async ({page}, use) => {
35-
const profilePage = new ProfilePage(page)
36-
await use(profilePage)
37-
},
38-
settingsPage: async ({page}, use) => {
39-
const settingsPage = new SettingsPage(page)
40-
await use(settingsPage)
41-
},
42-
authPage: async ({page}, use) => {
43-
const authPage = new AuthPage(page)
44-
await use(authPage)
12+
app: async ({page}, use) => {
13+
const appPage = new App(page)
14+
await use(appPage)
4515
},
4616
dev_one_account: async ({}, use) => {
4717
const account = testAccounts.dev_one_account()

‎tests/e2e/web/pages/app.ts‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import {Page} from '@playwright/test'
2+
import {UserAccountInformation} from '../utils/accountInformation'
3+
import {AuthPage} from './authPage'
4+
import {ComatibilityPage} from './compatibilityPage'
5+
import {HomePage} from './homePage'
6+
import {OnboardingPage} from './onboardingPage'
7+
import {OrganizationPage} from './organizationPage'
8+
import {ProfilePage} from './profilePage'
9+
import {SettingsPage} from './settingsPage'
10+
import {SignUpPage} from './signUpPage'
11+
import {SocialPage} from './socialPage'
12+
13+
export class App {
14+
readonly auth: AuthPage
15+
readonly compatibility: ComatibilityPage
16+
readonly home: HomePage
17+
readonly onboarding: OnboardingPage
18+
readonly organization: OrganizationPage
19+
readonly profile: ProfilePage
20+
readonly settings: SettingsPage
21+
readonly signUp: SignUpPage
22+
readonly social: SocialPage
23+
24+
constructor(public readonly page: Page) {
25+
this.auth = new AuthPage(page)
26+
this.compatibility = new ComatibilityPage(page)
27+
this.home = new HomePage(page)
28+
this.onboarding = new OnboardingPage(page)
29+
this.organization = new OrganizationPage(page)
30+
this.profile = new ProfilePage(page)
31+
this.settings = new SettingsPage(page)
32+
this.signUp = new SignUpPage(page)
33+
this.social = new SocialPage(page)
34+
}
35+
36+
async deleteProfileFromSettings() {
37+
await this.home.clickSettingsLink()
38+
await this.settings.clickDeleteAccountButton()
39+
await this.settings.fillDeleteAccountSurvey('Delete me')
40+
await this.settings.clickDeleteAccountButton()
41+
await this.home.verifyHomePageLinks()
42+
}
43+
44+
async skipOnboardingHeadToProfile(account: UserAccountInformation) {
45+
await this.onboarding.clickSkipOnboardingButton()
46+
await this.signUp.fillDisplayName(account.display_name)
47+
await this.signUp.fillUsername(account.username)
48+
await this.signUp.clickNextButton()
49+
await this.signUp.clickNextButton()
50+
await this.profile.clickCloseButton()
51+
await this.onboarding.clickRefineProfileButton()
52+
}
53+
54+
async registerWithEmail(account: UserAccountInformation) {
55+
await this.home.goToRegisterPage()
56+
await this.auth.fillEmailField(account.email)
57+
await this.auth.fillPasswordField(account.password)
58+
await this.auth.clickSignUpWithEmailButton()
59+
}
60+
61+
async signinWithEmail(accountOrEmail: UserAccountInformation | string, password?: string) {
62+
const email = typeof accountOrEmail === 'string' ? accountOrEmail : accountOrEmail.email
63+
64+
const resolvedPassword = typeof accountOrEmail === 'string' ? password : accountOrEmail.password
65+
66+
if (!email || !resolvedPassword) {
67+
throw new Error('Provide either an `account` or `email` and `password`.')
68+
}
69+
70+
await this.home.goToSigninPage()
71+
await this.auth.fillEmailField(email)
72+
await this.auth.fillPasswordField(resolvedPassword)
73+
await this.auth.clickSignInWithEmailButton()
74+
}
75+
}

0 commit comments

Comments
 (0)