aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/login.po.ts
blob: 20412ee0d5a3b1a629d122f6821b60d4119b6d92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { browser, element, by } from 'protractor'

export class LoginPage {
  async loginAsRootUser () {
    await browser.get('/login')

    await browser.executeScript(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`)
    await browser.executeScript(`window.localStorage.setItem('no_welcome_modal', 'true')`)

    element(by.css('input#username')).sendKeys('root')
    element(by.css('input#password')).sendKeys('test1')

    await browser.sleep(1000)

    await element(by.css('form input[type=submit]')).click()

    expect(this.getLoggedInInfo().getText()).toContain('root')
  }

  private getLoggedInInfo () {
    return element(by.css('.logged-in-display-name'))
  }
}