]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/po/login.po.ts
Introduce worker threads to process remote images
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / login.po.ts
CommitLineData
3419e0e1 1import { go } from '../utils'
5f92c4dc
C
2
3export class LoginPage {
6d210220 4
5f92c4dc 5 async loginAsRootUser () {
3419e0e1 6 await go('/login')
5f92c4dc 7
3419e0e1
C
8 await browser.execute(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`)
9 await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`)
51b66ea7 10
3419e0e1 11 await $('input#username').setValue('root')
6d210220 12 await $('input#password').setValue('test' + this.getSuffix())
0b33c520 13
3419e0e1 14 await browser.pause(1000)
5f92c4dc 15
3419e0e1 16 await $('form input[type=submit]').click()
5f92c4dc 17
1db86422 18 await this.ensureIsLoggedInAs('root')
84c7cde6
C
19 }
20
6d210220
C
21 async logout () {
22 await $('.logged-in-more').click()
23
24 const logout = () => $('.dropdown-item*=Log out')
25
26 await logout().waitForDisplayed()
27 await logout().click()
28
29 await $('.login-buttons-block').waitForDisplayed()
30 }
31
1db86422
C
32 async ensureIsLoggedInAs (displayName: string) {
33 await this.getLoggedInInfoElem().waitForExist()
34
35 await expect(this.getLoggedInInfoElem()).toHaveText(displayName)
36 }
37
3419e0e1
C
38 private getLoggedInInfoElem () {
39 return $('.logged-in-display-name')
5f92c4dc 40 }
6d210220
C
41
42 private getSuffix () {
43 return browser.config.baseUrl
44 ? browser.config.baseUrl.slice(-1)
45 : '1'
46 }
5f92c4dc 47}