When the cluster is busy it might take some time until the tested component has loaded it's data and is rendered in the browser. Waiting for the breadcrumb text to be present might help to fix errors in the e2e tests.
Signed-off-by: Volker Theile <vtheile@suse.com>
});
it('should open and show breadcrumb', async () => {
- await expect(images.getBreadcrumbText()).toEqual('Images');
+ await images.waitTextToBePresent(images.getBreadcrumb(), 'Images');
});
it('should show three tabs', async () => {
});
it('should open and show breadcrumb', async () => {
- await expect(iscsi.getBreadcrumbText()).toEqual('Overview');
+ await iscsi.waitTextToBePresent(iscsi.getBreadcrumb(), 'Overview');
});
});
});
it('should open and show breadcrumb', async () => {
- await expect(mirroring.getBreadcrumbText()).toEqual('Mirroring');
+ await mirroring.waitTextToBePresent(mirroring.getBreadcrumb(), 'Mirroring');
});
it('should show three tabs', async () => {
});
it('should open and show breadcrumb', async () => {
- await expect(alerts.getBreadcrumbText()).toEqual('Alerts');
+ await alerts.waitTextToBePresent(alerts.getBreadcrumb(), 'Alerts');
});
});
});
});
it('should open and show breadcrumb', async () => {
- await expect(configuration.getBreadcrumbText()).toEqual('Configuration');
+ await configuration.waitTextToBePresent(configuration.getBreadcrumb(), 'Configuration');
});
});
await this.getTableCell(name).click(); // click on the config to edit
await element(by.cssContainingText('button', 'Edit')).click(); // clicks button to edit
- await expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
for (let i = 0, valtuple; (valtuple = values[i]); i++) {
// Finds desired value based off given list
});
it('should open and show breadcrumb', async () => {
- await expect(crushmap.getBreadcrumbText()).toEqual('CRUSH map');
+ await crushmap.waitTextToBePresent(crushmap.getBreadcrumb(), 'CRUSH map');
});
});
describe('fields check', () => {
});
it('should open and show breadcrumb', async () => {
- await expect(hosts.getBreadcrumbText()).toEqual('Hosts');
+ await hosts.waitTextToBePresent(hosts.getBreadcrumb(), 'Hosts');
});
it('should show two tabs', async () => {
// click link, check it worked by looking for changed breadcrumb,
// navigate back to hosts page, repeat until all links checked
await links.get(i).click();
- await expect(this.getBreadcrumbText()).toEqual('Performance Counters');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Performance Counters');
await this.navigateTo();
- await expect(this.getBreadcrumbText()).toEqual('Hosts');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Hosts');
links_tested++;
}
// check if any links were actually tested
});
it('should open and show breadcrumb', async () => {
- await expect(logs.getBreadcrumbText()).toEqual('Logs');
+ await logs.waitTextToBePresent(logs.getBreadcrumb(), 'Logs');
});
it('should show two tabs', async () => {
});
it('should open and show breadcrumb', async () => {
- await expect(mgrmodules.getBreadcrumbText()).toEqual('Manager modules');
+ await mgrmodules.waitTextToBePresent(mgrmodules.getBreadcrumb(), 'Manager modules');
});
});
});
it('should open and show breadcrumb', async () => {
- await expect(monitors.getBreadcrumbText()).toEqual('Monitors');
+ await monitors.waitTextToBePresent(monitors.getBreadcrumb(), 'Monitors');
});
});
});
it('should open and show breadcrumb', async () => {
- await expect(osds.getBreadcrumbText()).toEqual('OSDs');
+ await osds.waitTextToBePresent(osds.getBreadcrumb(), 'OSDs');
});
it('should show two tabs', async () => {
for (const [linkText, breadcrumbText] of Object.entries(expectationMap)) {
await expect(browser.getCurrentUrl()).toContain('/#/dashboard');
await dashboard.clickInfoCardLink(linkText);
- await expect(dashboard.getBreadcrumbText()).toEqual(breadcrumbText);
+ await dashboard.waitTextToBePresent(dashboard.getBreadcrumb(), breadcrumbText);
await dashboard.navigateBack();
}
});
});
it('should open and show breadcrumb', async () => {
- await expect(filesystems.getBreadcrumbText()).toEqual('Filesystems');
+ await filesystems.waitTextToBePresent(filesystems.getBreadcrumb(), 'Filesystems');
});
});
});
});
it('should open and show breadcrumb', async () => {
- await expect(nfs.getBreadcrumbText()).toEqual('NFS');
+ await nfs.waitTextToBePresent(nfs.getBreadcrumb(), 'NFS');
});
});
});
};
}
- async getBreadcrumbText(): Promise<string> {
- return $('.breadcrumb-item.active').getText();
+ /**
+ * Get the active breadcrumb item.
+ */
+ getBreadcrumb(): ElementFinder {
+ return $('.breadcrumb-item.active');
}
async getTabText(index): Promise<string> {
describe('breadcrumb and tab tests', () => {
it('should open and show breadcrumb', async () => {
- await expect(pools.getBreadcrumbText()).toEqual('Pools');
+ await pools.waitTextToBePresent(pools.getBreadcrumb(), 'Pools');
});
it('should show two tabs', async () => {
const elem = await this.getTableCellByContent(name);
await elem.click(); // select pool from the table
await element(by.cssContainingText('button', 'Edit')).click(); // click edit button
- await expect(this.getBreadcrumbText()).toEqual('Edit'); // verify we are now on edit page
+ await this.waitTextToBePresent(this.getBreadcrumb(), '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`;
async edit(name: string, new_owner: string) {
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
- await expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
await expect(element(by.css('input[name=placement-target]')).getAttribute('value')).toBe(
'default-placement'
);
// Clicks the Create Bucket button but the page doesn't move. Done by testing
// for the breadcrumb
await element(by.cssContainingText('button', 'Create Bucket')).click(); // Clicks Create Bucket button
- await expect(this.getBreadcrumbText()).toEqual('Create');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Create');
// content in fields seems to subsist through tests if not cleared, so it is cleared
await nameInputField.clear();
return element(by.cssContainingText('button', 'Cancel')).click();
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
- await expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
// Chooses 'Select a user' rather than a valid owner on Edit Bucket page
// and checks if it's an invalid input
'This field is required.'
);
- await expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
}
}
});
it('should open and show breadcrumb', async () => {
- await expect(daemons.getBreadcrumbText()).toEqual('Daemons');
+ await daemons.waitTextToBePresent(daemons.getBreadcrumb(), 'Daemons');
});
it('should show two tabs', async () => {
});
it('should open and show breadcrumb', async () => {
- await expect(users.getBreadcrumbText()).toEqual('Users');
+ await users.waitTextToBePresent(users.getBreadcrumb(), 'Users');
});
});
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
- await expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
// Change the full name field
await element(by.id('display_name')).click();
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 expect(this.getBreadcrumbText()).toEqual('Edit');
+ await this.waitTextToBePresent(this.getBreadcrumb(), 'Edit');
// put invalid email to make field invalid
await element(by.id('email')).click();
describe('breadcrumb tests', () => {
it('should check breadcrumb on users tab of user management page', async () => {
await userManagement.navigateTo('users');
- await expect(userManagement.getBreadcrumbText()).toEqual('Users');
+ await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Users');
});
it('should check breadcrumb on roles tab of user management page', async () => {
await userManagement.navigateTo('roles');
- await expect(userManagement.getBreadcrumbText()).toEqual('Roles');
+ await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Roles');
});
it('should check breadcrumb on user creation page', async () => {
await userManagement.navigateTo('userCreate');
- await expect(userManagement.getBreadcrumbText()).toEqual('Create');
+ await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
});
it('should check breadcrumb on role creation page', async () => {
await userManagement.navigateTo('roleCreate');
- await expect(userManagement.getBreadcrumbText()).toEqual('Create');
+ await userManagement.waitTextToBePresent(userManagement.getBreadcrumb(), 'Create');
});
});