Skip to content

Commit

Permalink
[7.x] make test less flaky by retrying if list is re-rendered… (#56083)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Spencer and elasticmachine authored Jan 28, 2020
1 parent 11b7ad8 commit bc29f77
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions test/functional/services/dashboard/add_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,23 @@ export function DashboardAddPanelProvider({ getService, getPageObjects }) {
async addEveryEmbeddableOnCurrentPage() {
log.debug('addEveryEmbeddableOnCurrentPage');
const itemList = await testSubjects.find('savedObjectFinderItemList');
const embeddableRows = await itemList.findAllByCssSelector('li');
const embeddableList = [];
for (let i = 0; i < embeddableRows.length; i++) {
embeddableList.push(await embeddableRows[i].getVisibleText());
await embeddableRows[i].click();
await PageObjects.common.closeToast();
}
log.debug(`Added ${embeddableRows.length} embeddables`);
await retry.try(async () => {
const embeddableRows = await itemList.findAllByCssSelector('li');
for (let i = 0; i < embeddableRows.length; i++) {
const name = await embeddableRows[i].getVisibleText();

if (embeddableList.includes(name)) {
// already added this one
continue;
}

await embeddableRows[i].click();
await PageObjects.common.closeToast();
embeddableList.push(name);
}
});
log.debug(`Added ${embeddableList.length} embeddables`);
return embeddableList;
}

Expand Down

0 comments on commit bc29f77

Please sign in to comment.