From 12baf1ba29c16d4db6bce112db0b9c7b792454a0 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 17 Jan 2024 18:27:55 +0100 Subject: [PATCH 01/15] add logs in after hook --- .../scripts/steps/functional/performance_playwright.sh | 6 +++++- packages/kbn-journeys/journey/journey_ftr_harness.ts | 3 +++ x-pack/performance/journeys/login.ts | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/steps/functional/performance_playwright.sh b/.buildkite/scripts/steps/functional/performance_playwright.sh index 5c8e86f48506b..81db39d9b8220 100644 --- a/.buildkite/scripts/steps/functional/performance_playwright.sh +++ b/.buildkite/scripts/steps/functional/performance_playwright.sh @@ -20,7 +20,11 @@ if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-performance-data-set-extraction" ]; t else # pipeline should use bare metal static worker echo "--- Running performance tests" - node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" + for i in {1..4} + do + echo "--- Running journey #$i" + node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --journey=x-pack/performance/journeys/login.ts + done fi echo "--- Upload journey step screenshots" diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index 0f649e7a1de27..8c0f5c196a52f 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -226,11 +226,14 @@ export class JourneyFtrHarness { } private async onTeardown() { + this.log.info('--tearDownBrowserAndPage'); await this.tearDownBrowserAndPage(); // It is important that we complete the APM transaction after we close the browser and before we start // unloading the test data so that the scalability data extractor can focus on just the APM data produced // by Kibana running under test. + this.log.info('--teardownApm'); await this.teardownApm(); + this.log.info('--deleteArchives'); await Promise.all([ asyncForEach(this.journeyConfig.getEsArchives(), async (esArchive) => { await this.esArchiver.unload(esArchive); diff --git a/x-pack/performance/journeys/login.ts b/x-pack/performance/journeys/login.ts index 5cf705dec2ef9..5e5f8c721cd2a 100644 --- a/x-pack/performance/journeys/login.ts +++ b/x-pack/performance/journeys/login.ts @@ -33,7 +33,8 @@ export const journey = new Journey({ ], maxDuration: '10m', }, -}).step('Login', async ({ page, kbnUrl, inputDelays, auth, kibanaPage }) => { +}).step('Login', async ({ page, kbnUrl, inputDelays, auth, kibanaPage, log }) => { + log.info('test started'); await page.goto(kbnUrl.get()); if (auth.isCloud()) { await page.click(subj('loginCard-basic/cloud-basic'), { delay: inputDelays.MOUSE_CLICK }); @@ -44,4 +45,5 @@ export const journey = new Journey({ await page.click(subj('loginSubmit'), { delay: inputDelays.MOUSE_CLICK }); await kibanaPage.waitForHeader(); + log.info('test finished'); }); From 6db47af480097f08ac3968e67d363c5b7e4a3c22 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 17 Jan 2024 21:22:07 +0100 Subject: [PATCH 02/15] update script --- .buildkite/scripts/steps/functional/performance_playwright.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/steps/functional/performance_playwright.sh b/.buildkite/scripts/steps/functional/performance_playwright.sh index 81db39d9b8220..cd7b8726d4db8 100644 --- a/.buildkite/scripts/steps/functional/performance_playwright.sh +++ b/.buildkite/scripts/steps/functional/performance_playwright.sh @@ -22,8 +22,8 @@ else echo "--- Running performance tests" for i in {1..4} do - echo "--- Running journey #$i" - node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --journey=x-pack/performance/journeys/login.ts + echo "--- Running login journey #$i" + node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --journey-path "x-pack/performance/journeys/login.ts" done fi From 1b1d2da9fe7fc09353204b2435199a03f0539e08 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 18 Jan 2024 13:53:55 +0100 Subject: [PATCH 03/15] update logs --- packages/kbn-journeys/journey/journey_ftr_harness.ts | 11 +++++++---- x-pack/performance/journeys/login.ts | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index 8c0f5c196a52f..a279378487572 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -176,14 +176,17 @@ export class JourneyFtrHarness { private async tearDownBrowserAndPage() { if (this.page) { + console.log('telemetryTracker start'); const telemetryTracker = this.telemetryTrackerSubs.get(this.page); this.telemetryTrackerSubs.delete(this.page); if (telemetryTracker && !telemetryTracker.closed) { + console.log('telemetryTracker is not closed'); this.log.info(`Waiting for telemetry requests, including starting within next 3 secs`); this.pageTeardown$.next(this.page); await new Promise((resolve) => telemetryTracker.add(resolve)); } + console.log('telemetryTracker closed'); this.log.info('destroying page'); await this.client?.detach(); @@ -192,7 +195,7 @@ export class JourneyFtrHarness { } if (this.browser) { - this.log.info('closing browser'); + console.log('closing browser'); await this.browser.close(); } } @@ -226,14 +229,14 @@ export class JourneyFtrHarness { } private async onTeardown() { - this.log.info('--tearDownBrowserAndPage'); + console.log('--tearDownBrowserAndPage'); await this.tearDownBrowserAndPage(); // It is important that we complete the APM transaction after we close the browser and before we start // unloading the test data so that the scalability data extractor can focus on just the APM data produced // by Kibana running under test. - this.log.info('--teardownApm'); + console.log('--teardownApm'); await this.teardownApm(); - this.log.info('--deleteArchives'); + console.log('--deleteArchives'); await Promise.all([ asyncForEach(this.journeyConfig.getEsArchives(), async (esArchive) => { await this.esArchiver.unload(esArchive); diff --git a/x-pack/performance/journeys/login.ts b/x-pack/performance/journeys/login.ts index 5e5f8c721cd2a..18d9eb74d6a56 100644 --- a/x-pack/performance/journeys/login.ts +++ b/x-pack/performance/journeys/login.ts @@ -34,7 +34,8 @@ export const journey = new Journey({ maxDuration: '10m', }, }).step('Login', async ({ page, kbnUrl, inputDelays, auth, kibanaPage, log }) => { - log.info('test started'); + log.error('test started'); + console.log('#test started'); await page.goto(kbnUrl.get()); if (auth.isCloud()) { await page.click(subj('loginCard-basic/cloud-basic'), { delay: inputDelays.MOUSE_CLICK }); @@ -45,5 +46,6 @@ export const journey = new Journey({ await page.click(subj('loginSubmit'), { delay: inputDelays.MOUSE_CLICK }); await kibanaPage.waitForHeader(); - log.info('test finished'); + log.error('test finished'); + console.log('#test finished'); }); From a136c1dbf9e2c2d689a8552107548a7669c0c954 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 18 Jan 2024 19:01:45 +0100 Subject: [PATCH 04/15] test fix --- .../functional/performance_playwright.sh | 2 +- .../journey/journey_ftr_harness.ts | 27 ++++++++++++------- x-pack/performance/journeys/login.ts | 4 ++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.buildkite/scripts/steps/functional/performance_playwright.sh b/.buildkite/scripts/steps/functional/performance_playwright.sh index cd7b8726d4db8..e948e6c3588ba 100644 --- a/.buildkite/scripts/steps/functional/performance_playwright.sh +++ b/.buildkite/scripts/steps/functional/performance_playwright.sh @@ -20,7 +20,7 @@ if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-performance-data-set-extraction" ]; t else # pipeline should use bare metal static worker echo "--- Running performance tests" - for i in {1..4} + for i in {1..8} do echo "--- Running login journey #$i" node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --journey-path "x-pack/performance/journeys/login.ts" diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index a279378487572..e37f88db6512b 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -8,7 +8,7 @@ import Url from 'url'; import { inspect, format } from 'util'; -import { setTimeout } from 'timers/promises'; +import { setTimeout as setTimer } from 'timers/promises'; import * as Rx from 'rxjs'; import apmNode from 'elastic-apm-node'; import playwright, { ChromiumBrowser, Page, BrowserContext, CDPSession, Request } from 'playwright'; @@ -185,6 +185,7 @@ export class JourneyFtrHarness { this.log.info(`Waiting for telemetry requests, including starting within next 3 secs`); this.pageTeardown$.next(this.page); await new Promise((resolve) => telemetryTracker.add(resolve)); + //await new Promise((resolve) => setTimeout(resolve, 100 * 1000)); } console.log('telemetryTracker closed'); @@ -225,7 +226,7 @@ export class JourneyFtrHarness { // can't track but hope it is started within 3 seconds, node will stay // alive for active requests // https://github.com/elastic/apm-agent-nodejs/issues/2088 - await setTimeout(3000); + await setTimer(3000); } private async onTeardown() { @@ -339,9 +340,6 @@ export class JourneyFtrHarness { private telemetryTrackerCount = 0; private trackTelemetryRequests(page: Page) { - const id = ++this.telemetryTrackerCount; - - const requestFailure$ = Rx.fromEvent(page, 'requestfailed'); const requestSuccess$ = Rx.fromEvent(page, 'requestfinished'); const request$ = Rx.fromEvent(page, 'request').pipe( Rx.takeUntil( @@ -356,16 +354,27 @@ export class JourneyFtrHarness { // }) ) ), - Rx.mergeMap((request) => { + Rx.mergeMap((request: Request) => { if (!request.url().includes('telemetry-staging.elastic.co')) { return Rx.EMPTY; } + const id = ++this.telemetryTrackerCount; + this.log.debug(`Waiting for telemetry request #${id} to complete`); - return Rx.merge(requestFailure$, requestSuccess$).pipe( - Rx.first((r) => r === request), + console.log(`Waiting for telemetry request #${id} to complete`); + return Rx.of(requestSuccess$).pipe( + Rx.timeout(60_000), + Rx.catchError((error) => { + if (error instanceof Error && error.name === 'TimeoutError') { + console.log(`Timeout error occurred: ${error.message}`); + } + // Rethrow the error if it's not a TimeoutError + return Rx.throwError(() => new Error(error)); + }), Rx.tap({ - complete: () => this.log.debug(`Telemetry request #${id} complete`), + complete: () => console.log(`Telemetry request #${id} complete`), + error: (err) => console.log(err), }) ); }) diff --git a/x-pack/performance/journeys/login.ts b/x-pack/performance/journeys/login.ts index 18d9eb74d6a56..647c4306dc778 100644 --- a/x-pack/performance/journeys/login.ts +++ b/x-pack/performance/journeys/login.ts @@ -44,8 +44,10 @@ export const journey = new Journey({ await page.type(subj('loginUsername'), auth.getUsername(), { delay: inputDelays.TYPING }); await page.type(subj('loginPassword'), auth.getPassword(), { delay: inputDelays.TYPING }); await page.click(subj('loginSubmit'), { delay: inputDelays.MOUSE_CLICK }); + await page.waitForSelector(subj('userMenuButton'), { + state: 'attached', + }); - await kibanaPage.waitForHeader(); log.error('test finished'); console.log('#test finished'); }); From 0f32649759ee8d9aaa4214c1a4d948fc0c1c5d3e Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Fri, 19 Jan 2024 10:17:08 +0100 Subject: [PATCH 05/15] force stop kibana --- packages/kbn-test/src/functional_tests/run_tests/run_tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts b/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts index 81c0039001197..a6f9db090197f 100644 --- a/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts +++ b/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts @@ -127,7 +127,7 @@ export async function runTests(log: ToolingLog, options: RunTestsOptions) { await setTimeout(delay); } - await procs.stop('kibana'); + await procs.stop('kibana', 'SIGKILL'); } finally { if (shutdownEs) { await shutdownEs(); From e72b17cb0c447752d4d6cb3f4f7abdfe7e19ca45 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Fri, 19 Jan 2024 11:26:51 +0100 Subject: [PATCH 06/15] revert back script changes --- .../scripts/steps/functional/performance_playwright.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.buildkite/scripts/steps/functional/performance_playwright.sh b/.buildkite/scripts/steps/functional/performance_playwright.sh index e948e6c3588ba..5c8e86f48506b 100644 --- a/.buildkite/scripts/steps/functional/performance_playwright.sh +++ b/.buildkite/scripts/steps/functional/performance_playwright.sh @@ -20,11 +20,7 @@ if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-performance-data-set-extraction" ]; t else # pipeline should use bare metal static worker echo "--- Running performance tests" - for i in {1..8} - do - echo "--- Running login journey #$i" - node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --journey-path "x-pack/performance/journeys/login.ts" - done + node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" fi echo "--- Upload journey step screenshots" From 7895c47bed657892cefb32483d2615bcebe5a417 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Sun, 21 Jan 2024 11:45:40 +0100 Subject: [PATCH 07/15] update waiting for dashboard list view --- .../kbn-journeys/services/page/kibana_page.ts | 4 +++ .../journeys/dashboard_listing_page.ts | 25 +++++++++++-------- .../journeys/ecommerce_dashboard.ts | 4 +-- .../journeys/ecommerce_dashboard_map_only.ts | 4 +-- .../ecommerce_dashboard_saved_search_only.ts | 4 +-- .../ecommerce_dashboard_tsvb_gauge_only.ts | 4 +-- .../performance/journeys/flight_dashboard.ts | 4 +-- x-pack/performance/journeys/login.ts | 7 +----- .../journeys/many_fields_lens_editor.ts | 4 +-- .../journeys/promotion_tracking_dashboard.ts | 4 +-- .../journeys/web_logs_dashboard.ts | 4 +-- 11 files changed, 36 insertions(+), 32 deletions(-) diff --git a/packages/kbn-journeys/services/page/kibana_page.ts b/packages/kbn-journeys/services/page/kibana_page.ts index 8a45faf1a97cc..3001d74a8e897 100644 --- a/packages/kbn-journeys/services/page/kibana_page.ts +++ b/packages/kbn-journeys/services/page/kibana_page.ts @@ -36,6 +36,10 @@ export class KibanaPage { }); } + async waitForListViewTable() { + await this.page.waitForSelector(subj('table-is-ready'), { state: 'visible' }); + } + async backToDashboardListing() { await this.page.click(subj('breadcrumb dashboardListingBreadcrumb first')); } diff --git a/x-pack/performance/journeys/dashboard_listing_page.ts b/x-pack/performance/journeys/dashboard_listing_page.ts index b0afacf2cafd3..3d8feb8bcbf10 100644 --- a/x-pack/performance/journeys/dashboard_listing_page.ts +++ b/x-pack/performance/journeys/dashboard_listing_page.ts @@ -16,21 +16,26 @@ export const journey = new Journey({ 'x-pack/performance/kbn_archives/logs_no_map_dashboard', ], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector(subj('table-is-ready')); + await kibanaPage.waitForListViewTable(); }) - .step('Search dashboards', async ({ page, inputDelays }) => { + .step('Search dashboards', async ({ page, inputDelays, kibanaPage }) => { await page.type(subj('tableListSearchBox'), 'Web', { delay: inputDelays.TYPING, }); - await page.waitForSelector(subj('table-is-ready')); + await kibanaPage.waitForListViewTable(); }) - .step('Delete dashboard', async ({ page }) => { - await page.click(subj('checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b')); + .step('Delete dashboard', async ({ page, kibanaPage }) => { + const deletedDashboard = page.locator( + subj('checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b') + ); + await deletedDashboard.click(); + //await page.click(subj('checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b')); await page.click(subj('deleteSelectedItems')); await page.click(subj('confirmModalConfirmButton')); - await page.waitForSelector(subj('table-is-ready')); + await kibanaPage.waitForListViewTable(); + await deletedDashboard.waitFor({ state: 'detached' }); }) .step('Add dashboard', async ({ page, inputDelays }) => { await page.click(subj('newItemButton')); @@ -41,7 +46,7 @@ export const journey = new Journey({ await page.click(subj('confirmSaveSavedObjectButton')); await page.waitForSelector(subj('saveDashboardSuccess')); }) - .step('Return to dashboard list', async ({ kibanaPage, page }) => { - kibanaPage.backToDashboardListing(); - await page.waitForSelector(subj('table-is-ready')); + .step('Return to dashboard list', async ({ kibanaPage }) => { + await kibanaPage.backToDashboardListing(); + await kibanaPage.waitForListViewTable(); }); diff --git a/x-pack/performance/journeys/ecommerce_dashboard.ts b/x-pack/performance/journeys/ecommerce_dashboard.ts index 118bddc3de5cd..2de431478c848 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/ecommerce_no_map_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Ecommerce Dashboard', async ({ page, kibanaPage }) => { diff --git a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts index 1aeb20312505f..cbf3c5f98e2ff 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard_map_only.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/ecommerce_map_only_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Ecommerce No Map Dashboard', async ({ page }) => { diff --git a/x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts b/x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts index fa24cb30844ad..af9d047881545 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/ecommerce_saved_search_only_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Ecommerce Dashboard with Saved Search only', async ({ page, kibanaPage }) => { diff --git a/x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts b/x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts index c22001896eb7c..d50860eb5f876 100644 --- a/x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts +++ b/x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/ecommerce_tsvb_gauge_only_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Ecommerce Dashboard with TSVB Gauge only', async ({ page, kibanaPage }) => { diff --git a/x-pack/performance/journeys/flight_dashboard.ts b/x-pack/performance/journeys/flight_dashboard.ts index 0ab488818d051..04867394f1be5 100644 --- a/x-pack/performance/journeys/flight_dashboard.ts +++ b/x-pack/performance/journeys/flight_dashboard.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/flights_no_map_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Flights Dashboard', async ({ page, kibanaPage }) => { diff --git a/x-pack/performance/journeys/login.ts b/x-pack/performance/journeys/login.ts index 647c4306dc778..4a602db6ae2b3 100644 --- a/x-pack/performance/journeys/login.ts +++ b/x-pack/performance/journeys/login.ts @@ -33,9 +33,7 @@ export const journey = new Journey({ ], maxDuration: '10m', }, -}).step('Login', async ({ page, kbnUrl, inputDelays, auth, kibanaPage, log }) => { - log.error('test started'); - console.log('#test started'); +}).step('Login', async ({ page, kbnUrl, inputDelays, auth }) => { await page.goto(kbnUrl.get()); if (auth.isCloud()) { await page.click(subj('loginCard-basic/cloud-basic'), { delay: inputDelays.MOUSE_CLICK }); @@ -47,7 +45,4 @@ export const journey = new Journey({ await page.waitForSelector(subj('userMenuButton'), { state: 'attached', }); - - log.error('test finished'); - console.log('#test finished'); }); diff --git a/x-pack/performance/journeys/many_fields_lens_editor.ts b/x-pack/performance/journeys/many_fields_lens_editor.ts index f14dbd17b6c23..2672d78955d28 100644 --- a/x-pack/performance/journeys/many_fields_lens_editor.ts +++ b/x-pack/performance/journeys/many_fields_lens_editor.ts @@ -13,13 +13,13 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/lens_many_fields'], esArchives: ['test/functional/fixtures/es_archiver/stress_test'], }) - .step('Go to Visualize Library landing page', async ({ page, kbnUrl }) => { + .step('Go to Visualize Library landing page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto( kbnUrl.get( `/app/visualize#/?_g=(filters:!(),time:(from:'2022-09-07T10:53:30.262Z',to:'2022-09-07T10:55:09.280Z'))` ) ); - await page.waitForSelector(subj('table-is-ready')); + await kibanaPage.waitForListViewTable(); // wait extra 10 seconds: we're not sure why, but the extra sleep before loading the editor makes the metrics more consistent // sometimes lens charts are not loaded await page.waitForTimeout(10000); diff --git a/x-pack/performance/journeys/promotion_tracking_dashboard.ts b/x-pack/performance/journeys/promotion_tracking_dashboard.ts index 77fed38c808d8..5217c10acae8b 100644 --- a/x-pack/performance/journeys/promotion_tracking_dashboard.ts +++ b/x-pack/performance/journeys/promotion_tracking_dashboard.ts @@ -35,9 +35,9 @@ export const journey = new Journey({ maxDuration: '10m', }, }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Promotion Tracking Dashboard', async ({ page }) => { diff --git a/x-pack/performance/journeys/web_logs_dashboard.ts b/x-pack/performance/journeys/web_logs_dashboard.ts index 28a80d2156900..26f05db108382 100644 --- a/x-pack/performance/journeys/web_logs_dashboard.ts +++ b/x-pack/performance/journeys/web_logs_dashboard.ts @@ -13,9 +13,9 @@ export const journey = new Journey({ kbnArchives: ['x-pack/performance/kbn_archives/logs_no_map_dashboard'], }) - .step('Go to Dashboards Page', async ({ page, kbnUrl }) => { + .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => { await page.goto(kbnUrl.get(`/app/dashboards`)); - await page.waitForSelector('#dashboardListingHeading'); + await kibanaPage.waitForListViewTable(); }) .step('Go to Web Logs Dashboard', async ({ page, kibanaPage }) => { From e77075331123931e142432832b71e21598f5c880 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Sun, 21 Jan 2024 12:48:32 +0100 Subject: [PATCH 08/15] remove extra logging --- packages/kbn-journeys/journey/journey_ftr_harness.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index e37f88db6512b..a2f83c46e43ae 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -185,7 +185,6 @@ export class JourneyFtrHarness { this.log.info(`Waiting for telemetry requests, including starting within next 3 secs`); this.pageTeardown$.next(this.page); await new Promise((resolve) => telemetryTracker.add(resolve)); - //await new Promise((resolve) => setTimeout(resolve, 100 * 1000)); } console.log('telemetryTracker closed'); @@ -230,14 +229,11 @@ export class JourneyFtrHarness { } private async onTeardown() { - console.log('--tearDownBrowserAndPage'); await this.tearDownBrowserAndPage(); // It is important that we complete the APM transaction after we close the browser and before we start // unloading the test data so that the scalability data extractor can focus on just the APM data produced // by Kibana running under test. - console.log('--teardownApm'); await this.teardownApm(); - console.log('--deleteArchives'); await Promise.all([ asyncForEach(this.journeyConfig.getEsArchives(), async (esArchive) => { await this.esArchiver.unload(esArchive); @@ -360,7 +356,6 @@ export class JourneyFtrHarness { } const id = ++this.telemetryTrackerCount; - this.log.debug(`Waiting for telemetry request #${id} to complete`); console.log(`Waiting for telemetry request #${id} to complete`); return Rx.of(requestSuccess$).pipe( From f64a4e30552efeb45ca23de5581ca89cbd55f80a Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 10:21:30 +0100 Subject: [PATCH 09/15] clean console logs --- .../journey/journey_ftr_harness.ts | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index a2f83c46e43ae..ec5af01e3c870 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -176,17 +176,14 @@ export class JourneyFtrHarness { private async tearDownBrowserAndPage() { if (this.page) { - console.log('telemetryTracker start'); const telemetryTracker = this.telemetryTrackerSubs.get(this.page); this.telemetryTrackerSubs.delete(this.page); if (telemetryTracker && !telemetryTracker.closed) { - console.log('telemetryTracker is not closed'); this.log.info(`Waiting for telemetry requests, including starting within next 3 secs`); this.pageTeardown$.next(this.page); await new Promise((resolve) => telemetryTracker.add(resolve)); } - console.log('telemetryTracker closed'); this.log.info('destroying page'); await this.client?.detach(); @@ -195,7 +192,6 @@ export class JourneyFtrHarness { } if (this.browser) { - console.log('closing browser'); await this.browser.close(); } } @@ -342,12 +338,6 @@ export class JourneyFtrHarness { this.pageTeardown$.pipe( Rx.first((p) => p === page), Rx.delay(3000) - // If EBT client buffers: - // Rx.mergeMap(async () => { - // await page.waitForFunction(() => { - // // return window.kibana_ebt_client.buffer_size == 0 - // }); - // }) ) ), Rx.mergeMap((request: Request) => { @@ -356,20 +346,19 @@ export class JourneyFtrHarness { } const id = ++this.telemetryTrackerCount; - this.log.debug(`Waiting for telemetry request #${id} to complete`); - console.log(`Waiting for telemetry request #${id} to complete`); + this.log.info(`Waiting for telemetry request #${id} to complete`); return Rx.of(requestSuccess$).pipe( Rx.timeout(60_000), Rx.catchError((error) => { if (error instanceof Error && error.name === 'TimeoutError') { - console.log(`Timeout error occurred: ${error.message}`); + this.log.error(`Timeout error occurred: ${error.message}`); } // Rethrow the error if it's not a TimeoutError return Rx.throwError(() => new Error(error)); }), Rx.tap({ - complete: () => console.log(`Telemetry request #${id} complete`), - error: (err) => console.log(err), + complete: () => this.log.info(`Telemetry request #${id} complete`), + error: (err) => this.log.error(`Telemetry request was not processed: ${err.message}`), }) ); }) @@ -463,8 +452,15 @@ export class JourneyFtrHarness { ? args.map((arg) => (typeof arg === 'string' ? arg : inspect(arg, false, null))).join(' ') : message.text(); - if (url.includes('kbn-ui-shared-deps-npm.dll.js')) { - // ignore errors/warning from kbn-ui-shared-deps-npm.dll.js + if (text.includes(`Unrecognized feature: 'web-share'`)) { + // ignore Error with Permissions-Policy header: Unrecognized feature: 'web-share' + return; + } + if ( + url.includes('kbn-ui-shared-deps-npm.dll.js') || + url.includes('kbn-ui-shared-deps-src.js') + ) { + // ignore messages from kbn-ui-shared-deps-npm.dll.js & kbn-ui-shared-deps-src.js return; } From 49172aa1676240bd9af7210ca3379a8faeab4334 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 10:22:04 +0100 Subject: [PATCH 10/15] remove commented code --- x-pack/performance/journeys/dashboard_listing_page.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/performance/journeys/dashboard_listing_page.ts b/x-pack/performance/journeys/dashboard_listing_page.ts index 3d8feb8bcbf10..bad94790b2805 100644 --- a/x-pack/performance/journeys/dashboard_listing_page.ts +++ b/x-pack/performance/journeys/dashboard_listing_page.ts @@ -31,7 +31,6 @@ export const journey = new Journey({ subj('checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b') ); await deletedDashboard.click(); - //await page.click(subj('checkboxSelectRow-edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b')); await page.click(subj('deleteSelectedItems')); await page.click(subj('confirmModalConfirmButton')); await kibanaPage.waitForListViewTable(); From 0a0e48a044b3ff044b2a63f96752c1af75180caf Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 11:06:26 +0100 Subject: [PATCH 11/15] more logs cleanup --- .../journey/journey_ftr_harness.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index ec5af01e3c870..552d3d3ee9184 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -443,8 +443,20 @@ export class JourneyFtrHarness { } private onConsoleEvent = async (message: playwright.ConsoleMessage) => { + // logging only events realted to performance metrics + const trackedEvents = ['performance_metric', 'Loaded Kibana']; + try { const { url, lineNumber, columnNumber } = message.location(); + + if ( + url.includes('kbn-ui-shared-deps-npm.dll.js') || + url.includes('kbn-ui-shared-deps-src.js') + ) { + // ignore messages from kbn-ui-shared-deps-npm.dll.js & kbn-ui-shared-deps-src.js + return; + } + const location = `${url}:${lineNumber}:${columnNumber}`; const args = await asyncMap(message.args(), (handle) => handle.jsonValue()); @@ -456,11 +468,13 @@ export class JourneyFtrHarness { // ignore Error with Permissions-Policy header: Unrecognized feature: 'web-share' return; } + if ( - url.includes('kbn-ui-shared-deps-npm.dll.js') || - url.includes('kbn-ui-shared-deps-src.js') + url.includes('core.entry.js') && + args.length > 1 && + ![trackedEvents].includes(args[1]?.ebt_event?.event_type) ) { - // ignore messages from kbn-ui-shared-deps-npm.dll.js & kbn-ui-shared-deps-src.js + // ignore events like "click" return; } From 0fcc3ba2afdbb57f27dff4229783dce3de3b8135 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 11:09:17 +0100 Subject: [PATCH 12/15] revert SIGKILL for kibana poc --- packages/kbn-test/src/functional_tests/run_tests/run_tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts b/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts index a6f9db090197f..81c0039001197 100644 --- a/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts +++ b/packages/kbn-test/src/functional_tests/run_tests/run_tests.ts @@ -127,7 +127,7 @@ export async function runTests(log: ToolingLog, options: RunTestsOptions) { await setTimeout(delay); } - await procs.stop('kibana', 'SIGKILL'); + await procs.stop('kibana'); } finally { if (shutdownEs) { await shutdownEs(); From beb0b9933562f186a3448e462a96235a94a810ef Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 14:29:41 +0100 Subject: [PATCH 13/15] fix logging events to console --- packages/kbn-journeys/journey/journey_ftr_harness.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index 552d3d3ee9184..77d960d99b169 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -443,9 +443,6 @@ export class JourneyFtrHarness { } private onConsoleEvent = async (message: playwright.ConsoleMessage) => { - // logging only events realted to performance metrics - const trackedEvents = ['performance_metric', 'Loaded Kibana']; - try { const { url, lineNumber, columnNumber } = message.location(); @@ -472,9 +469,9 @@ export class JourneyFtrHarness { if ( url.includes('core.entry.js') && args.length > 1 && - ![trackedEvents].includes(args[1]?.ebt_event?.event_type) + !('performance_metric' === args[1]?.ebt_event?.event_type) ) { - // ignore events like "click" + // ignore events like "click", log to console only 'event_type: performance_metric' return; } From 7dc16c3d7b5a406d58c6f0e68fca33c08db0dc0e Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 14:32:21 +0100 Subject: [PATCH 14/15] restore log --- packages/kbn-journeys/journey/journey_ftr_harness.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index 77d960d99b169..a1e9843c6b1d0 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -192,6 +192,7 @@ export class JourneyFtrHarness { } if (this.browser) { + this.log.info('closing browser'); await this.browser.close(); } } From 562bc2f52174a7ebe0ecd1094f6606f15d94b8d5 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 22 Jan 2024 14:50:12 +0100 Subject: [PATCH 15/15] fix deprecation warnings --- packages/kbn-journeys/journey/journey_ftr_harness.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/kbn-journeys/journey/journey_ftr_harness.ts b/packages/kbn-journeys/journey/journey_ftr_harness.ts index a1e9843c6b1d0..7becb99f3970b 100644 --- a/packages/kbn-journeys/journey/journey_ftr_harness.ts +++ b/packages/kbn-journeys/journey/journey_ftr_harness.ts @@ -333,8 +333,11 @@ export class JourneyFtrHarness { private telemetryTrackerCount = 0; private trackTelemetryRequests(page: Page) { - const requestSuccess$ = Rx.fromEvent(page, 'requestfinished'); - const request$ = Rx.fromEvent(page, 'request').pipe( + const requestSuccess$ = Rx.fromEvent( + page, + 'requestfinished' + ) as Rx.Observable; + const request$ = (Rx.fromEvent(page, 'request') as Rx.Observable).pipe( Rx.takeUntil( this.pageTeardown$.pipe( Rx.first((p) => p === page),