replace Promise.all with for loop for clicks (#57909) (#57993)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Dmitry Lemeshko 2020-02-19 21:07:58 +01:00 committed by GitHub
parent 2366d0debd
commit 63f1c6e93a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 27 deletions

View file

@ -190,6 +190,7 @@
data-shared-item
data-title="{{opts.savedSearch.lastSavedTitle}}"
data-description="{{opts.savedSearch.description}}"
data-test-subj="discoverDocTable"
minimum-visible-rows="minimumVisibleRows"
render-complete
on-add-column="addColumn"

View file

@ -37,15 +37,14 @@ export default function({ getService, getPageObjects }) {
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(
TEST_COLUMN_NAMES.map(columnName => PageObjects.discover.clickFieldListItemAdd(columnName))
);
await Promise.all(
TEST_FILTER_COLUMN_NAMES.map(async ([columnName, value]) => {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
})
);
await PageObjects.discover.waitForDocTableLoadingComplete();
for (const columnName of TEST_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemAdd(columnName);
}
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});
it('should open the doc view of the selected document', async function() {

View file

@ -190,10 +190,8 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
await testSubjects.click('dashboardEditMode');
// wait until the count of dashboard panels equals the count of toggle menu icons
await retry.waitFor('in edit mode', async () => {
const [panels, menuIcons] = await Promise.all([
testSubjects.findAll('embeddablePanel'),
testSubjects.findAll('embeddablePanelToggleMenuIcon'),
]);
const panels = await testSubjects.findAll('embeddablePanel', 2500);
const menuIcons = await testSubjects.findAll('embeddablePanelToggleMenuIcon', 2500);
return panels.length === menuIcons.length;
});
}
@ -471,15 +469,16 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
public async getPanelSharedItemData() {
log.debug('in getPanelSharedItemData');
const sharedItems = await find.allByCssSelector('[data-shared-item]');
return await Promise.all(
sharedItems.map(async sharedItem => {
const sharedItemscontainer = await find.byCssSelector('[data-shared-items-count]');
const $ = await sharedItemscontainer.parseDomContent();
return $('[data-shared-item]')
.toArray()
.map(item => {
return {
title: await sharedItem.getAttribute('data-title'),
description: await sharedItem.getAttribute('data-description'),
title: $(item).attr('data-title'),
description: $(item).attr('data-description'),
};
})
);
});
}
public async checkHideTitle() {

View file

@ -327,6 +327,14 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
async waitForChartLoadingComplete(renderCount) {
await elasticChart.waitForRenderingCount('discoverChart', renderCount);
}
async waitForDocTableLoadingComplete() {
await testSubjects.waitForAttributeToChange(
'discoverDocTable',
'data-render-complete',
'true'
);
}
}
return new DiscoverPage();

View file

@ -35,7 +35,9 @@ export function TileMapPageProvider({ getService, getPageObjects }: FtrProviderC
public async clickMapButton(zoomSelector: string, waitForLoading?: boolean) {
await retry.try(async () => {
const zooms = await this.getZoomSelectors(zoomSelector);
await Promise.all(zooms.map(async zoom => await zoom.click()));
for (let i = 0; i < zooms.length; i++) {
await zooms[i].click();
}
if (waitForLoading) {
await header.waitUntilLoadingHasFinished();
}

View file

@ -50,12 +50,10 @@ export function FlyoutProvider({ getService }: FtrProviderContext) {
return;
}
await Promise.all(
flyoutElements.map(async flyoutElement => {
const closeBtn = await flyoutElement.findByCssSelector('[aria-label*="Close"]');
await closeBtn.click();
})
);
for (let i = 0; i < flyoutElements.length; i++) {
const closeBtn = await flyoutElements[i].findByCssSelector('[aria-label*="Close"]');
await closeBtn.click();
}
await retry.waitFor(
'all flyouts to be closed',