-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathwaitlistPageObject.ts
35 lines (29 loc) · 1.06 KB
/
waitlistPageObject.ts
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 { common } from './commonPageObject';
import type { TestArgs } from './signInPageObject';
type WaitlistFormInputs = {
email: string;
};
export const createWaitlistComponentPageObject = (testArgs: TestArgs) => {
const { page } = testArgs;
const self = {
...common(testArgs),
goTo: async (opts?: { searchParams?: URLSearchParams; headlessSelector?: string }) => {
await page.goToRelative('/waitlist', { searchParams: opts?.searchParams });
if (typeof opts?.headlessSelector !== 'undefined') {
return self.waitForMounted(opts.headlessSelector);
}
return self.waitForMounted();
},
waitForMounted: (selector = '.cl-waitlist-root') => {
return page.waitForSelector(selector, { state: 'attached' });
},
joinWaitlist: async (opts: WaitlistFormInputs) => {
await self.getEmailAddressInput().fill(opts.email);
await self.joinWaitlistContinue();
},
joinWaitlistContinue: () => {
return page.getByRole('button', { name: 'Join the waitlist', exact: true }).click();
},
};
return self;
};