]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/e2e/ui/role-mgmt.po.ts
d/control: depend on python3-yaml for ceph-mgr
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / e2e / ui / role-mgmt.po.ts
CommitLineData
9f95a23c
TL
1import { by, element } from 'protractor';
2import { PageHelper } from '../page-helper.po';
3
4export class RoleMgmtPageHelper extends PageHelper {
5 pages = {
6 index: '/#/user-management/roles',
7 create: '/#/user-management/roles/create'
8 };
9
10 async create(name: string, description: string): Promise<void> {
11 await this.navigateTo('create');
12
13 // fill in fields
14 await element(by.id('name')).sendKeys(name);
15 await element(by.id('description')).sendKeys(description);
16
17 // Click the create button and wait for role to be made
18 const createButton = element(by.cssContainingText('button', 'Create Role'));
19 await createButton.click();
20
21 await this.waitPresence(this.getFirstTableCellWithText(name));
22 }
23
24 async edit(name: string, description: string): Promise<void> {
25 await this.navigateTo();
26
27 await this.getFirstTableCellWithText(name).click(); // select role from table
28 await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
29
30 // fill in fields with new values
31 await element(by.id('description')).clear();
32 await element(by.id('description')).sendKeys(description);
33
34 // Click the edit button and check new values are present in table
35 const editButton = element(by.cssContainingText('button', 'Edit Role'));
36 await editButton.click();
37
38 await this.waitPresence(this.getFirstTableCellWithText(name));
39 await this.waitPresence(this.getFirstTableCellWithText(description));
40 }
41}