1 import { PageHelper } from '../page-helper.po';
3 export class UserMgmtPageHelper extends PageHelper {
5 index: { url: '#/user-management/users', id: 'cd-user-list' },
6 create: { url: '#/user-management/users/create', id: 'cd-user-form' }
9 create(username: string, password: string, name: string, email: string) {
10 this.navigateTo('create');
13 cy.get('#username').type(username);
14 cy.get('#password').type(password);
15 cy.get('#confirmpassword').type(password);
16 cy.get('#name').type(name);
17 cy.get('#email').type(email);
19 // Click the create button and wait for user to be made
20 cy.contains('button', 'Create User').click();
21 this.getFirstTableCell(username).should('exist');
24 edit(username: string, password: string, name: string, email: string) {
25 this.navigateEdit(username);
27 // fill in fields with new values
28 cy.get('#password').clear().type(password);
29 cy.get('#confirmpassword').clear().type(password);
30 cy.get('#name').clear().type(name);
31 cy.get('#email').clear().type(email);
33 // Click the edit button and check new values are present in table
34 const editButton = cy.contains('button', 'Edit User');
36 this.getFirstTableCell(email).should('exist');
37 this.getFirstTableCell(name).should('exist');