pools = new Helper().pools;
});
- afterEach(() => {
- Helper.checkConsole();
+ afterEach(async () => {
+ await Helper.checkConsole();
});
describe('breadcrumb and tab tests', () => {
- beforeAll(() => {
- mirroring.navigateTo();
+ beforeAll(async () => {
+ await mirroring.navigateTo();
});
- it('should open and show breadcrumb', () => {
- expect(mirroring.getBreadcrumbText()).toEqual('Mirroring');
+ it('should open and show breadcrumb', async () => {
+ expect(await mirroring.getBreadcrumbText()).toEqual('Mirroring');
});
- it('should show three tabs', () => {
- expect(mirroring.getTabsCount()).toEqual(3);
+ it('should show three tabs', async () => {
+ expect(await mirroring.getTabsCount()).toEqual(3);
});
- it('should show text for all tabs', () => {
- expect(mirroring.getTabText(0)).toEqual('Issues');
- expect(mirroring.getTabText(1)).toEqual('Syncing');
- expect(mirroring.getTabText(2)).toEqual('Ready');
+ it('should show text for all tabs', async () => {
+ expect(await mirroring.getTabText(0)).toEqual('Issues');
+ expect(await mirroring.getTabText(1)).toEqual('Syncing');
+ expect(await mirroring.getTabText(2)).toEqual('Ready');
});
});
- describe('checks that edit mode functionality shows in the pools table', () => {
+ describe('checks that edit mode functionality shows in the pools table', async () => {
const poolName = 'mirrorpoolrq';
- beforeAll(() => {
- pools.navigateTo('create'); // Need pool for mirroring testing
- pools.create(poolName, 8, 'rbd').then(() => {
- pools.navigateTo();
- pools.exist(poolName, true);
- });
+ beforeAll(async () => {
+ await pools.navigateTo('create'); // Need pool for mirroring testing
+ await pools.create(poolName, 8, 'rbd');
+ // console.log(`before second navigateTo()`);
+ await pools.navigateTo();
+ // console.log(`before pools.exist(${poolName})`);
+ await pools.exist(poolName, true);
+ // console.log(`beforeAll done`);
});
- it('tests editing mode for pools', () => {
- mirroring.navigateTo();
- expect(mirroring.editMirror(poolName, 'Pool'));
- expect(mirroring.getFirstTableCellWithText('pool').isPresent()).toBe(true);
- expect(mirroring.editMirror(poolName, 'Image'));
- expect(mirroring.getFirstTableCellWithText('image').isPresent()).toBe(true);
- expect(mirroring.editMirror(poolName, 'Disabled'));
- expect(mirroring.getFirstTableCellWithText('disabled').isPresent()).toBe(true);
+ it('tests editing mode for pools', async () => {
+ await mirroring.navigateTo();
+ expect(await mirroring.editMirror(poolName, 'Pool'));
+ expect(await mirroring.getFirstTableCellWithText('pool').isPresent()).toBe(true);
+ expect(await mirroring.editMirror(poolName, 'Image'));
+ expect(await mirroring.getFirstTableCellWithText('image').isPresent()).toBe(true);
+ expect(await mirroring.editMirror(poolName, 'Disabled'));
+ expect(await mirroring.getFirstTableCellWithText('disabled').isPresent()).toBe(true);
});
- afterAll(() => {
- pools.navigateTo(); // Deletes mirroring test pool
- pools.delete(poolName).then(() => {
- pools.navigateTo();
- pools.exist(poolName, false);
- });
+ afterAll(async () => {
+ await pools.navigateTo(); // Deletes mirroring test pool
+ await pools.delete(poolName);
+ await pools.navigateTo();
+ await pools.exist(poolName, false);
});
});
});
// Goes to the mirroring page and edits a pool in the Pool table. Clicks on the
// pool and chooses a option (either pool, image, or disabled)
- editMirror(name, option) {
- this.navigateTo();
+ async editMirror(name, option) {
// Clicks the pool in the table
- browser
- .wait(Helper.EC.elementToBeClickable(this.getFirstTableCellWithText(name)), Helper.TIMEOUT)
- .then(() => {
- this.getFirstTableCellWithText(name).click();
- });
+ await browser.wait(
+ Helper.EC.elementToBeClickable(this.getFirstTableCellWithText(name)),
+ Helper.TIMEOUT
+ );
+ await this.getFirstTableCellWithText(name).click();
// Clicks the Edit Mode button
const editModeButton = element(by.cssContainingText('button', 'Edit Mode'));
- browser.wait(Helper.EC.elementToBeClickable(editModeButton), Helper.TIMEOUT).then(() => {
- editModeButton.click();
- });
+ await browser.wait(Helper.EC.elementToBeClickable(editModeButton), Helper.TIMEOUT);
+ await editModeButton.click();
// Clicks the drop down in the edit pop-up, then clicks the Update button
- browser.wait(Helper.EC.visibilityOf($('.modal-content')), Helper.TIMEOUT).then(() => {
- const mirrorDrop = element(by.id('mirrorMode'));
- this.moveClick(mirrorDrop);
- element(by.cssContainingText('select[name=mirrorMode] option', option)).click();
- });
+ await browser.wait(Helper.EC.visibilityOf($('.modal-content')), Helper.TIMEOUT);
+ await element(by.id('mirrorMode')).click(); // Mode select box
+ await element(by.cssContainingText('select[name=mirrorMode] option', option)).click();
+
// Clicks update button and checks if the mode has been changed
- element(by.cssContainingText('button', 'Update'))
- .click()
- .then(() => {
- browser
- .wait(
- Helper.EC.stalenessOf(
- element(by.cssContainingText('.modal-dialog', 'Edit pool mirror mode'))
- ),
- Helper.TIMEOUT
- )
- .then(() => {
- const val = option.toLowerCase(); // used since entries in table are lower case
- browser.wait(
- Helper.EC.visibilityOf(this.getFirstTableCellWithText(val)),
- Helper.TIMEOUT
- );
- });
- });
+ await element(by.cssContainingText('button', 'Update')).click();
+ await browser.wait(
+ Helper.EC.stalenessOf(
+ element(by.cssContainingText('.modal-dialog', 'Edit pool mirror mode'))
+ ),
+ Helper.TIMEOUT
+ );
+ const val = option.toLowerCase(); // used since entries in table are lower case
+ await browser.wait(Helper.EC.visibilityOf(this.getFirstTableCellWithText(val)), Helper.TIMEOUT);
}
}
import { browser } from 'protractor';
import { ImagesPageHelper } from './block/images.po';
+import { MirroringPageHelper } from './block/mirroring.po';
import { AlertsPageHelper } from './cluster/alerts.po';
import { ConfigurationPageHelper } from './cluster/configuration.po';
import { CrushMapPageHelper } from './cluster/crush-map.po';
crushMap: CrushMapPageHelper;
configuration: ConfigurationPageHelper;
alerts: AlertsPageHelper;
+ mirroring: MirroringPageHelper;
constructor() {
this.pools = new PoolPageHelper();
this.crushMap = new CrushMapPageHelper();
this.configuration = new ConfigurationPageHelper();
this.alerts = new AlertsPageHelper();
+ this.mirroring = new MirroringPageHelper();
}
/**
protractor.Key.NULL,
placement_groups
);
- this.setApplications(apps);
+ await this.setApplications(apps);
await element(by.css('cd-submit-button')).click();
return Promise.resolve();
}
- edit_pool_pg(name: string, new_pg: number): promise.Promise<any> {
+ async edit_pool_pg(name: string, new_pg: number): Promise<void> {
if (!this.isPowerOf2(new_pg)) {
return Promise.reject(`Placement groups ${new_pg} are not a power of 2`);
}
- return this.getTableCellByContent(name).then((elem) => {
- elem.click(); // select pool from the table
- element(by.cssContainingText('button', 'Edit')).click(); // click edit button
- expect(this.getBreadcrumbText()).toEqual('Edit'); // verify we are now on edit page
- $('input[name=pgNum]')
- .sendKeys(protractor.Key.CONTROL, 'a', protractor.Key.NULL, new_pg)
- .then(() => {
- element(by.css('cd-submit-button')).click();
- const str = `${new_pg} active+clean`;
- browser
- .wait(
- EC.visibilityOf(this.getTableRow(name)),
- Helper.TIMEOUT,
- 'Timed out waiting for table row to load'
- )
- .then(() => {
- return browser.wait(
- EC.textToBePresentInElement(this.getTableRow(name), str),
- Helper.TIMEOUT,
- 'Timed out waiting for placement group to be updated'
- );
- });
- });
- });
+ const elem = await this.getTableCellByContent(name);
+ await elem.click(); // select pool from the table
+ await element(by.cssContainingText('button', 'Edit')).click(); // click edit button
+ expect(await this.getBreadcrumbText()).toEqual('Edit'); // verify we are now on edit page
+ await $('input[name=pgNum]').sendKeys(protractor.Key.CONTROL, 'a', protractor.Key.NULL, new_pg);
+ await element(by.css('cd-submit-button')).click();
+ const str = `${new_pg} active+clean`;
+ await browser.wait(
+ EC.visibilityOf(this.getTableRow(name)),
+ Helper.TIMEOUT,
+ 'Timed out waiting for table row to load'
+ );
+ await browser.wait(
+ EC.textToBePresentInElement(this.getTableRow(name), str),
+ Helper.TIMEOUT,
+ 'Timed out waiting for placement group to be updated'
+ );
}
- private setApplications(apps: string[]) {
+ private async setApplications(apps: string[]) {
if (!apps || apps.length === 0) {
return;
}
- element(by.css('.float-left.mr-2.select-menu-edit'))
- .click()
- .then(() => {
- browser
- .wait(
- Helper.EC.visibilityOf(element(by.css('.popover-content.popover-body'))),
- Helper.TIMEOUT
- )
- .then(() =>
- apps.forEach((app) =>
- element(by.cssContainingText('.select-menu-item-content', app)).click()
- )
- );
- });
+ await element(by.css('.float-left.mr-2.select-menu-edit')).click();
+ await browser.wait(
+ Helper.EC.visibilityOf(element(by.css('.popover-content.popover-body'))),
+ Helper.TIMEOUT
+ );
+ apps.forEach(
+ async (app) => await element(by.cssContainingText('.select-menu-item-content', app)).click()
+ );
}
@PageHelper.restrictTo(pages.index)