]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/po/login.po.ts
Fix videos language tests
[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
3419e0e1
C
18 await this.getLoggedInInfoElem().waitForExist()
19
20 await expect(this.getLoggedInInfoElem()).toHaveText('root')
84c7cde6
C
21 }
22
6d210220
C
23 async logout () {
24 await $('.logged-in-more').click()
25
26 const logout = () => $('.dropdown-item*=Log out')
27
28 await logout().waitForDisplayed()
29 await logout().click()
30
31 await $('.login-buttons-block').waitForDisplayed()
32 }
33
3419e0e1
C
34 private getLoggedInInfoElem () {
35 return $('.logged-in-display-name')
5f92c4dc 36 }
6d210220
C
37
38 private getSuffix () {
39 return browser.config.baseUrl
40 ? browser.config.baseUrl.slice(-1)
41 : '1'
42 }
5f92c4dc 43}