1 import { PageHelper } from '../page-helper.po';
3 export class RoleMgmtPageHelper extends PageHelper {
5 index: { url: '#/user-management/roles', id: 'cd-role-list' },
6 create: { url: '#/user-management/roles/create', id: 'cd-role-form' }
9 create(name: string, description: string) {
10 this.navigateTo('create');
11 // Waits for data to load
12 cy.contains('grafana');
15 cy.get('#name').type(name);
16 cy.get('#description').type(description);
18 // Click the create button and wait for role to be made
19 cy.get('[data-cy=submitBtn]').click();
20 cy.get('.breadcrumb-item.active').should('not.have.text', 'Create');
22 this.getFirstTableCell(name).should('exist');
25 edit(name: string, description: string) {
26 this.navigateEdit(name);
27 // Waits for data to load
28 cy.contains('grafana');
30 // fill in fields with new values
31 cy.get('#description').clear().type(description);
33 // Click the edit button and check new values are present in table
34 cy.get('[data-cy=submitBtn]').click();
35 cy.get('.breadcrumb-item.active').should('not.have.text', 'Edit');
37 this.getFirstTableCell(name).should('exist');
38 this.getFirstTableCell(description).should('exist');