it('should create image', async () => {
await images.createImage(imageName, poolName, '1');
- await expect(images.getTableCell(imageName).isPresent()).toBe(true);
+ await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
});
it('should edit image', async () => {
await images.editImage(imageName, poolName, newImageName, '2');
- await expect(images.getTableCell(newImageName).isPresent()).toBe(true);
+ await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
});
it('should delete image', async () => {
await images.navigateTo(); // Need image for trash testing
await images.createImage(imageName, poolName, '1');
- await expect(images.getTableCell(imageName).isPresent()).toBe(true);
+ await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
});
it('should move the image to the trash', async () => {
await images.moveToTrash(imageName);
- await expect(images.getTableCell(imageName).isPresent()).toBe(true);
+ await expect(images.getFirstTableCellWithText(imageName).isPresent()).toBe(true);
});
it('should restore image to images table', async () => {
await images.restoreImage(imageName, newImageName);
- await expect(images.getTableCell(newImageName).isPresent()).toBe(true);
+ await expect(images.getFirstTableCellWithText(newImageName).isPresent()).toBe(true);
});
it('should purge trash in images trash tab', async () => {
await images.navigateTo();
// Have had issues with image not restoring fast enough, thus these tests/waits are here
await images.waitPresence(
- images.getTableCell(newImageName),
+ images.getFirstTableCellWithText(newImageName),
'Timed out waiting for image to restore'
);
await images.waitClickable(
- images.getTableCell(newImageName),
+ images.getFirstTableCellWithText(newImageName),
'Timed out waiting for image to be clickable'
);
await images.moveToTrash(newImageName);
// Click the create button and wait for image to be made
await element(by.cssContainingText('button', 'Create RBD')).click();
- await this.waitPresence(this.getTableCell(name));
+ await this.waitPresence(this.getFirstTableCellWithText(name));
}
async editImage(name, pool, newName, newSize) {
await element(by.cssContainingText('button', 'Edit RBD')).click();
await this.navigateTo();
- await this.waitClickable(this.getTableCell(newName));
+ await this.waitClickable(this.getFirstTableCellWithText(newName));
// click edit button and wait to make sure new owner is present in table
- await this.getTableCell(newName).click();
+ await this.getFirstTableCellWithText(newName).click();
await expect(
element
.all(by.css('.table.table-striped.table-bordered'))
await this.navigateTo();
// wait for image to be created
await this.waitTextNotPresent($$('.datatable-body').first(), '(Creating...)');
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
// click on the drop down and selects the move to trash option
await $$('.table-actions button.dropdown-toggle')
.first()
// Clicks trash tab
await this.waitClickable(element(by.cssContainingText('.nav-link', 'Trash')));
await element(by.cssContainingText('.nav-link', 'Trash')).click();
- await this.waitPresence(this.getTableCell(name));
+ await this.waitPresence(this.getFirstTableCellWithText(name));
}
// Checks trash tab table for image and then restores it to the RBD Images table
// clicks on trash tab
await element(by.cssContainingText('.nav-link', 'Trash')).click();
// wait for table to load
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
await element(by.cssContainingText('button', 'Restore')).click();
// wait for pop-up to be visible (checks for title of pop-up)
await this.waitVisibility(element(by.id('name')));
// clicks images tab
await element(by.cssContainingText('.nav-link', 'Images')).click();
await this.navigateTo();
- await this.waitPresence(this.getTableCell(newName));
+ await this.waitPresence(this.getFirstTableCellWithText(newName));
}
// Enters trash tab and purges trash, thus emptying the trash table. Checks if
await this.waitClickable(element(by.id('purgeFormButton')));
await element(by.id('purgeFormButton')).click();
// Wait for image to delete and check it is not present
- await this.waitStaleness(this.getTableCell(name), 'Timed out waiting for image to be purged');
- await expect(this.getTableCell(name).isPresent()).toBe(false);
+ await this.waitStaleness(
+ this.getFirstTableCellWithText(name),
+ 'Timed out waiting for image to be purged'
+ );
+ await expect(this.getFirstTableCellWithText(name).isPresent()).toBe(false);
}
}
await $('input.form-control.ng-valid').sendKeys(name);
// Selects config that we want to clear
- await this.waitClickable(this.getTableCell(name)); // waits for config to be clickable
- await this.getTableCell(name).click(); // click on the config to edit
+ await this.waitClickable(this.getFirstTableCellWithText(name)); // waits for config to be clickable
+ await this.getFirstTableCellWithText(name).click(); // click on the config to edit
await element(by.cssContainingText('button', 'Edit')).click(); // clicks button to edit
for (const i of valList) {
await $('input.form-control.ng-valid').clear();
await $('input.form-control.ng-valid').sendKeys(name);
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
// Clicks desired config
await this.waitVisibility(
$('.table.table-striped.table-bordered'), // Checks for visibility of details tab
await $('input.form-control.ng-valid').sendKeys(name);
// Selects config that we want to edit
- await this.waitClickable(this.getTableCell(name)); // waits for config to be clickable
- await this.getTableCell(name).click(); // click on the config to edit
+ await this.waitClickable(this.getFirstTableCellWithText(name)); // waits for config to be clickable
+ await this.getFirstTableCellWithText(name).click(); // click on the config to edit
await element(by.cssContainingText('button', 'Edit')).click(); // clicks button to edit
await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
await $('input.form-control.ng-valid').clear();
await $('input.form-control.ng-valid').sendKeys(name);
- await this.waitVisibility(this.getTableCell(name));
+ await this.waitVisibility(this.getFirstTableCellWithText(name));
// Checks for visibility of config in table
- await this.getTableCell(name).click();
+ await this.getFirstTableCellWithText(name).click();
// Clicks config
for (let i = 0, valtuple; (valtuple = values[i]); i++) {
// iterates through list of values and
// 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 this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
await element(by.cssContainingText('button', 'Edit')).click();
for (const entry of tuple) {
await element(by.cssContainingText('button', 'Update')).click();
// Checks if edits appear
await this.navigateTo();
- await this.waitVisibility(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitVisibility(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
for (const entry of tuple) {
await this.waitTextToBePresent($$('.datatable-body').last(), entry[0]);
}
// Clear mgr module of all edits made to it
await this.navigateTo();
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
await element(by.cssContainingText('button', 'Edit')).click();
// Clears the editable fields
// Checks that clearing represents in details tab of module
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await this.waitVisibility(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitVisibility(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
for (const entry of tuple) {
await this.waitTextNotPresent($$('.datatable-body').last(), entry[0]);
}
[warn, 'warn_threshold']
];
- await this.waitClickable(this.getTableCell('devicehealth'));
- await this.getTableCell('devicehealth').click();
+ await this.waitClickable(this.getFirstTableCellWithText('devicehealth'));
+ await this.getFirstTableCellWithText('devicehealth').click();
await element(by.cssContainingText('button', 'Edit')).click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
if (devHealthTuple[0] !== undefined) {
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await this.waitVisibility(this.getTableCell('devicehealth'));
+ await this.waitVisibility(this.getFirstTableCellWithText('devicehealth'));
// Checks for visibility of devicehealth in table
- await this.getTableCell('devicehealth').click();
+ await this.getFirstTableCellWithText('devicehealth').click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
if (devHealthTuple[0] !== undefined) {
await this.waitFn(async () => {
// (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 this.waitClickable(this.getTableCell('devicehealth')); // checks ansible
- await this.getTableCell('devicehealth').click();
+ await this.waitClickable(this.getFirstTableCellWithText('devicehealth')); // checks ansible
+ await this.getFirstTableCellWithText('devicehealth').click();
await element(by.cssContainingText('button', 'Edit')).click();
await this.clearInput(element(by.id('mark_out_threshold')));
await element(by.id('mark_out_threshold')).sendKeys('2419200');
await this.waitClickable(element(by.cssContainingText('button', 'Update')));
await element(by.cssContainingText('button', 'Update')).click();
await this.navigateTo();
- await this.waitVisibility(this.getTableCell('devicehealth'));
- await this.getTableCell('devicehealth').click();
+ await this.waitVisibility(this.getFirstTableCellWithText('devicehealth'));
+ await this.getFirstTableCellWithText('devicehealth').click();
for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
if (devHealthTuple[0] !== undefined) {
await this.waitFn(async () => {
return Number(text.match(/(\d+)\s+selected/)[1]);
}
- getTableCell(content: string): ElementFinder {
+ getFirstTableCellWithText(content: string): ElementFinder {
return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first();
}
return $$('.nav.nav-tabs li').count();
}
- /**
- * Searches multiple tables and returns the first cell of any table that matches the criteria.
- */
- getFirstTableCellWithText(content: string): ElementFinder {
- return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first();
- }
-
/**
* Ceph Dashboards' <input type="checkbox"> tag is not visible. Instead of the real checkbox, a
* replacement is shown which is supposed to have an adapted style. The replacement checkbox shown
*/
async delete(name: string): Promise<any> {
// Selects row
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
+ await this.waitClickable(this.getFirstTableCellWithText(name));
+ await this.getFirstTableCellWithText(name).click();
// Clicks on table Delete button
await $$('.table-actions button.dropdown-toggle')
await element(by.cssContainingText('button', 'Delete')).click();
// Waits for item to be removed from table
- return this.waitStaleness(this.getTableCell(name));
+ return this.waitStaleness(this.getFirstTableCellWithText(name));
}
}
'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
'default-placement'
);
- await expect(buckets.getTableCell('000test').isPresent()).toBe(true);
+ await expect(buckets.getFirstTableCellWithText('000test').isPresent()).toBe(true);
});
it('should edit bucket', async () => {
const createButton = element(by.cssContainingText('button', 'Create Bucket'));
await createButton.click();
- return this.waitPresence(this.getTableCell(name), 'Timed out waiting for bucket creation');
+ return this.waitPresence(
+ this.getFirstTableCellWithText(name),
+ 'Timed out waiting for bucket creation'
+ );
}
@PageHelper.restrictTo(pages.index)
async edit(name: string, new_owner: string) {
- await this.getTableCell(name).click(); // click on the bucket you want to edit in the table
+ await this.getFirstTableCellWithText(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
await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
await expect(element(by.css('input[name=placement-target]')).getAttribute('value')).toBe(
// wait to be back on buckets page with table visible
await this.waitClickable(
- this.getTableCell(name),
+ this.getFirstTableCellWithText(name),
'Could not return to buckets page and load table after editing bucket'
);
// click on edited bucket and check its details table for edited owner field
- const promise = await this.getTableCell(name).click();
+ const promise = await this.getFirstTableCellWithText(name).click();
const element_details_table = element
.all(by.css('.table.table-striped.table-bordered'))
.first();
await this.navigateTo();
await this.waitClickable(
- this.getTableCell(name),
+ this.getFirstTableCellWithText(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
+ await this.getFirstTableCellWithText(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
await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
it('should create user', async () => {
await users.create(user_name, 'Some Name', 'original@website.com', '1200');
- await expect(users.getTableCell(user_name).isPresent()).toBe(true);
+ await expect(users.getFirstTableCellWithText(user_name).isPresent()).toBe(true);
});
it('should edit users full name, email and max buckets', async () => {
// Click the create button and wait for user to be made
await element(by.cssContainingText('button', 'Create User')).click();
- await this.waitPresence(this.getTableCell(username));
+ await this.waitPresence(this.getFirstTableCellWithText(username));
}
async edit(name, new_fullname, new_email, new_maxbuckets) {
await this.navigateTo();
- 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 this.waitClickable(this.getFirstTableCellWithText(name)); // wait for table to load
+ await this.getFirstTableCellWithText(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
await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
const editbutton = element(by.cssContainingText('button', 'Edit User'));
await editbutton.click();
- await this.waitClickable(this.getTableCell(name));
+ await this.waitClickable(this.getFirstTableCellWithText(name));
// Click the user and check its details table for updated content
- await this.getTableCell(name).click();
+ await this.getFirstTableCellWithText(name).click();
await expect($('.active.tab-pane').getText()).toMatch(new_fullname); // check full name was changed
await expect($('.active.tab-pane').getText()).toMatch(new_email); // check email was changed
await expect($('.active.tab-pane').getText()).toMatch(new_maxbuckets); // check max buckets was changed
await this.navigateTo();
- 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 this.waitClickable(this.getFirstTableCellWithText(uname)); // wait for table to load
+ await this.getFirstTableCellWithText(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 this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
const createButton = element(by.cssContainingText('button', 'Create Role'));
await createButton.click();
- await this.waitPresence(this.getTableCell(name));
+ await this.waitPresence(this.getFirstTableCellWithText(name));
}
async edit(name, description): Promise<void> {
await this.navigateTo();
- await this.getTableCell(name).click(); // select role from table
+ await this.getFirstTableCellWithText(name).click(); // select role from table
await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
// fill in fields with new values
const editButton = element(by.cssContainingText('button', 'Edit Role'));
await editButton.click();
- await this.waitPresence(this.getTableCell(name));
- await this.waitPresence(this.getTableCell(description));
+ await this.waitPresence(this.getFirstTableCellWithText(name));
+ await this.waitPresence(this.getFirstTableCellWithText(description));
}
}
// Click the create button and wait for user to be made
const createButton = element(by.cssContainingText('button', 'Create User'));
await createButton.click();
- await this.waitPresence(this.getTableCell(username));
+ await this.waitPresence(this.getFirstTableCellWithText(username));
}
async edit(username, password, name, email): Promise<void> {
await this.navigateTo();
- await this.getTableCell(username).click(); // select user from table
+ await this.getFirstTableCellWithText(username).click(); // select user from table
await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
// fill in fields with new values
// Click the edit button and check new values are present in table
const editButton = element(by.cssContainingText('button', 'Edit User'));
await editButton.click();
- await this.waitPresence(this.getTableCell(email));
- await this.waitPresence(this.getTableCell(name));
+ await this.waitPresence(this.getFirstTableCellWithText(email));
+ await this.waitPresence(this.getFirstTableCellWithText(name));
}
}