From df237371dc541456742bcc1135d744bc3b82d3af Mon Sep 17 00:00:00 2001 From: lizozom Date: Wed, 2 Nov 2022 15:44:18 +0200 Subject: [PATCH 1/7] Use renderComplete handler in maps embeddable and update tests to correctly await maps loading. --- x-pack/performance/journeys/ecommerce_dashboard.ts | 2 +- .../performance/journeys/ecommerce_dashboard_map_only.ts | 7 +++---- x-pack/performance/journeys/flight_dashboard.ts | 2 +- x-pack/performance/journeys/web_logs_dashboard.ts | 2 +- x-pack/plugins/maps/public/embeddable/map_embeddable.tsx | 9 +++++++++ 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/x-pack/performance/journeys/ecommerce_dashboard.ts b/x-pack/performance/journeys/ecommerce_dashboard.ts index b9c107cd12cbd9..2218df6ed1d9eb 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Ecommerce Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard')); - await waitForVisualizations(page, 13); + await waitForVisualizations(page, 14); }); diff --git a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts index 883642be161e46..a7e97f65f585da 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts @@ -7,6 +7,7 @@ import { Journey } from '@kbn/journeys'; import { subj } from '@kbn/test-subj-selector'; +import { waitForVisualizations } from '../utils'; export const journey = new Journey({ esArchives: ['x-pack/performance/es_archives/sample_data_ecommerce'], @@ -18,9 +19,7 @@ export const journey = new Journey({ await page.waitForSelector('#dashboardListingHeading'); }) - .step('Go to Ecommerce No Map Dashboard', async ({ page, kbnUrl }) => { + .step('Go to Ecommerce Map only Dashboard', async ({ page, kbnUrl }) => { await page.click(subj('dashboardListingTitleLink-[eCommerce]-Map-Only')); - await page.waitForSelector( - 'div[data-title="[eCommerce] Orders by Country"][data-render-complete="true"]' - ); + await waitForVisualizations(page, 1); }); diff --git a/x-pack/performance/journeys/flight_dashboard.ts b/x-pack/performance/journeys/flight_dashboard.ts index 46030dd47d2fbd..4f1f2e6805489d 100644 --- a/x-pack/performance/journeys/flight_dashboard.ts +++ b/x-pack/performance/journeys/flight_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Flights Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard')); - await waitForVisualizations(page, 14); + await waitForVisualizations(page, 16); }); diff --git a/x-pack/performance/journeys/web_logs_dashboard.ts b/x-pack/performance/journeys/web_logs_dashboard.ts index c86d23b4fd9c6d..933ccdfd083d0d 100644 --- a/x-pack/performance/journeys/web_logs_dashboard.ts +++ b/x-pack/performance/journeys/web_logs_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Web Logs Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[Logs]-Web-Traffic')); - await waitForVisualizations(page, 11); + await waitForVisualizations(page, 12); }); diff --git a/x-pack/plugins/maps/public/embeddable/map_embeddable.tsx b/x-pack/plugins/maps/public/embeddable/map_embeddable.tsx index b6932785aa7158..70bdafd99d2572 100644 --- a/x-pack/plugins/maps/public/embeddable/map_embeddable.tsx +++ b/x-pack/plugins/maps/public/embeddable/map_embeddable.tsx @@ -443,6 +443,7 @@ export class MapEmbeddable * @param {ContainerState} containerState */ render(domNode: HTMLElement) { + super.render(domNode); this._domNode = domNode; if (!this._isInitialized) { return; @@ -776,6 +777,14 @@ export class MapEmbeddable * This means that the DASHBOARD_LOADED_EVENT event might be fired while a map is still rendering in some cases. * For more details please contact the maps team. */ + const isRendered = !isLoading && firstLayerWithError === undefined; + if (isLoading) { + this.renderComplete.dispatchInProgress(); + } else if (firstLayerWithError) { + this.renderComplete.dispatchError(); + } else if (!isLoading && isRendered) { + this.renderComplete.dispatchComplete(); + } this.updateOutput({ ...output, loading: isLoading, From f9989224650714c6280cf6d7965821216aa10c8e Mon Sep 17 00:00:00 2001 From: lizozom Date: Wed, 2 Nov 2022 16:02:00 +0200 Subject: [PATCH 2/7] Move super call to top of function (and top dom elem) --- .../visualizations/public/embeddable/visualize_embeddable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx index f2a2a7f8ae000b..f321cef776b6b1 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx @@ -413,6 +413,7 @@ export class VisualizeEmbeddable * @param {Element} domNode */ public async render(domNode: HTMLElement) { + super.render(domNode); this.timeRange = _.cloneDeep(this.input.timeRange); this.transferCustomizationsToUiState(); @@ -427,7 +428,6 @@ export class VisualizeEmbeddable this.warningDomNode = warningDiv; this.domNode = div; - super.render(this.domNode); render( From 317f6f3bc550dd334594d1073f11d4e6682b0341 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 2 Nov 2022 16:20:48 +0200 Subject: [PATCH 3/7] Update visualize_embeddable.tsx --- .../visualizations/public/embeddable/visualize_embeddable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx index f321cef776b6b1..f2a2a7f8ae000b 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx @@ -413,7 +413,6 @@ export class VisualizeEmbeddable * @param {Element} domNode */ public async render(domNode: HTMLElement) { - super.render(domNode); this.timeRange = _.cloneDeep(this.input.timeRange); this.transferCustomizationsToUiState(); @@ -428,6 +427,7 @@ export class VisualizeEmbeddable this.warningDomNode = warningDiv; this.domNode = div; + super.render(this.domNode); render( From f72fce172f106625abd7a00ac61fe63001905016 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 2 Nov 2022 16:24:40 +0200 Subject: [PATCH 4/7] Update flight_dashboard.ts --- x-pack/performance/journeys/flight_dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/performance/journeys/flight_dashboard.ts b/x-pack/performance/journeys/flight_dashboard.ts index 4f1f2e6805489d..46030dd47d2fbd 100644 --- a/x-pack/performance/journeys/flight_dashboard.ts +++ b/x-pack/performance/journeys/flight_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Flights Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard')); - await waitForVisualizations(page, 16); + await waitForVisualizations(page, 14); }); From 5912d703fe2ba5f63a8b0defe13126fde40b6177 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 2 Nov 2022 16:25:12 +0200 Subject: [PATCH 5/7] Update web_logs_dashboard.ts --- x-pack/performance/journeys/web_logs_dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/performance/journeys/web_logs_dashboard.ts b/x-pack/performance/journeys/web_logs_dashboard.ts index 933ccdfd083d0d..c86d23b4fd9c6d 100644 --- a/x-pack/performance/journeys/web_logs_dashboard.ts +++ b/x-pack/performance/journeys/web_logs_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Web Logs Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[Logs]-Web-Traffic')); - await waitForVisualizations(page, 12); + await waitForVisualizations(page, 11); }); From 80cbe399f9ce806c2fe2691dc178c5d35e0bfe7e Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 2 Nov 2022 16:55:41 +0100 Subject: [PATCH 6/7] fix journey, there is no map on ecommerce dashboard --- x-pack/performance/journeys/ecommerce_dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/performance/journeys/ecommerce_dashboard.ts b/x-pack/performance/journeys/ecommerce_dashboard.ts index 2218df6ed1d9eb..b9c107cd12cbd9 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard.ts @@ -21,5 +21,5 @@ export const journey = new Journey({ .step('Go to Ecommerce Dashboard', async ({ page }) => { await page.click(subj('dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard')); - await waitForVisualizations(page, 14); + await waitForVisualizations(page, 13); }); From 168e3a363831878dd8b18d28fc8cce3a64cb89c7 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Thu, 3 Nov 2022 17:10:02 +0200 Subject: [PATCH 7/7] Update ecommerce_dashboard_map_only.ts --- x-pack/performance/journeys/ecommerce_dashboard_map_only.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts index a7e97f65f585da..88cdbc553b2c06 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts @@ -19,7 +19,7 @@ export const journey = new Journey({ await page.waitForSelector('#dashboardListingHeading'); }) - .step('Go to Ecommerce Map only Dashboard', async ({ page, kbnUrl }) => { + .step('Go to Ecommerce Map only Dashboard', async ({ page, log, kbnUrl }) => { await page.click(subj('dashboardListingTitleLink-[eCommerce]-Map-Only')); - await waitForVisualizations(page, 1); + await waitForVisualizations(page, log, 1); });