Files
Compass/tests/e2e/web/pages/socialPage.ts
Okechi Jones-Williams d2c9d12b39 test(e2e): add auth, settings, social and organization page coverage
* 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

* Update `.coderabbit.yaml` with improved internationalization guidance and formatting adjustments

* Clean up `.vscode/settings.json` and add it to `.gitignore`

* Add Playwright E2E test guidelines to `.coderabbit.yaml`

* Standardize and improve formatting in `TESTING.md` for better readability and consistency.

* Refactor onboarding flow tests and related utilities; improve formatting and remove redundant tests.

---------

Co-authored-by: MartinBraquet <martin.braquet@gmail.com>
2026-04-04 14:21:40 +02:00

114 lines
3.7 KiB
TypeScript

import {expect, Locator, Page} from '@playwright/test'
import {
discordLink,
githubRepo,
instagramLink,
redditLink,
stoatLink,
supportEmail,
xLink,
} from 'common/constants'
export class SocialPage {
private readonly pageTitle: Locator
private readonly communityHeading: Locator
private readonly followAndUpdatesHeading: Locator
private readonly developmentHeading: Locator
private readonly contactHeading: Locator
private readonly discordButton: Locator
private readonly redditButton: Locator
private readonly stoatButton: Locator
private readonly xButton: Locator
private readonly instagramButton: Locator
private readonly githubButton: Locator
private readonly emailButton: Locator
constructor(public readonly page: Page) {
this.pageTitle = page.getByRole('heading', {name: 'Socials'})
this.communityHeading = page.getByRole('heading', {name: 'Community'})
this.followAndUpdatesHeading = page.getByRole('heading', {name: 'Follow & Updates'})
this.developmentHeading = page.getByRole('heading', {name: 'Development'})
this.contactHeading = page.getByRole('heading', {name: 'Contact'})
this.discordButton = page.getByRole('link', {name: 'Discord'})
this.redditButton = page.getByRole('link', {name: 'Reddit'})
this.stoatButton = page.getByRole('link', {name: 'Revolt / Stoat'})
this.xButton = page.getByRole('link', {name: 'X'})
this.instagramButton = page.getByRole('link', {name: 'Instagram'})
this.githubButton = page.getByRole('link', {name: 'GitHub'})
this.emailButton = page.getByRole('link', {name: `Email ${supportEmail}`})
}
async goToSocialPage() {
await this.page.goto('/social')
}
async verifySocialPage() {
await expect(this.page).toHaveURL(/\/social$/)
await expect(this.pageTitle).toBeVisible()
await expect(this.communityHeading).toBeVisible()
await expect(this.followAndUpdatesHeading).toBeVisible()
await expect(this.developmentHeading).toBeVisible()
await expect(this.contactHeading).toBeVisible()
await this.verifySocialLinks()
}
async verifySocialLinks() {
await expect(this.discordButton).toBeVisible()
await expect(this.discordButton).toHaveAttribute('href', discordLink)
await expect(this.redditButton).toBeVisible()
await expect(this.redditButton).toHaveAttribute('href', redditLink)
await expect(this.stoatButton).toBeVisible()
await expect(this.stoatButton).toHaveAttribute('href', stoatLink)
await expect(this.xButton).toBeVisible()
await expect(this.xButton).toHaveAttribute('href', xLink)
await expect(this.instagramButton).toBeVisible()
await expect(this.instagramButton).toHaveAttribute('href', instagramLink)
await expect(this.githubButton).toBeVisible()
await expect(this.githubButton).toHaveAttribute('href', githubRepo)
await expect(this.emailButton).toBeVisible()
await expect(this.emailButton).toHaveAttribute('href', `mailto:${supportEmail}`)
}
async clickDiscordButton() {
await expect(this.discordButton).toBeVisible()
await this.discordButton.click()
}
async clickRedditButton() {
await expect(this.redditButton).toBeVisible()
await this.redditButton.click()
}
async clickStoatButton() {
await expect(this.stoatButton).toBeVisible()
await this.stoatButton.click()
}
async clickXButton() {
await expect(this.xButton).toBeVisible()
await this.xButton.click()
}
async clickInstagramButton() {
await expect(this.instagramButton).toBeVisible()
await this.instagramButton.click()
}
async clickGitHubButton() {
await expect(this.githubButton).toBeVisible()
await this.githubButton.click()
}
async clickEmailButton() {
await expect(this.emailButton).toBeVisible()
await this.emailButton.click()
}
}