From d55223ddbaff409d1ff0234a54ad6b65fb8fb05d Mon Sep 17 00:00:00 2001 From: Sergi Romeu Date: Tue, 2 Dec 2025 11:49:14 +0100 Subject: [PATCH 1/3] chore: create scout structure for infra --- .buildkite/scout_ci_config.yml | 1 + .../plugins/infra/test/scout/README.md | 23 ++++++++++ .../infra/test/scout/ui/fixtures/index.ts | 43 +++++++++++++++++++ .../ui/fixtures/page_objects/inventory.ts | 17 ++++++++ .../scout/ui/parallel.playwright.config.ts | 14 ++++++ .../scout/ui/parallel_tests/global_setup.ts | 12 ++++++ .../inventory/inventory.spec.ts | 18 ++++++++ .../plugins/infra/test/scout/ui/tsconfig.json | 9 ++++ 8 files changed, 137 insertions(+) create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/README.md create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/index.ts create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/global_setup.ts create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/inventory/inventory.spec.ts create mode 100644 x-pack/solutions/observability/plugins/infra/test/scout/ui/tsconfig.json diff --git a/.buildkite/scout_ci_config.yml b/.buildkite/scout_ci_config.yml index 3092bc4907c76..040cb792dadc0 100644 --- a/.buildkite/scout_ci_config.yml +++ b/.buildkite/scout_ci_config.yml @@ -2,6 +2,7 @@ plugins: enabled: - apm + - infra - console - discover_enhanced - maps diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/README.md b/x-pack/solutions/observability/plugins/infra/test/scout/README.md new file mode 100644 index 0000000000000..10c957bb238dc --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/README.md @@ -0,0 +1,23 @@ +# How to run tests + +First start the servers: + +```bash +// ESS +node scripts/scout.js start-server --stateful + +// Serverless +node scripts/scout.js start-server --serverless=[es|oblt|security] +``` + +Then you can run the parallel tests in another terminal: + +```bash +// ESS +npx playwright test --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --project=local --grep @ess + +// Serverless +npx playwright test --project local --config x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts --grep @svlOblt +``` + +Test results are available in `x-pack/solutions/observability/plugins/infra/test/scout/ui/output` diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/index.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/index.ts new file mode 100644 index 0000000000000..8af156cb7ab53 --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/index.ts @@ -0,0 +1,43 @@ +/* + * 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 { + ObltPageObjects, + ObltTestFixtures, + ObltWorkerFixtures, + KibanaUrl, +} from '@kbn/scout-oblt'; +import { test as base, createLazyPageObject } from '@kbn/scout-oblt'; +import { InventoryPage } from './page_objects/inventory'; + +export interface ExtendedScoutTestFixtures extends ObltTestFixtures { + pageObjects: ObltPageObjects & { + inventoryPage: InventoryPage; + }; +} + +export const test = base.extend({ + pageObjects: async ( + { + pageObjects, + page, + kbnUrl, + }: { + pageObjects: ExtendedScoutTestFixtures['pageObjects']; + page: ExtendedScoutTestFixtures['page']; + kbnUrl: KibanaUrl; + }, + use: (pageObjects: ExtendedScoutTestFixtures['pageObjects']) => Promise + ) => { + const extendedPageObjects = { + ...pageObjects, + inventoryPage: createLazyPageObject(InventoryPage, page, kbnUrl), + }; + + await use(extendedPageObjects); + }, +}); diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts new file mode 100644 index 0000000000000..b9d11fe23a3c5 --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts @@ -0,0 +1,17 @@ +/* + * 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 { KibanaUrl, ScoutPage } from '@kbn/scout-oblt'; + +export class InventoryPage { + constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {} + + async goto() { + await this.page.goto(`${this.kbnUrl.app('metrics')}/inventory`); + return this.page.waitForLoadingIndicatorHidden(); + } +} diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts new file mode 100644 index 0000000000000..f30aba1eb5285 --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel.playwright.config.ts @@ -0,0 +1,14 @@ +/* + * 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 { createPlaywrightConfig } from '@kbn/scout-oblt'; + +export default createPlaywrightConfig({ + testDir: './parallel_tests', + workers: 2, + runGlobalSetup: true, +}); diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/global_setup.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/global_setup.ts new file mode 100644 index 0000000000000..9c22a9852e0ad --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/global_setup.ts @@ -0,0 +1,12 @@ +/* + * 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 { globalSetupHook } from '@kbn/scout-oblt'; + +globalSetupHook('Ingest data to Elasticsearch', { tag: ['@ess', '@svlOblt'] }, async ({}) => { + return; +}); diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/inventory/inventory.spec.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/inventory/inventory.spec.ts new file mode 100644 index 0000000000000..75b625ed81a1b --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/parallel_tests/inventory/inventory.spec.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 { expect } from '@kbn/scout-oblt'; +import { test } from '../../fixtures'; + +test.describe('Infrastructure Inventory', { tag: ['@ess', '@svlOblt'] }, () => { + test('Page should load', async ({ pageObjects: { inventoryPage }, browserAuth, page }) => { + await browserAuth.loginAsViewer(); + await inventoryPage.goto(); + + await expect(page.getByTestId('breadcrumb last')).toHaveText('Infrastructure inventory'); + }); +}); diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/tsconfig.json b/x-pack/solutions/observability/plugins/infra/test/scout/ui/tsconfig.json new file mode 100644 index 0000000000000..e1305fbdb5a81 --- /dev/null +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@kbn/tsconfig-base/tsconfig.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": ["**/*"], + "kbn_references": ["@kbn/scout-oblt"], + "exclude": ["target/**/*"] +} From 428efc82a13c288d1be7058fb5ec065f105e7375 Mon Sep 17 00:00:00 2001 From: Sergi Romeu Date: Tue, 2 Dec 2025 16:51:24 +0100 Subject: [PATCH 2/3] change order --- .buildkite/scout_ci_config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/scout_ci_config.yml b/.buildkite/scout_ci_config.yml index 99e41f68aff3b..24914dbf793af 100644 --- a/.buildkite/scout_ci_config.yml +++ b/.buildkite/scout_ci_config.yml @@ -2,17 +2,17 @@ plugins: enabled: - apm - - infra - console - discover_enhanced + - infra - maps - observability - observability_onboarding - painless_lab - profiling - security_solution - - streams_app - slo + - streams_app - workflows_extensions disabled: From f483558a48682eec13bcd7697c307283075ab962 Mon Sep 17 00:00:00 2001 From: Sergi Romeu Date: Wed, 3 Dec 2025 12:27:44 +0100 Subject: [PATCH 3/3] fix --- .../infra/test/scout/ui/fixtures/page_objects/inventory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts index b9d11fe23a3c5..2fffa5ab1e6d2 100644 --- a/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts +++ b/x-pack/solutions/observability/plugins/infra/test/scout/ui/fixtures/page_objects/inventory.ts @@ -12,6 +12,6 @@ export class InventoryPage { async goto() { await this.page.goto(`${this.kbnUrl.app('metrics')}/inventory`); - return this.page.waitForLoadingIndicatorHidden(); + await this.page.testSubj.waitForSelector('infraMetricsPage'); } }