From 6b61fe5a54ff6a82a3c4b54201df7a324d8313d7 Mon Sep 17 00:00:00 2001
From: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
Date: Wed, 2 Oct 2024 17:44:57 +0200
Subject: [PATCH] [kbn-journey] add journeys running Kibana server with http2

---
 .buildkite/ftr_platform_stateful_configs.yml  |  5 ++++
 src/dev/performance/run_performance_cli.ts    |  1 +
 x-pack/performance/configs/http2_config.ts    | 20 +++++++++++++++
 .../data_stress_test_lens_http2.ts            | 18 +++++++++++++
 .../journeys_e2e/ecommerce_dashboard_http2.ts | 25 +++++++++++++++++++
 5 files changed, 69 insertions(+)
 create mode 100644 x-pack/performance/configs/http2_config.ts
 create mode 100644 x-pack/performance/journeys_e2e/data_stress_test_lens_http2.ts
 create mode 100644 x-pack/performance/journeys_e2e/ecommerce_dashboard_http2.ts

diff --git a/.buildkite/ftr_platform_stateful_configs.yml b/.buildkite/ftr_platform_stateful_configs.yml
index bc564624f8a5e..c6255ef8e128d 100644
--- a/.buildkite/ftr_platform_stateful_configs.yml
+++ b/.buildkite/ftr_platform_stateful_configs.yml
@@ -37,6 +37,9 @@ disabled:
   - x-pack/test/fleet_cypress/config.ts
   - x-pack/test/fleet_cypress/visual_config.ts
 
+  # Default http2 config to use for performance journeys
+  - x-pack/performance/configs/http2_config.ts
+
 defaultQueue: 'n2-4-spot'
 enabled:
   - test/accessibility/config.ts
@@ -341,6 +344,7 @@ enabled:
   - x-pack/test/usage_collection/config.ts
   - x-pack/performance/journeys_e2e/aiops_log_rate_analysis.ts
   - x-pack/performance/journeys_e2e/ecommerce_dashboard.ts
+  - x-pack/performance/journeys_e2e/ecommerce_dashboard_http2.ts
   - x-pack/performance/journeys_e2e/ecommerce_dashboard_map_only.ts
   - x-pack/performance/journeys_e2e/flight_dashboard.ts
   - x-pack/performance/journeys_e2e/login.ts
@@ -354,6 +358,7 @@ enabled:
   - x-pack/performance/journeys_e2e/web_logs_dashboard_esql.ts
   - x-pack/performance/journeys_e2e/web_logs_dashboard_dataview.ts
   - x-pack/performance/journeys_e2e/data_stress_test_lens.ts
+  - x-pack/performance/journeys_e2e/data_stress_test_lens_http2.ts
   - x-pack/performance/journeys_e2e/ecommerce_dashboard_saved_search_only.ts
   - x-pack/performance/journeys_e2e/ecommerce_dashboard_tsvb_gauge_only.ts
   - x-pack/performance/journeys_e2e/dashboard_listing_page.ts
diff --git a/src/dev/performance/run_performance_cli.ts b/src/dev/performance/run_performance_cli.ts
index df6020ba62a34..fd0f4094124ab 100644
--- a/src/dev/performance/run_performance_cli.ts
+++ b/src/dev/performance/run_performance_cli.ts
@@ -47,6 +47,7 @@ const journeyTargetGroups: JourneyTargetGroups = {
   maps: ['ecommerce_dashboard_map_only'],
   ml: ['aiops_log_rate_analysis', 'many_fields_transform', 'tsdb_logs_data_visualizer'],
   esql: ['many_fields_discover_esql', 'web_logs_dashboard_esql'],
+  http2: ['data_stress_test_lens_http2', 'ecommerce_dashboard_http2'],
 };
 
 const readFilesRecursively = (dir: string, callback: Function) => {
diff --git a/x-pack/performance/configs/http2_config.ts b/x-pack/performance/configs/http2_config.ts
new file mode 100644
index 0000000000000..d9d06b7c15ada
--- /dev/null
+++ b/x-pack/performance/configs/http2_config.ts
@@ -0,0 +1,20 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import type { FtrConfigProviderContext } from '@kbn/test';
+import { configureHTTP2 } from '@kbn/test-suites-src/common/configure_http2';
+
+// eslint-disable-next-line import/no-default-export
+export default async function ({ readConfigFile }: FtrConfigProviderContext) {
+  const xpackFunctionalConfig = await readConfigFile(
+    require.resolve('@kbn/test-suites-xpack/functional/config.base')
+  );
+
+  return configureHTTP2({
+    ...xpackFunctionalConfig.getAll(),
+  });
+}
diff --git a/x-pack/performance/journeys_e2e/data_stress_test_lens_http2.ts b/x-pack/performance/journeys_e2e/data_stress_test_lens_http2.ts
new file mode 100644
index 0000000000000..9f02fe7ba874a
--- /dev/null
+++ b/x-pack/performance/journeys_e2e/data_stress_test_lens_http2.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import { Journey } from '@kbn/journeys';
+
+export const journey = new Journey({
+  kbnArchives: ['test/functional/fixtures/kbn_archiver/stress_test'],
+  esArchives: ['test/functional/fixtures/es_archiver/stress_test'],
+  ftrConfigPath: 'x-pack/performance/configs/http2_config.ts',
+}).step('Go to dashboard', async ({ page, kbnUrl, kibanaServer, kibanaPage }) => {
+  await kibanaServer.uiSettings.update({ 'histogram:maxBars': 100 });
+  await page.goto(kbnUrl.get(`/app/dashboards#/view/92b143a0-2e9c-11ed-b1b6-a504560b392c`));
+  await kibanaPage.waitForVisualizations({ count: 1 });
+});
diff --git a/x-pack/performance/journeys_e2e/ecommerce_dashboard_http2.ts b/x-pack/performance/journeys_e2e/ecommerce_dashboard_http2.ts
new file mode 100644
index 0000000000000..57e11d461c00a
--- /dev/null
+++ b/x-pack/performance/journeys_e2e/ecommerce_dashboard_http2.ts
@@ -0,0 +1,25 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import { Journey } from '@kbn/journeys';
+import { subj } from '@kbn/test-subj-selector';
+
+export const journey = new Journey({
+  esArchives: ['x-pack/performance/es_archives/sample_data_ecommerce'],
+  kbnArchives: ['x-pack/performance/kbn_archives/ecommerce_no_map_dashboard'],
+  ftrConfigPath: 'x-pack/performance/configs/http2_config.ts',
+})
+
+  .step('Go to Dashboards Page', async ({ page, kbnUrl, kibanaPage }) => {
+    await page.goto(kbnUrl.get(`/app/dashboards`));
+    await kibanaPage.waitForListViewTable();
+  })
+
+  .step('Go to Ecommerce Dashboard', async ({ page, kibanaPage }) => {
+    await page.click(subj('dashboardListingTitleLink-[eCommerce]-Revenue-Dashboard'));
+    await kibanaPage.waitForVisualizations({ count: 13 });
+  });