From 7a13a3abcbef082ff337d4e42779412a3c169c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 26 Jul 2024 09:52:57 +0200 Subject: [PATCH 01/13] enable endpoint FTRs --- x-pack/test/security_solution_endpoint/apps/endpoint/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts index 032865c4ad1ed..e38752e124a2a 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts @@ -12,8 +12,7 @@ import { FtrProviderContext } from '../../configs/ftr_provider_context'; export default function (providerContext: FtrProviderContext) { const { loadTestFile, getService, getPageObjects } = providerContext; - // Flaky: https://github.com/elastic/kibana/issues/186089 - describe('@skipInServerless endpoint', function () { + describe('endpoint', function () { const ingestManager = getService('ingestManager'); const log = getService('log'); const endpointTestResources = getService('endpointTestResources'); From 92ea4436dc9c5be42ffb318f002e1d11d22a2976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 26 Jul 2024 09:53:55 +0200 Subject: [PATCH 02/13] use relevant services and page objects from `test_serverless` project --- .../page_objects/index.ts | 2 +- .../page_objects/svl_common_page.ts | 118 ------------------ .../services/index.ts | 5 + 3 files changed, 6 insertions(+), 119 deletions(-) delete mode 100644 x-pack/test/security_solution_endpoint/page_objects/svl_common_page.ts diff --git a/x-pack/test/security_solution_endpoint/page_objects/index.ts b/x-pack/test/security_solution_endpoint/page_objects/index.ts index d7fb55608226f..d0b39c196a284 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/index.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/index.ts @@ -17,7 +17,7 @@ import { EndpointPolicyPageProvider } from './policy_page'; import { TrustedAppsPageProvider } from './trusted_apps_page'; import { FleetIntegrations } from './fleet_integrations_page'; import { ArtifactEntriesListPageProvider } from './artifact_entries_list_page'; -import { SvlCommonPageProvider } from './svl_common_page'; +import { SvlCommonPageProvider } from '../../../test_serverless/functional/page_objects/svl_common_page'; export const pageObjects = { ...xpackFunctionalPageObjects, diff --git a/x-pack/test/security_solution_endpoint/page_objects/svl_common_page.ts b/x-pack/test/security_solution_endpoint/page_objects/svl_common_page.ts deleted file mode 100644 index c08f0b22b2078..0000000000000 --- a/x-pack/test/security_solution_endpoint/page_objects/svl_common_page.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 { FtrProviderContext } from '../configs/ftr_provider_context'; - -/** copied from `x-pack/test_serverless/functional/page_objects` in order to be able to login when testing against serverless, - * without importing from a different project - */ -export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const config = getService('config'); - const pageObjects = getPageObjects(['security', 'common']); - const retry = getService('retry'); - const deployment = getService('deployment'); - const log = getService('log'); - const browser = getService('browser'); - - const delay = (ms: number) => - new Promise((resolve) => { - setTimeout(resolve, ms); - }); - - return { - async navigateToLoginForm() { - const url = deployment.getHostPort() + '/login'; - await browser.get(url); - // ensure welcome screen won't be shown. This is relevant for environments which don't allow - // to use the yml setting, e.g. cloud - await browser.setLocalStorageItem('home:welcome:show', 'false'); - - log.debug('Waiting for Login Form to appear.'); - await retry.waitForWithTimeout('login form', 10_000, async () => { - return await pageObjects.security.isLoginFormVisible(); - }); - }, - - async login() { - await pageObjects.security.forceLogout({ waitForLoginPage: false }); - - // adding sleep to settle down logout - await pageObjects.common.sleep(2500); - - await retry.waitForWithTimeout( - 'Waiting for successful authentication', - 90_000, - async () => { - if (!(await testSubjects.exists('loginUsername', { timeout: 1000 }))) { - await this.navigateToLoginForm(); - - await testSubjects.setValue('loginUsername', config.get('servers.kibana.username')); - await testSubjects.setValue('loginPassword', config.get('servers.kibana.password')); - await testSubjects.click('loginSubmit'); - } - - if (await testSubjects.exists('userMenuButton', { timeout: 10_000 })) { - log.debug('userMenuButton is found, logged in passed'); - return true; - } else { - throw new Error(`Failed to login to Kibana via UI`); - } - }, - async () => { - // Sometimes authentication fails and user is redirected to Cloud login page - // [plugins.security.authentication] Authentication attempt failed: UNEXPECTED_SESSION_ERROR - const currentUrl = await browser.getCurrentUrl(); - if (currentUrl.startsWith('https://cloud.elastic.co')) { - log.debug( - 'Probably authentication attempt failed, we are at Cloud login page. Retrying from scratch' - ); - } else { - const authError = await testSubjects.exists('promptPage', { timeout: 2500 }); - if (authError) { - log.debug('Probably SAML callback page, doing logout again'); - await pageObjects.security.forceLogout({ waitForLoginPage: false }); - } else { - const isOnLoginPage = await testSubjects.exists('loginUsername', { timeout: 1000 }); - if (isOnLoginPage) { - log.debug( - 'Probably ES user profile activation failed, waiting 2 seconds and pressing Login button again' - ); - await delay(2000); - await testSubjects.click('loginSubmit'); - } else { - log.debug('New behaviour, trying to navigate and login again'); - } - } - } - } - ); - log.debug('Logged in successfully'); - }, - - async forceLogout() { - await pageObjects.security.forceLogout({ waitForLoginPage: false }); - log.debug('Logged out successfully'); - }, - - async assertProjectHeaderExists() { - await testSubjects.existOrFail('kibanaProjectHeader'); - }, - - async clickUserAvatar() { - testSubjects.click('userMenuAvatar'); - }, - - async assertUserAvatarExists() { - await testSubjects.existOrFail('userMenuAvatar'); - }, - - async assertUserMenuExists() { - await testSubjects.existOrFail('userMenu'); - }, - }; -} diff --git a/x-pack/test/security_solution_endpoint/services/index.ts b/x-pack/test/security_solution_endpoint/services/index.ts index bf1c3a7c85c25..16940b44499b7 100644 --- a/x-pack/test/security_solution_endpoint/services/index.ts +++ b/x-pack/test/security_solution_endpoint/services/index.ts @@ -19,6 +19,8 @@ import { } from './supertest_with_cert'; import { SecuritySolutionEndpointDataStreamHelpers } from '../../common/services/security_solution/endpoint_data_stream_helpers'; import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution/endpoint_registry_helpers'; +import { SvlUserManagerProvider } from '../../../test_serverless/shared/services/svl_user_manager'; +import { SvlCommonApiServiceProvider } from '../../../test_serverless/shared/services/svl_common_api'; export const services = { ...xPackFunctionalServices, @@ -39,4 +41,7 @@ export const svlServices = { supertest: KibanaSupertestWithCertProvider, supertestWithoutAuth: KibanaSupertestWithCertWithoutAuthProvider, + + svlCommonApi: SvlCommonApiServiceProvider, + svlUserManager: SvlUserManagerProvider, }; From 20d286e413438c00d9dfa0cc9a51dd05b1edf570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 26 Jul 2024 09:54:22 +0200 Subject: [PATCH 03/13] replace `login()` with `loginWithRole()` in tests --- x-pack/test/security_solution_endpoint/apps/endpoint/index.ts | 2 +- .../test/security_solution_endpoint/apps/integrations/index.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts index e38752e124a2a..c9e27a00c09ba 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts @@ -37,7 +37,7 @@ export default function (providerContext: FtrProviderContext) { if (await isServerlessKibanaFlavor(kbnClient)) { log.info('login for serverless environment'); const pageObjects = getPageObjects(['svlCommonPage']); - await pageObjects.svlCommonPage.login(); + await pageObjects.svlCommonPage.loginWithRole('endpoint_operations_analyst'); } }); loadTestFile(require.resolve('./endpoint_list')); diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/index.ts b/x-pack/test/security_solution_endpoint/apps/integrations/index.ts index 7f5cfa4641471..81a3aadb1a439 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/index.ts @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../configs/ftr_provider_context'; export default function (providerContext: FtrProviderContext) { const { loadTestFile, getService, getPageObjects } = providerContext; - // Flaky: https://github.com/elastic/kibana/issues/186086 describe('endpoint', function () { const ingestManager = getService('ingestManager'); const log = getService('log'); @@ -37,7 +36,7 @@ export default function (providerContext: FtrProviderContext) { if (await isServerlessKibanaFlavor(kbnClient)) { log.info('login for serverless environment'); const pageObjects = getPageObjects(['svlCommonPage']); - await pageObjects.svlCommonPage.login(); + await pageObjects.svlCommonPage.loginWithRole('endpoint_operations_analyst'); } }); loadTestFile(require.resolve('./policy_list')); From a54dbcf55cf10d989cdc48e85fc1c0982a3d0812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Mon, 29 Jul 2024 11:10:47 +0200 Subject: [PATCH 04/13] fix type issues --- .../security_solution_endpoint/tsconfig.json | 27 +++++++++++++++++++ x-pack/test/tsconfig.json | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 x-pack/test/security_solution_endpoint/tsconfig.json diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json new file mode 100644 index 0000000000000..e99e0bd8653d1 --- /dev/null +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -0,0 +1,27 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "node", + "@kbn/ambient-ftr-types" + ], + "allowJs": false + }, + "include": [ + "**/*", + "../../../typings/**/*", + "../../../packages/kbn-test/types/ftr_globals/**/*" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + { + "path": "../tsconfig.json" + }, + { + "path": "../../test_serverless/tsconfig.json" + }, + ] +} \ No newline at end of file diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 7fb0a50ef0f09..16e8faa1f8861 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -24,7 +24,8 @@ "*/plugins/**/*", "*/packages/**/*", "*/*/packages/**/*", - "security_solution_api_integration/**/*" + "security_solution_api_integration/**/*", + "security_solution_endpoint/**/*" ], "kbn_references": [ "@kbn/test-suites-src", From f0c129f44451290a3b170073d2e46687d00f8940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Mon, 29 Jul 2024 14:18:02 +0200 Subject: [PATCH 05/13] change the role to `admin` to see both endpoints and alerts --- .../test/security_solution_endpoint/apps/integrations/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/index.ts b/x-pack/test/security_solution_endpoint/apps/integrations/index.ts index 81a3aadb1a439..3d2d68bbc380a 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/index.ts @@ -36,7 +36,7 @@ export default function (providerContext: FtrProviderContext) { if (await isServerlessKibanaFlavor(kbnClient)) { log.info('login for serverless environment'); const pageObjects = getPageObjects(['svlCommonPage']); - await pageObjects.svlCommonPage.loginWithRole('endpoint_operations_analyst'); + await pageObjects.svlCommonPage.loginWithRole('admin'); } }); loadTestFile(require.resolve('./policy_list')); From fcb7a5033bbb900f1f73efccc8f0c89264f85666 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:30:16 +0000 Subject: [PATCH 06/13] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- .../security_solution_endpoint/tsconfig.json | 59 +++++++++++-------- x-pack/test/tsconfig.json | 1 - 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json index e99e0bd8653d1..c7bfc9e9e9b5f 100644 --- a/x-pack/test/security_solution_endpoint/tsconfig.json +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -1,27 +1,36 @@ { - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "target/types", - "types": [ - "node", - "@kbn/ambient-ftr-types" - ], - "allowJs": false - }, - "include": [ - "**/*", - "../../../typings/**/*", - "../../../packages/kbn-test/types/ftr_globals/**/*" - ], - "exclude": [ - "target/**/*" + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "node", + "@kbn/ambient-ftr-types" ], - "kbn_references": [ - { - "path": "../tsconfig.json" - }, - { - "path": "../../test_serverless/tsconfig.json" - }, - ] -} \ No newline at end of file + "allowJs": false + }, + "include": [ + "**/*", + "../../../typings/**/*", + "../../../packages/kbn-test/types/ftr_globals/**/*" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + { + "path": "../tsconfig.json" + }, + { + "path": "../../test_serverless/tsconfig.json" + }, + "@kbn/expect", + "@kbn/security-solution-plugin", + "@kbn/repo-info", + "@kbn/securitysolution-list-constants", + "@kbn/fleet-plugin", + "@kbn/securitysolution-io-ts-list-types", + "@kbn/ftr-common-functional-ui-services", + "@kbn/test", + "@kbn/test-subj-selector", + ] +} diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 16e8faa1f8861..3449df8d6f23c 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -167,7 +167,6 @@ "@kbn/alerting-state-types", "@kbn/reporting-server", "@kbn/data-quality-plugin", - "@kbn/securitysolution-io-ts-list-types", "@kbn/ml-trained-models-utils", "@kbn/openapi-common", "@kbn/securitysolution-lists-common", From ed62a75c43177c13936f547cc2401a425f613647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Tue, 30 Jul 2024 10:36:54 +0200 Subject: [PATCH 07/13] type fix --- x-pack/test/security_solution_api_integration/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/test/security_solution_api_integration/tsconfig.json b/x-pack/test/security_solution_api_integration/tsconfig.json index 58651125c5068..a381ab9bb86ad 100644 --- a/x-pack/test/security_solution_api_integration/tsconfig.json +++ b/x-pack/test/security_solution_api_integration/tsconfig.json @@ -13,6 +13,7 @@ "target/**/*" ], "kbn_references": [ + { "path": "../security_solution_endpoint/tsconfig.json" }, "@kbn/test-suites-serverless", { "path": "../../test_serverless/api_integration/**/*" }, { "path": "../../test_serverless/shared/**/*" }, From e94ad3b00d9dd884f3c0bea73968d7a2df8ae853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Tue, 30 Jul 2024 10:50:19 +0200 Subject: [PATCH 08/13] fix tests --- .../security_solution_endpoint/configs/config.base.ts | 3 ++- .../configs/endpoint.config.ts | 2 ++ .../configs/ftr_provider_context.d.ts | 9 ++++++--- .../configs/integrations.config.ts | 2 ++ .../configs/serverless.endpoint.config.ts | 2 ++ .../configs/serverless.integrations.config.ts | 2 ++ .../security_solution_endpoint/page_objects/index.ts | 4 ++++ 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/configs/config.base.ts b/x-pack/test/security_solution_endpoint/configs/config.base.ts index 684dbf0e9510b..e3cefd1aa0f12 100644 --- a/x-pack/test/security_solution_endpoint/configs/config.base.ts +++ b/x-pack/test/security_solution_endpoint/configs/config.base.ts @@ -8,7 +8,6 @@ import { Config } from '@kbn/test'; import { FtrConfigProviderContext } from '@kbn/test'; import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution'; -import { pageObjects } from '../page_objects'; import type { TargetTags } from '../target_tags'; export const SUITE_TAGS: Record< @@ -33,6 +32,7 @@ export const generateConfig = async ({ kbnServerArgs = [], target, services, + pageObjects, }: { ftrConfigProviderContext: FtrConfigProviderContext; baseConfig: Config; @@ -41,6 +41,7 @@ export const generateConfig = async ({ kbnServerArgs?: string[]; target: keyof typeof SUITE_TAGS; services: any; + pageObjects: any; }): Promise => { const { readConfigFile } = ftrConfigProviderContext; // services are not ready yet, so we need to import them here diff --git a/x-pack/test/security_solution_endpoint/configs/endpoint.config.ts b/x-pack/test/security_solution_endpoint/configs/endpoint.config.ts index b7fed05f12656..cad89b4b3dcd9 100644 --- a/x-pack/test/security_solution_endpoint/configs/endpoint.config.ts +++ b/x-pack/test/security_solution_endpoint/configs/endpoint.config.ts @@ -9,6 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { resolve } from 'path'; import { generateConfig } from './config.base'; import { services } from '../services'; +import { pageObjects } from '../page_objects'; // eslint-disable-next-line import/no-default-export export default async function (ftrConfigProviderContext: FtrConfigProviderContext) { @@ -25,5 +26,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex junitReportName: 'X-Pack Endpoint Functional Tests on ESS', target: 'ess', services, + pageObjects, }); } diff --git a/x-pack/test/security_solution_endpoint/configs/ftr_provider_context.d.ts b/x-pack/test/security_solution_endpoint/configs/ftr_provider_context.d.ts index 464db920156b4..1166169b76ba2 100644 --- a/x-pack/test/security_solution_endpoint/configs/ftr_provider_context.d.ts +++ b/x-pack/test/security_solution_endpoint/configs/ftr_provider_context.d.ts @@ -7,7 +7,10 @@ import { GenericFtrProviderContext } from '@kbn/test'; -import { pageObjects } from '../page_objects'; -import { services } from '../services'; +import { pageObjects, svlPageObjects } from '../page_objects'; +import { services, svlServices } from '../services'; -export type FtrProviderContext = GenericFtrProviderContext; +export type FtrProviderContext = GenericFtrProviderContext< + typeof services & typeof svlServices, + typeof pageObjects & typeof svlPageObjects +>; diff --git a/x-pack/test/security_solution_endpoint/configs/integrations.config.ts b/x-pack/test/security_solution_endpoint/configs/integrations.config.ts index bed24d7741724..9a94b101dccf1 100644 --- a/x-pack/test/security_solution_endpoint/configs/integrations.config.ts +++ b/x-pack/test/security_solution_endpoint/configs/integrations.config.ts @@ -9,6 +9,7 @@ import { resolve } from 'path'; import { FtrConfigProviderContext } from '@kbn/test'; import { generateConfig } from './config.base'; import { services } from '../services'; +import { pageObjects } from '../page_objects'; // eslint-disable-next-line import/no-default-export export default async function (ftrConfigProviderContext: FtrConfigProviderContext) { @@ -29,5 +30,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex '--xpack.securitySolution.packagerTaskInterval=5s', ], services, + pageObjects, }); } diff --git a/x-pack/test/security_solution_endpoint/configs/serverless.endpoint.config.ts b/x-pack/test/security_solution_endpoint/configs/serverless.endpoint.config.ts index 4867cab58725d..3df139dc9dd9e 100644 --- a/x-pack/test/security_solution_endpoint/configs/serverless.endpoint.config.ts +++ b/x-pack/test/security_solution_endpoint/configs/serverless.endpoint.config.ts @@ -9,6 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test'; import { resolve } from 'path'; import { generateConfig } from './config.base'; import { svlServices } from '../services'; +import { svlPageObjects } from '../page_objects'; // eslint-disable-next-line import/no-default-export export default async function (ftrConfigProviderContext: FtrConfigProviderContext) { @@ -26,5 +27,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex kbnServerArgs: ['--serverless=security'], target: 'serverless', services: svlServices, + pageObjects: svlPageObjects, }); } diff --git a/x-pack/test/security_solution_endpoint/configs/serverless.integrations.config.ts b/x-pack/test/security_solution_endpoint/configs/serverless.integrations.config.ts index 7489c969d1984..2822d16a979e3 100644 --- a/x-pack/test/security_solution_endpoint/configs/serverless.integrations.config.ts +++ b/x-pack/test/security_solution_endpoint/configs/serverless.integrations.config.ts @@ -9,6 +9,7 @@ import { resolve } from 'path'; import { FtrConfigProviderContext } from '@kbn/test'; import { generateConfig } from './config.base'; import { svlServices } from '../services'; +import { svlPageObjects } from '../page_objects'; // eslint-disable-next-line import/no-default-export export default async function (ftrConfigProviderContext: FtrConfigProviderContext) { @@ -30,5 +31,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex '--xpack.securitySolution.packagerTaskInterval=5s', ], services: svlServices, + pageObjects: svlPageObjects, }); } diff --git a/x-pack/test/security_solution_endpoint/page_objects/index.ts b/x-pack/test/security_solution_endpoint/page_objects/index.ts index d0b39c196a284..3e677ceb2a28a 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/index.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/index.ts @@ -33,6 +33,10 @@ export const pageObjects = { trustedApps: TrustedAppsPageProvider, artifactEntriesList: ArtifactEntriesListPageProvider, fleetIntegrations: FleetIntegrations, +}; + +export const svlPageObjects = { + ...pageObjects, svlCommonPage: SvlCommonPageProvider, }; From d737e05afd0ac2fbb68048828783bfd1d623bc1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Tue, 30 Jul 2024 11:14:20 +0200 Subject: [PATCH 09/13] update tsconfig --- x-pack/test/security_solution_endpoint/tsconfig.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json index c7bfc9e9e9b5f..430b500b24096 100644 --- a/x-pack/test/security_solution_endpoint/tsconfig.json +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -17,12 +17,7 @@ "target/**/*" ], "kbn_references": [ - { - "path": "../tsconfig.json" - }, - { - "path": "../../test_serverless/tsconfig.json" - }, + "@kbn/test-suites-serverless", "@kbn/expect", "@kbn/security-solution-plugin", "@kbn/repo-info", @@ -33,4 +28,4 @@ "@kbn/test", "@kbn/test-subj-selector", ] -} +} \ No newline at end of file From 8a306c441c66043455c0f433e95c3734bbcdd624 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:27:50 +0000 Subject: [PATCH 10/13] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/test/security_solution_endpoint/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json index 430b500b24096..76adb22e285a4 100644 --- a/x-pack/test/security_solution_endpoint/tsconfig.json +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -17,7 +17,6 @@ "target/**/*" ], "kbn_references": [ - "@kbn/test-suites-serverless", "@kbn/expect", "@kbn/security-solution-plugin", "@kbn/repo-info", @@ -28,4 +27,4 @@ "@kbn/test", "@kbn/test-subj-selector", ] -} \ No newline at end of file +} From 5b885ae06fdfa3cda650c7d593080c369a06b9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 2 Aug 2024 12:58:37 +0200 Subject: [PATCH 11/13] fix lint errors --- x-pack/test/security_solution_endpoint/page_objects/index.ts | 2 +- x-pack/test/security_solution_endpoint/services/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/page_objects/index.ts b/x-pack/test/security_solution_endpoint/page_objects/index.ts index 3e677ceb2a28a..92ed420cd834a 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/index.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/index.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { SvlCommonPageProvider } from '@kbn/test-suites-serverless/functional/page_objects/svl_common_page'; import { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects'; import { EndpointPageProvider } from './endpoint_page'; import { EndpointPageUtils } from './page_utils'; @@ -17,7 +18,6 @@ import { EndpointPolicyPageProvider } from './policy_page'; import { TrustedAppsPageProvider } from './trusted_apps_page'; import { FleetIntegrations } from './fleet_integrations_page'; import { ArtifactEntriesListPageProvider } from './artifact_entries_list_page'; -import { SvlCommonPageProvider } from '../../../test_serverless/functional/page_objects/svl_common_page'; export const pageObjects = { ...xpackFunctionalPageObjects, diff --git a/x-pack/test/security_solution_endpoint/services/index.ts b/x-pack/test/security_solution_endpoint/services/index.ts index 16940b44499b7..716de8282564a 100644 --- a/x-pack/test/security_solution_endpoint/services/index.ts +++ b/x-pack/test/security_solution_endpoint/services/index.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { SvlUserManagerProvider } from '@kbn/test-suites-serverless/shared/services/svl_user_manager'; +import { SvlCommonApiServiceProvider } from '@kbn/test-suites-serverless/shared/services/svl_common_api'; import { services as xPackFunctionalServices } from '../../functional/services'; import { IngestManagerProvider } from '../../common/services/ingest_manager'; import { EndpointTelemetryTestResourcesProvider } from './endpoint_telemetry'; @@ -19,8 +21,6 @@ import { } from './supertest_with_cert'; import { SecuritySolutionEndpointDataStreamHelpers } from '../../common/services/security_solution/endpoint_data_stream_helpers'; import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution/endpoint_registry_helpers'; -import { SvlUserManagerProvider } from '../../../test_serverless/shared/services/svl_user_manager'; -import { SvlCommonApiServiceProvider } from '../../../test_serverless/shared/services/svl_common_api'; export const services = { ...xPackFunctionalServices, From 961d42a4889e1a8dcf4d1d1b2868fbc2fa5f74fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 2 Aug 2024 16:23:09 +0200 Subject: [PATCH 12/13] add serverless reference to tsconfig --- x-pack/test/security_solution_endpoint/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json index 76adb22e285a4..6b35306a0d693 100644 --- a/x-pack/test/security_solution_endpoint/tsconfig.json +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -17,6 +17,7 @@ "target/**/*" ], "kbn_references": [ + "@kbn/test-suites-serverless", "@kbn/expect", "@kbn/security-solution-plugin", "@kbn/repo-info", From 6213420304e03f548c42805651e75369edb93376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Mon, 5 Aug 2024 18:21:18 +0200 Subject: [PATCH 13/13] improve typing --- .../test/security_solution_endpoint/configs/config.base.ts | 6 ++++-- .../test/security_solution_endpoint/page_objects/index.ts | 2 ++ x-pack/test/security_solution_endpoint/services/index.ts | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/configs/config.base.ts b/x-pack/test/security_solution_endpoint/configs/config.base.ts index e3cefd1aa0f12..a4d1d121374d9 100644 --- a/x-pack/test/security_solution_endpoint/configs/config.base.ts +++ b/x-pack/test/security_solution_endpoint/configs/config.base.ts @@ -9,6 +9,8 @@ import { Config } from '@kbn/test'; import { FtrConfigProviderContext } from '@kbn/test'; import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution'; import type { TargetTags } from '../target_tags'; +import { PageObjects } from '../page_objects'; +import { Services } from '../services'; export const SUITE_TAGS: Record< 'ess' | 'serverless', @@ -40,8 +42,8 @@ export const generateConfig = async ({ junitReportName: string; kbnServerArgs?: string[]; target: keyof typeof SUITE_TAGS; - services: any; - pageObjects: any; + services: Services; + pageObjects: PageObjects; }): Promise => { const { readConfigFile } = ftrConfigProviderContext; // services are not ready yet, so we need to import them here diff --git a/x-pack/test/security_solution_endpoint/page_objects/index.ts b/x-pack/test/security_solution_endpoint/page_objects/index.ts index 92ed420cd834a..977076cc71044 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/index.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/index.ts @@ -40,3 +40,5 @@ export const svlPageObjects = { svlCommonPage: SvlCommonPageProvider, }; + +export type PageObjects = typeof pageObjects | typeof svlPageObjects; diff --git a/x-pack/test/security_solution_endpoint/services/index.ts b/x-pack/test/security_solution_endpoint/services/index.ts index 716de8282564a..c9b9d59fa56f6 100644 --- a/x-pack/test/security_solution_endpoint/services/index.ts +++ b/x-pack/test/security_solution_endpoint/services/index.ts @@ -45,3 +45,5 @@ export const svlServices = { svlCommonApi: SvlCommonApiServiceProvider, svlUserManager: SvlUserManagerProvider, }; + +export type Services = typeof services | typeof svlServices;