-
-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathprofilePage.ts
More file actions
58 lines (47 loc) · 2.1 KB
/
profilePage.ts
File metadata and controls
58 lines (47 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { Page, Locator } from "@playwright/test"
export class ProfilePage {
readonly page: Page
readonly spinner: Locator
readonly container: Locator
readonly pendingUpgradeBanner: Locator
readonly profileVisibilityBanner: Locator
readonly profileHeader: Locator
readonly verifyAccountSection: Locator
readonly orgContactInfo: Locator
readonly profileAboutSection: Locator
readonly profileLegislators: Locator
readonly viewTestimony: Locator
constructor(page: Page) {
this.page = page
this.spinner = page.getByRole("status")
this.container = page.locator(".container")
this.pendingUpgradeBanner = page.getByTestId("pending-upgrade-banner")
this.profileVisibilityBanner = page.getByTestId("profile-visibility-banner")
this.profileHeader = page.getByTestId("profile-header")
this.verifyAccountSection = page.getByTestId("verify-account-section")
this.orgContactInfo = page.getByTestId("org-contact-info")
this.profileAboutSection = page.getByTestId("profile-about-section")
this.profileLegislators = page.getByTestId("profile-legislators")
this.viewTestimony = page.getByTestId("view-testimony")
// this.profileVisibilityBanner = page.getByText("You are viewing your profile")
// this.publicBannerText = page.getByText("Your profile is public")
// this.privateBannerText = page.getByText("Your profile is private")
// this.pendingUpgradeBanner = page.getByRole("alert")
// // or
// this.pendingUpgradeBanner = page.getByText("pending", { exact: false })
}
async goto(profileId: string) {
await this.page.goto(`http://localhost:3000/profile?id=${profileId}`)
}
async gotoOrgPorfile(orgId: string) {
await this.page.goto(`http://localhost:3000/profile?id=${orgId}&verifyisorg=true`)
}
async isPublicProfile(): Promise<boolean> {
const banner = await this.profileVisibilityBanner.textContent()
return banner?.includes("public") ?? false
}
async isPrivateProfile(): Promise<boolean> {
const banner = await this.profileVisibilityBanner.textContent()
return banner?.includes("private") ?? false
}
}