]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/user-mgmt.po.ts
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / ui / user-mgmt.po.ts
1 import { PageHelper } from '../page-helper.po';
2
3 export class UserMgmtPageHelper extends PageHelper {
4 pages = {
5 index: { url: '#/user-management/users', id: 'cd-user-list' },
6 create: { url: '#/user-management/users/create', id: 'cd-user-form' }
7 };
8
9 create(username: string, password: string, name: string, email: string) {
10 this.navigateTo('create');
11
12 // fill in fields
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);
18
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');
22 }
23
24 edit(username: string, password: string, name: string, email: string) {
25 this.navigateEdit(username);
26
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);
32
33 // Click the edit button and check new values are present in table
34 const editButton = cy.contains('button', 'Edit User');
35 editButton.click();
36 this.getFirstTableCell(email).should('exist');
37 this.getFirstTableCell(name).should('exist');
38 }
39 }