configuration = new Helper().configuration;
});
- afterEach(() => {
- Helper.checkConsole();
+ afterEach(async () => {
+ await Helper.checkConsole();
});
describe('breadcrumb and tab tests', () => {
- beforeAll(() => {
- logs.navigateTo();
+ beforeAll(async () => {
+ await logs.navigateTo();
});
- it('should open and show breadcrumb', () => {
- expect(logs.getBreadcrumbText()).toEqual('Logs');
+ it('should open and show breadcrumb', async () => {
+ expect(await logs.getBreadcrumbText()).toEqual('Logs');
});
- it('should show two tabs', () => {
- expect(logs.getTabsCount()).toEqual(2);
+ it('should show two tabs', async () => {
+ expect(await logs.getTabsCount()).toEqual(2);
});
- it('should show cluster logs tab at first', () => {
- expect(logs.getTabText(0)).toEqual('Cluster Logs');
+ it('should show cluster logs tab at first', async () => {
+ expect(await logs.getTabText(0)).toEqual('Cluster Logs');
});
- it('should show audit logs as a second tab', () => {
- expect(logs.getTabText(1)).toEqual('Audit Logs');
+ it('should show audit logs as a second tab', async () => {
+ expect(await logs.getTabText(1)).toEqual('Audit Logs');
});
});
describe('audit logs respond to pool creation and deletion test', () => {
- it('should create pool and check audit logs reacted', () => {
- pools.navigateTo('create');
- pools.create(poolname, 8);
+ it('should create pool and check audit logs reacted', async () => {
+ await pools.navigateTo('create');
+ await pools.create(poolname, 8);
- pools.navigateTo();
- pools.exist(poolname, true);
+ await pools.navigateTo();
+ await pools.exist(poolname, true);
- logs.navigateTo();
- logs.checkAuditForPoolFunction(poolname, 'create', hour, minute);
+ await logs.checkAuditForPoolFunction(poolname, 'create', hour, minute);
});
- it('should delete pool and check audit logs reacted', () => {
- pools.navigateTo();
- pools.delete(poolname);
+ it('should delete pool and check audit logs reacted', async () => {
+ await pools.navigateTo();
+ await pools.delete(poolname);
- pools.navigateTo();
- pools.exist(poolname, false);
+ await pools.navigateTo();
+ await pools.exist(poolname, false);
- logs.navigateTo();
- logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
+ await logs.navigateTo();
+ await logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
});
});
describe('audit logs respond to editing configuration setting test', () => {
- it('should change config settings and check audit logs reacted', () => {
- configuration.navigateTo();
- configuration.edit(configname, ['global', '5']);
+ it('should change config settings and check audit logs reacted', async () => {
+ await configuration.navigateTo();
+ await configuration.edit(configname, ['global', '5']);
- logs.navigateTo();
- logs.checkAuditForConfigChange(configname, 'global', hour, minute);
+ await logs.navigateTo();
+ await logs.checkAuditForConfigChange(configname, 'global', hour, minute);
- configuration.navigateTo();
- configuration.configClear(configname);
+ await configuration.navigateTo();
+ await configuration.configClear(configname);
});
});
});
export class LogsPageHelper extends PageHelper {
pages = { index: '/#/logs' };
- checkAuditForPoolFunction(poolname, poolfunction, hour, minute) {
- this.navigateTo();
+ async checkAuditForPoolFunction(poolname, poolfunction, hour, minute) {
+ await this.navigateTo();
// sometimes the modal from deleting pool is still present at this point.
// This wait makes sure it isn't
- browser.wait(
+ await browser.wait(
Helper.EC.stalenessOf(element(by.cssContainingText('.modal-dialog', 'Delete Pool'))),
Helper.TIMEOUT
);
// go to audit logs tab
- element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
+ await element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
// Enter an earliest time so that no old messages with the same pool name show up
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(protractor.Key.BACK_SPACE);
if (hour < 10) {
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys('0');
}
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(hour);
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(protractor.Key.BACK_SPACE);
if (minute < 10) {
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys('0');
}
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(minute);
// Enter the pool name into the filter box
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.click();
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.clear();
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.sendKeys(poolname);
const audit_logs_body = audit_logs_tab.element(by.css('.card-body'));
const logs = audit_logs_body.all(by.cssContainingText('.ng-star-inserted', poolname));
- expect(logs.getText()).toMatch(poolname);
- expect(logs.getText()).toMatch(`pool ${poolfunction}`);
+ expect(await logs.getText()).toMatch(poolname);
+ expect(await logs.getText()).toMatch(`pool ${poolfunction}`);
}
- checkAuditForConfigChange(configname, setting, hour, minute) {
- this.navigateTo();
+ async checkAuditForConfigChange(configname, setting, hour, minute) {
+ await this.navigateTo();
// go to audit logs tab
- element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
+ await element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
// Enter an earliest time so that no old messages with the same config name show up
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(protractor.Key.BACK_SPACE);
if (hour < 10) {
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys('0');
}
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(0)
.sendKeys(hour);
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(protractor.Key.BACK_SPACE);
if (minute < 10) {
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys('0');
}
- $$('.bs-timepicker-field')
+ await $$('.bs-timepicker-field')
.get(1)
.sendKeys(minute);
// Enter the config name into the filter box
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.click();
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.clear();
- $$('input.form-control.ng-valid')
+ await $$('input.form-control.ng-valid')
.first()
.sendKeys(configname);
const audit_logs_body = audit_logs_tab.element(by.css('.card-body'));
const logs = audit_logs_body.all(by.cssContainingText('.ng-star-inserted', configname));
- browser.wait(Helper.EC.presenceOf(logs.first()), Helper.TIMEOUT);
+ await browser.wait(Helper.EC.presenceOf(logs.first()), Helper.TIMEOUT);
- expect(logs.getText()).toMatch(configname);
- expect(logs.getText()).toMatch(setting);
+ expect(await logs.getText()).toMatch(configname);
+ expect(await logs.getText()).toMatch(setting);
}
}