3 interface Chainable<Subject> {
5 text(): Chainable<string>;
10 import { CdHelperClass } from '~/app/shared/classes/cd-helper.class';
11 import { Permissions } from '~/app/shared/models/permissions';
15 const fillAuth = () => {
16 window.localStorage.setItem('dashboard_username', auth.username);
17 window.localStorage.setItem('dashboard_permissions', auth.permissions);
18 window.localStorage.setItem('user_pwd_expiration_date', auth.pwdExpirationDate);
19 window.localStorage.setItem('user_pwd_update_required', auth.pwdUpdateRequired);
20 window.localStorage.setItem('sso', auth.sso);
23 Cypress.Commands.add('login', () => {
24 const username = Cypress.env('LOGIN_USER') || 'admin';
25 const password = Cypress.env('LOGIN_PWD') || 'admin';
27 if (auth === undefined) {
31 headers: { Accept: CdHelperClass.cdVersionHeader('1', '0') },
32 body: { username: username, password: password }
35 auth.permissions = JSON.stringify(new Permissions(auth.permissions));
36 auth.pwdExpirationDate = String(auth.pwdExpirationDate);
37 auth.pwdUpdateRequired = String(auth.pwdUpdateRequired);
38 auth.sso = String(auth.sso);
47 Cypress.Commands.add('text', { prevSubject: true }, (subject) => {
48 return subject.text();