]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/e2e/src/po/signup.po.ts
Fix local e2e tests
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / signup.po.ts
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
12 await button.waitForClickable()
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')
25 await terms.waitForClickable()
26
27 return terms.click()
28 }
29
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
41 async fillAccountStep (options: {
42 username: string
43 password?: string
44 displayName?: string
45 email?: string
46 }) {
47 await $('#displayName').setValue(options.displayName || `${options.username} display name`)
48
49 await $('#username').setValue(options.username)
50 await $('#password').setValue(options.password || 'password')
51
52 // Fix weird bug on firefox that "cannot scroll into view" when using just `setValue`
53 await $('#email').scrollIntoView({ block: 'center' })
54 await $('#email').waitForClickable()
55 await $('#email').setValue(options.email || `${options.username}@example.com`)
56 }
57
58 async fillChannelStep (options: {
59 name: string
60 displayName?: string
61 }) {
62 await $('#displayName').setValue(options.displayName || `${options.name} channel display name`)
63 await $('#name').setValue(options.name)
64 }
65 }