]>
Commit | Line | Data |
---|---|---|
1db86422 C |
1 | import { getCheckbox } from '../utils' |
2 | ||
3 | export class SignupPage { | |
4 | ||
5 | getRegisterMenuButton () { | |
6 | return $('.create-account-button') | |
7 | } | |
8 | ||
9 | async clickOnRegisterInMenu () { | |
10 | const button = this.getRegisterMenuButton() | |
11 | ||
814e9e07 | 12 | await button.waitForClickable() |
1db86422 C |
13 | await button.click() |
14 | } | |
15 | ||
16 | async validateStep () { | |
17 | const next = $('button[type=submit]') | |
18 | ||
19 | await next.waitForClickable() | |
20 | await next.click() | |
21 | } | |
22 | ||
23 | async checkTerms () { | |
24 | const terms = await getCheckbox('terms') | |
814e9e07 | 25 | await terms.waitForClickable() |
1db86422 C |
26 | |
27 | return terms.click() | |
28 | } | |
29 | ||
5bdfa604 C |
30 | async getEndMessage () { |
31 | const alert = $('.pt-alert-primary') | |
32 | await alert.waitForDisplayed() | |
33 | ||
34 | return alert.getText() | |
35 | } | |
36 | ||
37 | async fillRegistrationReason (reason: string) { | |
38 | await $('#registrationReason').setValue(reason) | |
39 | } | |
40 | ||
1db86422 | 41 | async fillAccountStep (options: { |
1db86422 | 42 | username: string |
5bdfa604 C |
43 | password?: string |
44 | displayName?: string | |
45 | email?: string | |
1db86422 | 46 | }) { |
5bdfa604 | 47 | await $('#displayName').setValue(options.displayName || `${options.username} display name`) |
1db86422 | 48 | |
5bdfa604 C |
49 | await $('#username').setValue(options.username) |
50 | await $('#password').setValue(options.password || 'password') | |
1db86422 | 51 | |
5bdfa604 | 52 | // Fix weird bug on firefox that "cannot scroll into view" when using just `setValue` |
a41b9443 | 53 | await $('#email').scrollIntoView({ block: 'center' }) |
5bdfa604 C |
54 | await $('#email').waitForClickable() |
55 | await $('#email').setValue(options.email || `${options.username}@example.com`) | |
1db86422 C |
56 | } |
57 | ||
58 | async fillChannelStep (options: { | |
1db86422 | 59 | name: string |
5bdfa604 | 60 | displayName?: string |
1db86422 | 61 | }) { |
5bdfa604 C |
62 | await $('#displayName').setValue(options.displayName || `${options.name} channel display name`) |
63 | await $('#name').setValue(options.name) | |
1db86422 C |
64 | } |
65 | } |