[8.9] Ftr/speedup dashboard tests (#160722) (#160791)

# Backport

This will backport the following commits from `main` to `8.9`:
- [Ftr/speedup dashboard tests
(#160722)](https://github.com/elastic/kibana/pull/160722)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2023-06-28T16:49:32Z","message":"Ftr/speedup
dashboard tests (#160722)\n\n## Summary\r\n\r\nWhile splitting
`test/functional/apps/dashboard/group2/config.ts` in\r\n#160612, I
noticed that some tests (`it` function level) takes 30-45\r\nseconds
though having little actions to do in Kibana.\r\n\r\nAfter closer look I
found that:\r\n- `await PageObjects.dashboard.clickNewDashboard();` call
takes ~13-15\r\nseconds when dashboard is empty\r\n- `await
dashboardAddPanel.closeAddPanel();` call takes ~12 seconds when\r\nthere
are no flyouts displayed\r\n\r\nExpected improvement:\r\n- `await
PageObjects.dashboard.clickNewDashboard()` call takes **2**\r\nseconds,
used **103** times in tests.\r\n- `await
dashboardAddPanel.closeAddPanel()` call takes **3** seconds,\r\nused
**21** times in tests.\r\n\r\nPR FTR configs runtime\r\n<img
width=\"778\"
alt=\"image\"\r\nsrc=\"673fee19-91ef-4bc3-9848-5f844b42774c\">\r\n\r\n`main`
branch last 3 days avg configs runtime\r\n<img width=\"1555\"
alt=\"image\"\r\nsrc=\"6e364cb9-c786-411a-9491-a749351f4c94\">\r\n\r\n\r\n\r\nflaky
test runner 50x for 6 most affected
configs\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2519","sha":"54fddef2dbdf7cbd18c54a4f3b0810e44394eb54","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.9.0","v8.8.2","v8.10.0"],"number":160722,"url":"https://github.com/elastic/kibana/pull/160722","mergeCommit":{"message":"Ftr/speedup
dashboard tests (#160722)\n\n## Summary\r\n\r\nWhile splitting
`test/functional/apps/dashboard/group2/config.ts` in\r\n#160612, I
noticed that some tests (`it` function level) takes 30-45\r\nseconds
though having little actions to do in Kibana.\r\n\r\nAfter closer look I
found that:\r\n- `await PageObjects.dashboard.clickNewDashboard();` call
takes ~13-15\r\nseconds when dashboard is empty\r\n- `await
dashboardAddPanel.closeAddPanel();` call takes ~12 seconds when\r\nthere
are no flyouts displayed\r\n\r\nExpected improvement:\r\n- `await
PageObjects.dashboard.clickNewDashboard()` call takes **2**\r\nseconds,
used **103** times in tests.\r\n- `await
dashboardAddPanel.closeAddPanel()` call takes **3** seconds,\r\nused
**21** times in tests.\r\n\r\nPR FTR configs runtime\r\n<img
width=\"778\"
alt=\"image\"\r\nsrc=\"673fee19-91ef-4bc3-9848-5f844b42774c\">\r\n\r\n`main`
branch last 3 days avg configs runtime\r\n<img width=\"1555\"
alt=\"image\"\r\nsrc=\"6e364cb9-c786-411a-9491-a749351f4c94\">\r\n\r\n\r\n\r\nflaky
test runner 50x for 6 most affected
configs\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2519","sha":"54fddef2dbdf7cbd18c54a4f3b0810e44394eb54"}},"sourceBranch":"main","suggestedTargetBranches":["8.9","8.8"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.8","label":"v8.8.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/160722","number":160722,"mergeCommit":{"message":"Ftr/speedup
dashboard tests (#160722)\n\n## Summary\r\n\r\nWhile splitting
`test/functional/apps/dashboard/group2/config.ts` in\r\n#160612, I
noticed that some tests (`it` function level) takes 30-45\r\nseconds
though having little actions to do in Kibana.\r\n\r\nAfter closer look I
found that:\r\n- `await PageObjects.dashboard.clickNewDashboard();` call
takes ~13-15\r\nseconds when dashboard is empty\r\n- `await
dashboardAddPanel.closeAddPanel();` call takes ~12 seconds when\r\nthere
are no flyouts displayed\r\n\r\nExpected improvement:\r\n- `await
PageObjects.dashboard.clickNewDashboard()` call takes **2**\r\nseconds,
used **103** times in tests.\r\n- `await
dashboardAddPanel.closeAddPanel()` call takes **3** seconds,\r\nused
**21** times in tests.\r\n\r\nPR FTR configs runtime\r\n<img
width=\"778\"
alt=\"image\"\r\nsrc=\"673fee19-91ef-4bc3-9848-5f844b42774c\">\r\n\r\n`main`
branch last 3 days avg configs runtime\r\n<img width=\"1555\"
alt=\"image\"\r\nsrc=\"6e364cb9-c786-411a-9491-a749351f4c94\">\r\n\r\n\r\n\r\nflaky
test runner 50x for 6 most affected
configs\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2519","sha":"54fddef2dbdf7cbd18c54a4f3b0810e44394eb54"}}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
Kibana Machine 2023-06-28 14:03:32 -04:00 committed by GitHub
parent f1c113d998
commit 52284a3ec3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 19 deletions

View file

@ -337,7 +337,7 @@ export class CommonPageObject extends FtrService {
async ensureModalOverlayHidden() {
return this.retry.try(async () => {
const shown = await this.testSubjects.exists('confirmModalTitleText');
const shown = await this.testSubjects.exists('confirmModalTitleText', { timeout: 500 });
if (shown) {
throw new Error('Modal overlay is showing');
}

View file

@ -131,7 +131,7 @@ export class DashboardAddPanelService extends FtrService {
async isAddPanelOpen() {
this.log.debug('DashboardAddPanel.isAddPanelOpen');
return await this.testSubjects.exists('dashboardAddPanel');
return await this.testSubjects.exists('dashboardAddPanel', { timeout: 500 });
}
async ensureAddPanelIsShowing() {

View file

@ -356,7 +356,9 @@ export class FilterBarService extends FtrService {
* Closes field editor modal window
*/
public async ensureFieldEditorModalIsClosed(): Promise<void> {
const cancelSaveFilterModalButtonExists = await this.testSubjects.exists('cancelSaveFilter');
const cancelSaveFilterModalButtonExists = await this.testSubjects.exists('cancelSaveFilter', {
timeout: 1000,
});
if (cancelSaveFilterModalButtonExists) {
await this.testSubjects.click('cancelSaveFilter');
}

View file

@ -31,20 +31,17 @@ export class FlyoutService extends FtrService {
}
public async ensureAllClosed(): Promise<void> {
const flyoutElements = await this.find.allByCssSelector('.euiFlyout');
if (!flyoutElements.length) {
return;
}
for (let i = 0; i < flyoutElements.length; i++) {
const closeBtn = await flyoutElements[i].findByCssSelector('[aria-label*="Close"]');
await closeBtn.click();
}
await this.retry.waitFor(
'all flyouts to be closed',
async () => (await this.find.allByCssSelector('.euiFlyout')).length === 0
);
await this.retry.waitFor('all flyouts to be closed', async () => {
let flyoutElements = await this.find.allByCssSelector('.euiFlyout', 2500);
if (!flyoutElements.length) {
return true;
}
for (let i = 0; i < flyoutElements.length; i++) {
const closeBtn = await flyoutElements[i].findByCssSelector('[aria-label*="Close"]');
await closeBtn.click();
}
flyoutElements = await this.find.allByCssSelector('.euiFlyout', 500);
return flyoutElements.length === 0;
});
}
}

View file

@ -26,10 +26,17 @@ export class RenderableService extends FtrService {
*/
public async waitForRender(count: number = 1): Promise<void> {
this.log.debug(`Renderable.waitForRender for ${count} elements`);
// exit if there are no objects expected
if (count === 0) {
return;
}
await this.retry.try(async () => {
const completedElements = await this.find.allByCssSelector(RENDER_COMPLETE_SELECTOR);
if (completedElements.length < count) {
const pendingElements = await this.find.allByCssSelector(RENDER_COMPLETE_PENDING_SELECTOR);
const pendingElements = await this.find.allByCssSelector(
RENDER_COMPLETE_PENDING_SELECTOR,
2500
);
const pendingElementNames = [];
for (const pendingElement of pendingElements) {
const title = await pendingElement.getAttribute('data-title');