]>
Commit | Line | Data |
---|---|---|
1 | import { go } from '../utils' | |
2 | ||
3 | export class LoginPage { | |
4 | ||
5 | async loginAsRootUser () { | |
6 | await go('/login') | |
7 | ||
8 | await browser.execute(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`) | |
9 | await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`) | |
10 | ||
11 | await $('input#username').setValue('root') | |
12 | await $('input#password').setValue('test' + this.getSuffix()) | |
13 | ||
14 | await browser.pause(1000) | |
15 | ||
16 | await $('form input[type=submit]').click() | |
17 | ||
18 | await this.getLoggedInInfoElem().waitForExist() | |
19 | ||
20 | await expect(this.getLoggedInInfoElem()).toHaveText('root') | |
21 | } | |
22 | ||
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 | ||
34 | private getLoggedInInfoElem () { | |
35 | return $('.logged-in-display-name') | |
36 | } | |
37 | ||
38 | private getSuffix () { | |
39 | return browser.config.baseUrl | |
40 | ? browser.config.baseUrl.slice(-1) | |
41 | : '1' | |
42 | } | |
43 | } |