summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/login.po.ts
blob: d4d2c692116a8d87d98fed9cc49bb192ca28e42f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { PageHelper } from '../page-helper.po';

export class LoginPageHelper extends PageHelper {
  pages = {
    index: { url: '#/login', id: 'cd-login' },
    dashboard: { url: '#/dashboard', id: 'cd-dashboard' }
  };

  doLogin() {
    cy.get('[name=username]').type('admin');
    cy.get('#password').type('admin');
    cy.get('[type=submit]').click();
    cy.get('cd-dashboard').should('exist');
  }

  doLogout() {
    cy.get('cd-identity a').click();
    cy.contains('cd-identity span', 'Sign out').click();
    cy.get('cd-login').should('exist');
    cy.location('hash').should('eq', '#/login');
  }
}