forked from clerk/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserProfilePageObject.ts
More file actions
35 lines (32 loc) · 1.22 KB
/
Copy pathuserProfilePageObject.ts
File metadata and controls
35 lines (32 loc) · 1.22 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
import type { Browser, BrowserContext } from '@playwright/test';
import type { createAppPageObject } from './appPageObject';
export type EnchancedPage = ReturnType<typeof createAppPageObject>;
export type TestArgs = { page: EnchancedPage; context: BrowserContext; browser: Browser };
export const createUserProfileComponentPageObject = (testArgs: TestArgs) => {
const { page } = testArgs;
const self = {
goTo: async (opts?: { searchParams: URLSearchParams }) => {
await page.goToRelative('/user', opts);
return self.waitForMounted();
},
waitForMounted: () => {
return page.waitForSelector('.cl-userProfile-root', { state: 'attached' });
},
clickSetUsername: () => {
return page.getByText(/Set username/i).click();
},
typeUsername: (value: string) => {
return page.getByLabel(/username/i).fill(value);
},
clickAddEmailAddress: () => {
return page.getByText(/Add email address/i).click();
},
typeEmailAddress: (value: string) => {
return page.getByLabel(/Email address/i).fill(value);
},
waitForUserProfileModal: () => {
return page.waitForSelector('.cl-modalContent > .cl-userProfile-root', { state: 'visible' });
},
};
return self;
};