import { $, $$, browser, by, element } from 'protractor';
-import { Helper } from '../helper.po';
import { PageHelper } from '../page-helper.po';
export class ImagesPageHelper extends PageHelper {
// Click the create button and wait for image to be made
await element(by.cssContainingText('button', 'Create RBD')).click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitPresence(this.getTableCell(name));
}
async editImage(name, pool, newName, newSize) {
await element(by.cssContainingText('button', 'Edit RBD')).click();
await this.navigateTo();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(newName)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(newName));
// click edit button and wait to make sure new owner is present in table
await this.getTableCell(newName).click();
await expect(
await this.navigateTo();
// wait for table to load
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(name));
await this.getTableCell(name).click(); // click on the image you want to delete in the table
await $$('.table-actions button.dropdown-toggle')
.first()
.click(); // click toggle menu
await $('li.delete.ng-star-inserted').click(); // click delete
// wait for pop-up to be visible (checks for title of pop-up)
- await browser.wait(Helper.EC.visibilityOf($('.modal-body')), Helper.TIMEOUT);
+ await this.waitVisibility($('.modal-body'));
await this.clickCheckbox($('.custom-control-label'));
await element(by.cssContainingText('button', 'Delete RBD')).click();
- await browser.wait(Helper.EC.stalenessOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitStaleness(this.getTableCell(name));
}
}
-import { $, browser, by, element } from 'protractor';
-import { Helper } from '../helper.po';
+import { $, by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
const pages = { index: '/#/block/mirroring' };
@PageHelper.restrictTo(pages.index)
async editMirror(name, option) {
// Clicks the pool in the table
- await browser.wait(
- Helper.EC.elementToBeClickable(this.getFirstTableCellWithText(name)),
- Helper.TIMEOUT
- );
+ await this.waitClickable(this.getFirstTableCellWithText(name));
await this.getFirstTableCellWithText(name).click();
// Clicks the Edit Mode button
const editModeButton = element(by.cssContainingText('button', 'Edit Mode'));
- await browser.wait(Helper.EC.elementToBeClickable(editModeButton), Helper.TIMEOUT);
+ await this.waitClickable(editModeButton);
await editModeButton.click();
// Clicks the drop down in the edit pop-up, then clicks the Update button
- await browser.wait(Helper.EC.visibilityOf($('.modal-content')), Helper.TIMEOUT);
+ await this.waitVisibility($('.modal-content'));
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
await element(by.cssContainingText('button', 'Update')).click();
- await browser.wait(
- Helper.EC.stalenessOf(
- element(by.cssContainingText('.modal-dialog', 'Edit pool mirror mode'))
- ),
- Helper.TIMEOUT
+ await this.waitStaleness(
+ element(by.cssContainingText('.modal-dialog', 'Edit pool mirror mode'))
);
const val = option.toLowerCase(); // used since entries in table are lower case
- await browser.wait(Helper.EC.visibilityOf(this.getFirstTableCellWithText(val)), Helper.TIMEOUT);
+ await this.waitVisibility(this.getFirstTableCellWithText(val));
}
}
-import { $, browser, by, element, protractor } from 'protractor';
-import { Helper } from '../helper.po';
+import { $, by, element, protractor } from 'protractor';
import { PageHelper } from '../page-helper.po';
export class ConfigurationPageHelper extends PageHelper {
await $('input.form-control.ng-valid').sendKeys(name);
// Selects config that we want to clear
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT); // waits for config to be clickable
+ await this.waitClickable(this.getTableCell(name)); // waits for config to be clickable
await this.getTableCell(name).click(); // click on the config to edit
await element(by.cssContainingText('button', 'Edit')).click(); // clicks button to edit
await $('input.form-control.ng-valid').clear();
await $('input.form-control.ng-valid').sendKeys(name);
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(name));
await this.getTableCell(name).click();
// Clicks desired config
- await browser.wait(
- Helper.EC.visibilityOf($('.table.table-striped.table-bordered')), // Checks for visibility of details tab
- Helper.TIMEOUT,
+ await this.waitVisibility(
+ $('.table.table-striped.table-bordered'), // Checks for visibility of details tab
'config details did not appear'
);
for (const i of valList) {
// Waits until values are not present in the details table
- await browser.wait(
- Helper.EC.not(
- Helper.EC.textToBePresentInElement($('.table.table-striped.table-bordered'), i + ':')
- ),
- Helper.TIMEOUT
- );
+ await this.waitTextNotPresent($('.table.table-striped.table-bordered'), i + ':');
}
}
await $('input.form-control.ng-valid').sendKeys(name);
// Selects config that we want to edit
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT); // waits for config to be clickable
+ await this.waitClickable(this.getTableCell(name)); // waits for config to be clickable
await this.getTableCell(name).click(); // click on the config to edit
await element(by.cssContainingText('button', 'Edit')).click(); // clicks button to edit
await $('input.form-control.ng-valid').clear();
await $('input.form-control.ng-valid').sendKeys(name);
- await browser.wait(Helper.EC.visibilityOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitVisibility(this.getTableCell(name));
// Checks for visibility of config in table
await this.getTableCell(name).click();
// Clicks config
for (let i = 0, valtuple; (valtuple = values[i]); i++) {
// iterates through list of values and
- await browser.wait(
+ await this.waitTextToBePresent(
// checks if the value appears in details with the correct number attatched
- Helper.EC.textToBePresentInElement(
- $('.table.table-striped.table-bordered'),
- valtuple[0] + ': ' + valtuple[1]
- ),
- Helper.TIMEOUT
+ $('.table.table-striped.table-bordered'),
+ valtuple[0] + ': ' + valtuple[1]
);
}
}
-import { $, browser } from 'protractor';
+import { $ } from 'protractor';
import { Helper } from '../helper.po';
import { CrushMapPageHelper } from './crush-map.po';
await expect(crushmap.getCrushNode(1).getText()).toEqual(label);
// Check that table appears once OSD is clicked
- await browser.wait(Helper.EC.visibilityOf($('.datatable-body')));
+ await crushmap.waitVisibility($('.datatable-body'));
await expect($('.datatable-body').isDisplayed()).toBe(true);
});
});
import { $, $$, browser, by, element, protractor } from 'protractor';
-import { Helper } from '../helper.po';
import { PageHelper } from '../page-helper.po';
browser.ignoreSynchronization = true;
// sometimes the modal from deleting pool is still present at this point.
// This wait makes sure it isn't
- await browser.wait(
- Helper.EC.stalenessOf(element(by.cssContainingText('.modal-dialog', 'Delete Pool'))),
- Helper.TIMEOUT
- );
+ await this.waitStaleness(element(by.cssContainingText('.modal-dialog', 'Delete Pool')));
// go to audit logs tab
await element(by.cssContainingText('.nav-link', 'Audit Logs')).click();
const audit_logs_body = audit_logs_tab.element(by.css('.card-body'));
const logs = audit_logs_body.all(by.cssContainingText('.ng-star-inserted', configname));
- await browser.wait(Helper.EC.presenceOf(logs.first()), Helper.TIMEOUT);
+ await this.waitPresence(logs.first());
await expect(logs.getText()).toMatch(configname);
await expect(logs.getText()).toMatch(setting);
-import { $$, browser, by, element } from 'protractor';
-import { Helper } from '../helper.po';
+import { $$, by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
export class ManagerModulesPageHelper extends PageHelper {
// Doesn't check/uncheck boxes because it is not reflected in the details table.
// DOES NOT WORK FOR ALL MGR MODULES, for example, Device health
await this.navigateTo();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(name));
await this.getTableCell(name).click();
await element(by.cssContainingText('button', 'Edit')).click();
await element(by.cssContainingText('button', 'Update')).click();
// Checks if edits appear
await this.navigateTo();
- await browser.wait(Helper.EC.visibilityOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitVisibility(this.getTableCell(name));
await this.getTableCell(name).click();
for (const entry of tuple) {
- await browser.wait(
- Helper.EC.textToBePresentInElement($$('.datatable-body').last(), entry[0]),
- Helper.TIMEOUT
- );
+ await this.waitTextToBePresent($$('.datatable-body').last(), entry[0]);
}
// Clear mgr module of all edits made to it
await this.navigateTo();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(name));
await this.getTableCell(name).click();
await element(by.cssContainingText('button', 'Edit')).click();
// Checks that clearing represents in details tab of module
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await browser.wait(Helper.EC.visibilityOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitVisibility(this.getTableCell(name));
await this.getTableCell(name).click();
for (const entry of tuple) {
- await browser.wait(
- Helper.EC.not(Helper.EC.textToBePresentInElement($$('.datatable-body').last(), entry[0])),
- Helper.TIMEOUT
- );
+ await this.waitTextNotPresent($$('.datatable-body').last(), entry[0]);
}
}
[warn, 'warn_threshold']
];
- await browser.wait(
- Helper.EC.elementToBeClickable(this.getTableCell('devicehealth')),
- Helper.TIMEOUT
- );
+ await this.waitClickable(this.getTableCell('devicehealth'));
await this.getTableCell('devicehealth').click();
await element(by.cssContainingText('button', 'Edit')).click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await browser.wait(Helper.EC.visibilityOf(this.getTableCell('devicehealth')), Helper.TIMEOUT);
+ await this.waitVisibility(this.getTableCell('devicehealth'));
// Checks for visibility of devicehealth in table
await this.getTableCell('devicehealth').click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
if (devHealthTuple[0] !== undefined) {
- await browser.wait(async function() {
+ await this.waitFn(async () => {
// Repeatedly reclicks the module to check if edits has been done
await element(by.cssContainingText('.datatable-body-cell-label', 'devicehealth')).click();
- return Helper.EC.textToBePresentInElement(
- $$('.datatable-body').last(),
- devHealthTuple[0]
- );
- }, Helper.TIMEOUT);
+ return this.waitTextToBePresent($$('.datatable-body').last(), devHealthTuple[0]);
+ });
}
}
// (on my local run of ceph-dev, this is subject to change i would assume). I'd imagine there is a
// better way of doing this.
await this.navigateTo();
- await browser.wait(
- Helper.EC.elementToBeClickable(this.getTableCell('devicehealth')),
- Helper.TIMEOUT
- ); // checks ansible
+ await this.waitClickable(this.getTableCell('devicehealth')); // checks ansible
await this.getTableCell('devicehealth').click();
await element(by.cssContainingText('button', 'Edit')).click();
await this.clearInput(element(by.id('mark_out_threshold')));
await element(by.id('warn_threshold')).sendKeys('7257600');
// Checks that clearing represents in details tab of ansible
- await browser.wait(
- Helper.EC.elementToBeClickable(element(by.cssContainingText('button', 'Update')))
- );
+ await this.waitClickable(element(by.cssContainingText('button', 'Update')));
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await browser.wait(Helper.EC.visibilityOf(this.getTableCell('devicehealth')), Helper.TIMEOUT);
+ await this.waitVisibility(this.getTableCell('devicehealth'));
await this.getTableCell('devicehealth').click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
if (devHealthTuple[0] !== undefined) {
- await browser.wait(async function() {
+ await this.waitFn(async () => {
// Repeatedly reclicks the module to check if clearing has been done
await element(by.cssContainingText('.datatable-body-cell-label', 'devicehealth')).click();
- return Helper.EC.not(
- Helper.EC.textToBePresentInElement($$('.datatable-body').last(), devHealthTuple[0])
- );
- }, Helper.TIMEOUT);
+ return this.waitTextNotPresent($$('.datatable-body').last(), devHealthTuple[0]);
+ });
}
}
}
import { UserMgmtPageHelper } from './user-mgmt.po';
export class Helper {
- static EC = browser.ExpectedConditions;
- static TIMEOUT = 10000;
-
pools: PoolPageHelper;
buckets: BucketsPageHelper;
images: ImagesPageHelper;
ElementFinder,
protractor
} from 'protractor';
-import { Helper } from './helper.po';
const EC = browser.ExpectedConditions;
+const TIMEOUT = 20000;
interface Pages {
index: string;
if (tableCount > 0) {
const progressBars = element.all(by.css('cd-table datatable-progress'));
await progressBars.each(async (progressBar) => {
- await browser.wait(EC.not(EC.presenceOf(progressBar)), Helper.TIMEOUT);
+ await browser.wait(EC.stalenessOf(progressBar), TIMEOUT);
});
}
getLegends(): ElementArrayFinder {
return $$('legend');
}
+
+ async waitPresence(elem: ElementFinder, message?: string) {
+ return browser.wait(EC.presenceOf(elem), TIMEOUT, message);
+ }
+
+ async waitStaleness(elem: ElementFinder, message?: string) {
+ return browser.wait(EC.stalenessOf(elem), TIMEOUT, message);
+ }
+
+ async waitClickable(elem: ElementFinder, message?: string) {
+ return browser.wait(EC.elementToBeClickable(elem), TIMEOUT, message);
+ }
+
+ async waitVisibility(elem: ElementFinder, message?: string) {
+ return browser.wait(EC.visibilityOf(elem), TIMEOUT, message);
+ }
+
+ async waitInvisibility(elem: ElementFinder, message?: string) {
+ return browser.wait(EC.invisibilityOf(elem), TIMEOUT, message);
+ }
+
+ async waitTextToBePresent(elem: ElementFinder, text: string, message?: string) {
+ return browser.wait(EC.textToBePresentInElement(elem, text), TIMEOUT, message);
+ }
+
+ async waitTextNotPresent(elem: ElementFinder, text: string, message?: string) {
+ return browser.wait(EC.not(EC.textToBePresentInElement(elem, text)), TIMEOUT, message);
+ }
+
+ async waitFn(func: Function, message?: string) {
+ return browser.wait(func, TIMEOUT, message);
+ }
}
-import { $, browser, by, element, protractor } from 'protractor';
-import { Helper } from '../helper.po';
+import { $, by, element, protractor } from 'protractor';
import { PageHelper } from '../page-helper.po';
-const EC = protractor.ExpectedConditions;
const pages = {
index: '/#/pool',
create: '/#/pool/create'
@PageHelper.restrictTo(pages.index)
async exist(name: string, oughtToBePresent = true) {
const tableCell = await this.getTableCellByContent(name);
- const waitFn = oughtToBePresent ? EC.visibilityOf(tableCell) : EC.invisibilityOf(tableCell);
+ const waitFn = oughtToBePresent ? this.waitVisibility : this.waitInvisibility;
try {
- await browser.wait(waitFn, Helper.TIMEOUT);
+ await waitFn(tableCell);
} catch (e) {
const visibility = oughtToBePresent ? 'invisible' : 'visible';
const msg = `Pool "${name}" is ${visibility}, but should not be. Waiting for a change timed out`;
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,
+ await this.waitVisibility(this.getTableRow(name), 'Timed out waiting for table row to load');
+ await this.waitTextToBePresent(
+ this.getTableRow(name),
+ str,
'Timed out waiting for placement group to be updated'
);
}
return;
}
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
- );
+ await this.waitVisibility(element(by.css('.popover-content.popover-body')));
apps.forEach(
async (app) => await element(by.cssContainingText('.select-menu-item-content', app)).click()
);
await $('.table-actions button.dropdown-toggle').click(); // open submenu
await $('li.delete a').click(); // click on "delete" menu item
const confirmationInput = () => $('#confirmation');
- await browser.wait(() => EC.visibilityOf(confirmationInput()), Helper.TIMEOUT);
+ await this.waitPresence(confirmationInput());
await this.clickCheckbox(confirmationInput());
await element(by.cssContainingText('button', 'Delete Pool')).click(); // Click Delete item
-import { $, browser, by, element } from 'protractor';
-import { Helper } from '../helper.po';
+import { $, by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
const pages = {
const createButton = element(by.cssContainingText('button', 'Create Bucket'));
await createButton.click();
- return browser.wait(
- Helper.EC.presenceOf(this.getTableCell(name)),
- Helper.TIMEOUT,
- 'Timed out waiting for bucket creation'
- );
+ return this.waitPresence(this.getTableCell(name), 'Timed out waiting for bucket creation');
}
@PageHelper.restrictTo(pages.index)
await element(by.cssContainingText('button', 'Edit Bucket')).click();
// wait to be back on buckets page with table visible
- await browser.wait(
- Helper.EC.elementToBeClickable(this.getTableCell(name)),
- 10000,
+ await this.waitClickable(
+ this.getTableCell(name),
'Could not return to buckets page and load table after editing bucket'
);
@PageHelper.restrictTo(pages.index)
async delete(name) {
// wait for table to load
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitClickable(this.getTableCell(name));
await this.getTableCell(name).click(); // click on the bucket you want to delete in the table
await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
await $('li.delete a').click(); // click delete
// wait for pop-up to be visible (checks for title of pop-up)
- await browser.wait(Helper.EC.visibilityOf($('.modal-title.float-left')), Helper.TIMEOUT);
- await browser.wait(Helper.EC.visibilityOf($('.custom-control-label')), Helper.TIMEOUT);
+ await this.waitVisibility($('.modal-title.float-left'));
+ await this.waitVisibility($('.custom-control-label'));
await $('.custom-control-label').click();
await element(by.cssContainingText('button', 'Delete bucket')).click();
await this.navigateTo();
- return browser.wait(
- Helper.EC.not(Helper.EC.presenceOf(this.getTableCell(name))),
- Helper.TIMEOUT
- );
+ return this.waitStaleness(this.getTableCell(name));
}
async testInvalidCreate() {
await ownerDropDown.click(); // To trigger a validation
- await browser.wait(
- async () => {
- // Waiting for website to decide if name is valid or not
- const klass = await nameInputField.getAttribute('class');
- return !klass.includes('ng-pending');
- },
- 5000,
- 'Timed out waiting for dashboard to decide bucket name validity'
- );
+ await this.waitFn(async () => {
+ // Waiting for website to decide if name is valid or not
+ const klass = await nameInputField.getAttribute('class');
+ return !klass.includes('ng-pending');
+ }, 'Timed out waiting for dashboard to decide bucket name validity');
// Check that name input field was marked invalid in the css
await expect(nameInputField.getAttribute('class')).toContain('ng-invalid');
async testInvalidEdit(name) {
await this.navigateTo();
- await browser.wait(
- Helper.EC.elementToBeClickable(this.getTableCell(name)),
- 10000,
+ await this.waitClickable(
+ this.getTableCell(name),
'Failed waiting for bucket to be present in table'
); // wait for table to load
await this.getTableCell(name).click(); // click on the bucket you want to edit in the table
// Chooses 'Select a user' rather than a valid owner on Edit Bucket page
// and checks if it's an invalid input
const ownerDropDown = element(by.id('owner'));
- await browser.wait(Helper.EC.elementToBeClickable(ownerDropDown), Helper.TIMEOUT);
+ await this.waitClickable(ownerDropDown);
await ownerDropDown.click(); // Clicks the Owner drop down on the Create Bucket page
// select the first option, which is invalid because it is a placeholder
-import { $, browser, by, element } from 'protractor';
+import { $, by, element } from 'protractor';
import { protractor } from 'protractor/built/ptor';
-import { Helper } from '../helper.po';
import { PageHelper } from '../page-helper.po';
export class UsersPageHelper extends PageHelper {
// Click the create button and wait for user to be made
await element(by.cssContainingText('button', 'Create User')).click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(username)), 10000);
+ await this.waitPresence(this.getTableCell(username));
}
async edit(name, new_fullname, new_email, new_maxbuckets) {
await this.navigateTo();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), 10000); // wait for table to load
+ await this.waitClickable(this.getTableCell(name)); // wait for table to load
await this.getTableCell(name).click(); // click on the bucket you want to edit in the table
await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
const editbutton = element(by.cssContainingText('button', 'Edit User'));
await editbutton.click();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(name)), 10000);
+ await this.waitClickable(this.getTableCell(name));
// Click the user and check its details table for updated content
await this.getTableCell(name).click();
await expect($('.active.tab-pane').getText()).toMatch(new_fullname); // check full name was changed
// wait for table to load
const my_user = this.getFirstTableCellWithText(name);
- await browser.wait(Helper.EC.elementToBeClickable(my_user), 10000);
+ await this.waitClickable(my_user);
await my_user.click(); // click on the user you want to delete in the table
await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
await $('li.delete a').click(); // click delete
// wait for pop-up to be visible (checks for title of pop-up)
- await browser.wait(Helper.EC.visibilityOf($('.modal-title.float-left')), 10000);
- await browser.wait(Helper.EC.visibilityOf($('.custom-control-label')), 5000);
+ await this.waitVisibility($('.modal-title.float-left'));
+ await this.waitVisibility($('.custom-control-label'));
await $('.custom-control-label').click(); // click confirmation checkbox
await element(by.cssContainingText('button', 'Delete user')).click();
- await browser.wait(
- Helper.EC.not(Helper.EC.presenceOf(this.getFirstTableCellWithText(name))),
- 10000
- );
+ await this.waitStaleness(this.getFirstTableCellWithText(name));
}
async invalidCreate() {
// Try to give user already taken name. Should make field invalid.
await username_field.clear();
await username_field.sendKeys(uname);
- await browser.wait(
- async () => !(await username_field.getAttribute('class')).includes('ng-pending'),
- 6000
+ await this.waitFn(
+ async () => !(await username_field.getAttribute('class')).includes('ng-pending')
);
await expect(username_field.getAttribute('class')).toContain('ng-invalid');
await element(by.id('display_name')).click(); // trigger validation check
await this.navigateTo();
- await browser.wait(Helper.EC.elementToBeClickable(this.getTableCell(uname)), 10000); // wait for table to load
+ await this.waitClickable(this.getTableCell(uname)); // wait for table to load
await this.getTableCell(uname).click(); // click on the bucket you want to edit in the table
await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
await element(by.id('email')).click();
await element(by.id('email')).clear();
await element(by.id('email')).sendKeys('a');
- await browser.wait(
- async () => !(await element(by.id('email')).getAttribute('class')).includes('ng-pending'),
- 6000
+ await this.waitFn(
+ async () => !(await element(by.id('email')).getAttribute('class')).includes('ng-pending')
);
await expect(element(by.id('email')).getAttribute('class')).toContain('ng-invalid');
await element(by.id('display_name')).click(); // trigger validation check
-import { $, browser, by, element } from 'protractor';
-import { Helper } from './helper.po';
+import { $, by, element } from 'protractor';
import { PageHelper } from './page-helper.po';
export class UserMgmtPageHelper extends PageHelper {
// Click the create button and wait for user to be made
const createButton = element(by.cssContainingText('button', 'Create User'));
await createButton.click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(username)), Helper.TIMEOUT);
+ await this.waitPresence(this.getTableCell(username));
}
async userEdit(username, password, name, email): Promise<void> {
// Click the edit button and check new values are present in table
const editButton = element(by.cssContainingText('button', 'Edit User'));
await editButton.click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(email)), Helper.TIMEOUT);
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitPresence(this.getTableCell(email));
+ await this.waitPresence(this.getTableCell(name));
}
async userDelete(username): Promise<void> {
await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
await $('li.delete a').click(); // click delete
- await browser.wait(Helper.EC.visibilityOf($('.custom-control-label')), Helper.TIMEOUT);
+ await this.waitVisibility($('.custom-control-label'));
await $('.custom-control-label').click(); // click confirmation checkbox
await element(by.cssContainingText('button', 'Delete User')).click();
- await browser.wait(
- Helper.EC.stalenessOf(this.getFirstTableCellWithText(username)),
- Helper.TIMEOUT
- );
+ await this.waitStaleness(this.getFirstTableCellWithText(username));
}
async roleCreate(name, description): Promise<void> {
// Click the create button and wait for user to be made
const createButton = element(by.cssContainingText('button', 'Create Role'));
await createButton.click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(name)), Helper.TIMEOUT);
+ await this.waitPresence(this.getTableCell(name));
}
async roleEdit(name, description): Promise<void> {
const editButton = element(by.cssContainingText('button', 'Edit Role'));
await editButton.click();
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(name)), Helper.TIMEOUT);
- await browser.wait(Helper.EC.presenceOf(this.getTableCell(description)), Helper.TIMEOUT);
+ await this.waitPresence(this.getTableCell(name));
+ await this.waitPresence(this.getTableCell(description));
}
async roleDelete(name) {
await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
await $('li.delete a').click(); // click delete
- await browser.wait(Helper.EC.visibilityOf($('.custom-control-label')), Helper.TIMEOUT);
+ await this.waitVisibility($('.custom-control-label'));
await $('.custom-control-label').click(); // click confirmation checkbox
await element(by.cssContainingText('button', 'Delete Role')).click();
- await browser.wait(Helper.EC.stalenessOf(this.getFirstTableCellWithText(name)), Helper.TIMEOUT);
+ await this.waitStaleness(this.getFirstTableCellWithText(name));
}
}