});
it('should delete image', async () => {
- await images.deleteImage(newImageName);
- await expect(images.getTableCell(newImageName).isPresent()).toBe(false);
+ await images.navigateTo();
+ await images.delete(newImageName);
});
afterAll(async () => {
- await pools.navigateTo(); // Deletes images test pool
- await pools.delete(poolName);
await pools.navigateTo();
- await pools.exist(poolName, false);
+ await pools.delete(poolName);
});
});
).toMatch(newSize);
}
- // Deletes RBD image from table and checks that it is not present
- async deleteImage(name) {
- await this.navigateTo();
-
- // wait for table to load
- 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
- await this.clickCheckbox($('.custom-control-label'));
- await element(by.cssContainingText('button', 'Delete RBD')).click();
- await this.waitStaleness(this.getTableCell(name));
- }
-
// Selects RBD image and moves it to the trash, checks that it is present in the
// trash table
async moveToTrash(name) {
afterAll(async () => {
await pools.navigateTo();
await pools.delete(poolName);
- await pools.navigateTo();
- await pools.exist(poolName, false);
});
});
});
await pools.navigateTo();
await pools.delete(poolname);
- await pools.navigateTo();
- await pools.exist(poolname, false);
-
await logs.navigateTo();
await logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
});
getFirstCell(): ElementFinder {
return $$('.datatable-body-cell-label').first();
}
+
+ /**
+ * This is a generic method to delete table rows.
+ * It will select the first row that contains the provided name and delete it.
+ * After that it will wait until the row is no longer displayed.
+ */
+ async delete(name: string): Promise<any> {
+ // Selects row
+ await this.waitClickable(this.getTableCell(name));
+ await this.getTableCell(name).click();
+
+ // Clicks on table Delete button
+ await $$('.table-actions button.dropdown-toggle')
+ .first()
+ .click(); // open submenu
+ await $('li.delete a').click(); // click on "delete" menu item
+
+ // Confirms deletion
+ await this.clickCheckbox($('.custom-control-label'));
+ await element(by.cssContainingText('button', 'Delete')).click();
+
+ // Waits for item to be removed from table
+ return this.waitStaleness(this.getTableCell(name));
+ }
}
});
it('should delete a pool', async () => {
- await pools.exist(poolName);
- await pools.delete(poolName);
await pools.navigateTo();
- await pools.exist(poolName, false);
+ await pools.delete(poolName);
});
});
async (app) => await element(by.cssContainingText('.select-menu-item-content', app)).click()
);
}
-
- @PageHelper.restrictTo(pages.index)
- async delete(name: string): Promise<any> {
- await this.waitClickable(this.getTableCell(name));
- await this.getTableCell(name).click();
- await $('.table-actions button.dropdown-toggle').click(); // open submenu
- await $('li.delete a').click(); // click on "delete" menu item
- await this.clickCheckbox($('.custom-control-label'));
- await element(by.cssContainingText('button', 'Delete Pool')).click();
- return this.waitStaleness(this.getTableCell(name));
- }
}
it('should delete bucket', async () => {
await buckets.navigateTo();
await buckets.delete('000test');
- await expect(buckets.getTableCell('000test').isPresent()).toBe(false);
});
describe('Invalid Input in Create and Edit tests', () => {
-import { $, by, element } from 'protractor';
+import { by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
const pages = {
return promise;
}
- @PageHelper.restrictTo(pages.index)
- async delete(name) {
- // wait for table to load
- 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 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 this.waitStaleness(this.getTableCell(name));
- }
-
async testInvalidCreate() {
await this.navigateTo('create');
const nameInputField = element(by.id('bid')); // Grabs name box field
it('should delete user', async () => {
await users.delete(user_name);
- await expect(users.getTableCell(user_name).isPresent()).toBe(false);
});
});
await expect($('.active.tab-pane').getText()).toMatch(new_maxbuckets); // check max buckets was changed
}
- async delete(name) {
- await this.navigateTo();
-
- // wait for table to load
- const my_user = this.getFirstTableCellWithText(name);
- 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 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 this.waitStaleness(this.getFirstTableCellWithText(name));
- }
-
async invalidCreate() {
const uname = '000invalid_create_user';
// creating this user in order to check that you can't give two users the same name
'The entered value must be >= 0.'
);
+ await this.navigateTo();
await this.delete(uname);
}
'The entered value must be >= 0.'
);
+ await this.navigateTo();
await this.delete(uname);
}
}
});
it('should delete a role', async () => {
+ await roleMgmt.navigateTo();
await roleMgmt.delete(role_name);
});
});
-import { $, by, element } from 'protractor';
+import { by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
export class RoleMgmtPageHelper extends PageHelper {
await this.waitPresence(this.getTableCell(name));
await this.waitPresence(this.getTableCell(description));
}
-
- async delete(name) {
- await this.navigateTo();
-
- await this.getTableCell(name).click(); // select role from table
- await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
- await $('li.delete a').click(); // click delete
-
- await this.waitVisibility($('.custom-control-label'));
- await $('.custom-control-label').click(); // click confirmation checkbox
- await element(by.cssContainingText('button', 'Delete Role')).click();
- await this.waitStaleness(this.getFirstTableCellWithText(name));
- }
}
});
it('should delete a user', async () => {
- await userMgmt.userDelete(user_name);
+ await userMgmt.navigateTo();
+ await userMgmt.delete(user_name);
});
});
});
-import { $, by, element } from 'protractor';
+import { by, element } from 'protractor';
import { PageHelper } from '../page-helper.po';
export class UserMgmtPageHelper extends PageHelper {
await this.waitPresence(this.getTableCell(email));
await this.waitPresence(this.getTableCell(name));
}
-
- async userDelete(username): Promise<void> {
- await this.navigateTo();
-
- await this.getTableCell(username).click(); // select user from table
- await $('.table-actions button.dropdown-toggle').click(); // click toggle menu
- await $('li.delete a').click(); // click delete
-
- await this.waitVisibility($('.custom-control-label'));
- await $('.custom-control-label').click(); // click confirmation checkbox
- await element(by.cssContainingText('button', 'Delete User')).click();
- await this.waitStaleness(this.getFirstTableCellWithText(username));
- }
}