1 import { $, $$, by, element, protractor } from 'protractor';
2 import { PageHelper } from '../page-helper.po';
4 export class LogsPageHelper extends PageHelper {
5 pages = { index: '/#/logs' };
7 async checkAuditForPoolFunction(
13 await this.navigateTo();
15 // sometimes the modal from deleting pool is still present at this point.
16 // This wait makes sure it isn't
17 await this.waitStaleness(element(by.cssContainingText('.modal-dialog', 'Delete Pool')));
19 // go to audit logs tab
20 await element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
22 // Enter an earliest time so that no old messages with the same pool name show up
23 await $$('.bs-timepicker-field')
25 .sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
26 await $$('.bs-timepicker-field')
28 .sendKeys(protractor.Key.BACK_SPACE);
30 await $$('.bs-timepicker-field')
34 await $$('.bs-timepicker-field')
38 await $$('.bs-timepicker-field')
40 .sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
41 await $$('.bs-timepicker-field')
43 .sendKeys(protractor.Key.BACK_SPACE);
45 await $$('.bs-timepicker-field')
49 await $$('.bs-timepicker-field')
53 // Enter the pool name into the filter box
54 await $$('input.form-control.ng-valid')
57 await $$('input.form-control.ng-valid')
60 await $$('input.form-control.ng-valid')
64 const audit_logs_tab = $('.tab-pane.active');
65 const audit_logs_body = audit_logs_tab.element(by.css('.card-body'));
66 const logs = audit_logs_body.all(by.cssContainingText('.message', poolname));
68 await expect(logs.getText()).toMatch(poolname);
69 await expect(logs.getText()).toMatch(`pool ${poolfunction}`);
72 async checkAuditForConfigChange(
78 await this.navigateTo();
80 // go to audit logs tab
81 await element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
83 // Enter an earliest time so that no old messages with the same config name show up
84 await $$('.bs-timepicker-field')
86 .sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
87 await $$('.bs-timepicker-field')
89 .sendKeys(protractor.Key.BACK_SPACE);
91 await $$('.bs-timepicker-field')
95 await $$('.bs-timepicker-field')
99 await $$('.bs-timepicker-field')
101 .sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
102 await $$('.bs-timepicker-field')
104 .sendKeys(protractor.Key.BACK_SPACE);
106 await $$('.bs-timepicker-field')
110 await $$('.bs-timepicker-field')
114 // Enter the config name into the filter box
115 await $$('input.form-control.ng-valid')
118 await $$('input.form-control.ng-valid')
121 await $$('input.form-control.ng-valid')
123 .sendKeys(configname);
125 const audit_logs_tab = $('.tab-pane.active');
126 const audit_logs_body = audit_logs_tab.element(by.css('.card-body'));
127 const logs = audit_logs_body.all(by.cssContainingText('.message', configname));
129 await this.waitPresence(logs.first());
131 await expect(logs.getText()).toMatch(configname);
132 await expect(logs.getText()).toMatch(setting);