diff --git a/docs/developer/contributing/development-functional-tests.asciidoc b/docs/developer/contributing/development-functional-tests.asciidoc index 23d43480eb09..88163ebb6804 100644 --- a/docs/developer/contributing/development-functional-tests.asciidoc +++ b/docs/developer/contributing/development-functional-tests.asciidoc @@ -203,7 +203,7 @@ Tests should run at the positive security boundary condition, meaning that they The functional UI tests now default to logging in with a user named `test_user` and the roles of this user can be changed dynamically without logging in and out. -In order to achieve this a new service was introduced called `createTestUserService` (see `test/common/services/security/test_user.ts`). The purpose of this test user service is to create roles defined in the test config files and setRoles() or restoreDefaults(). +In order to achieve this a new service was introduced called `createTestUserService` (see `packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts`). The purpose of this test user service is to create roles defined in the test config files and setRoles() or restoreDefaults(). An example of how to set the role like how its defined below: @@ -366,14 +366,14 @@ await testSubjects.click(‘containerButton’); ** `find.allByCssSelector()` **retry:**::: -// * Source: {kibana-blob}test/common/services/retry/retry.ts[test/common/services/retry/retry.ts] +// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/retry/retry.ts[packages/kbn-ftr-common-functional-services/services/retry/retry.ts] * Helpers for retrying operations * Popular methods: ** `retry.try(fn, onFailureBlock)` - Execute `fn` in a loop until it succeeds or the default timeout elapses. The optional `onFailureBlock` is executed before each retry attempt. ** `retry.tryForTime(ms, fn, onFailureBlock)` - Execute `fn` in a loop until it succeeds or `ms` milliseconds elapses. The optional `onFailureBlock` is executed before each retry attempt. **kibanaServer:**::: -// * Source: {kibana-blob}test/common/services/kibana_server/kibana_server.js[test/common/services/kibana_server/kibana_server.js] +// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/kibana_server/kibana_server.ts[packages/kbn-ftr-common-functional-services/services/kibana_server/kibana_server.ts] * Helpers for interacting with {kib}'s server * Commonly used methods: ** `kibanaServer.uiSettings.update()` @@ -381,7 +381,7 @@ await testSubjects.click(‘containerButton’); ** `kibanaServer.status.getOverallState()` **esArchiver:**::: -// * Source: {kibana-blob}test/common/services/es_archiver.ts[test/common/services/es_archiver.ts] +// * Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es_archiver.ts[packages/kbn-ftr-common-functional-services/services/es_archiver.ts] * Load/unload archives created with the `esArchiver` * Popular methods: ** `esArchiver.load(path)` @@ -393,7 +393,7 @@ Full list of services that are used in functional tests can be found here: {kiba **Low-level utilities:**::: * es -// ** Source: {kibana-blob}test/common/services/es.ts[test/common/services/es.ts] +// ** Source: {kibana-blob}packages/kbn-ftr-common-functional-services/services/es.ts[packages/kbn-ftr-common-functional-services/services/es.ts] ** {es} client ** Higher level options: `kibanaServer.uiSettings` or `esArchiver` * remote diff --git a/packages/kbn-ftr-common-functional-services/index.ts b/packages/kbn-ftr-common-functional-services/index.ts index 3cc6df44adf0..e02703a08a7b 100644 --- a/packages/kbn-ftr-common-functional-services/index.ts +++ b/packages/kbn-ftr-common-functional-services/index.ts @@ -10,6 +10,7 @@ import { ProvidedType } from '@kbn/test'; export { services as commonFunctionalServices } from './services/all'; import { KibanaServerProvider } from './services/kibana_server'; +export { KibanaServerProvider } from './services/kibana_server'; export type KibanaServer = ProvidedType; export { RetryService } from './services/retry'; @@ -18,6 +19,7 @@ import { EsArchiverProvider } from './services/es_archiver'; export type EsArchiver = ProvidedType; import { EsProvider } from './services/es'; +export { EsProvider } from './services/es'; export type Es = ProvidedType; import { SupertestWithoutAuthProvider } from './services/supertest_without_auth'; @@ -29,3 +31,6 @@ import { SamlAuthProvider } from './services/saml_auth/saml_auth_provider'; export type SamlAuthProviderType = ProvidedType; export type { FtrProviderContext } from './services/ftr_provider_context'; +export { runSavedObjInfoSvc } from './services/saved_object_info'; + +export type { BsearchService, SendOptions } from './services/bsearch'; diff --git a/packages/kbn-ftr-common-functional-services/services/all.ts b/packages/kbn-ftr-common-functional-services/services/all.ts index 49308faeb3dd..c6c0fb792bb8 100644 --- a/packages/kbn-ftr-common-functional-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-services/services/all.ts @@ -10,6 +10,13 @@ import { EsArchiverProvider } from './es_archiver'; import { EsProvider } from './es'; import { KibanaServerProvider } from './kibana_server'; import { RetryService } from './retry'; +import { BsearchService } from './bsearch'; +import { ConsoleProvider } from './console'; +import { DeploymentService } from './deployment'; +import { EsDeleteAllIndicesProvider } from './es_delete_all_indices'; +import { IndexPatternsService } from './index_patterns'; +import { SavedObjectInfoService } from './saved_object_info'; +import { RandomnessService } from './randomness'; import { SupertestWithoutAuthProvider } from './supertest_without_auth'; import { SamlAuthProvider } from './saml_auth'; @@ -18,6 +25,13 @@ export const services = { kibanaServer: KibanaServerProvider, esArchiver: EsArchiverProvider, retry: RetryService, + bsearch: BsearchService, + console: ConsoleProvider, + deployment: DeploymentService, + esDeleteAllIndices: EsDeleteAllIndicesProvider, + indexPatterns: IndexPatternsService, + savedObjectInfo: SavedObjectInfoService, + randomness: RandomnessService, supertestWithoutAuth: SupertestWithoutAuthProvider, samlAuth: SamlAuthProvider, }; diff --git a/test/common/services/bsearch.ts b/packages/kbn-ftr-common-functional-services/services/bsearch.ts similarity index 98% rename from test/common/services/bsearch.ts rename to packages/kbn-ftr-common-functional-services/services/bsearch.ts index 81063813cec5..b36834dedbca 100644 --- a/test/common/services/bsearch.ts +++ b/packages/kbn-ftr-common-functional-services/services/bsearch.ts @@ -12,7 +12,7 @@ import type SuperTest from 'supertest'; import type { IEsSearchResponse } from '@kbn/search-types'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common'; -import { FtrService } from '../ftr_provider_context'; +import { FtrService } from './ftr_provider_context'; /** * Function copied from here: @@ -62,6 +62,7 @@ export interface SendOptions { * }); * expect(response).eql({ ... your value ... }); */ + export class BsearchService extends FtrService { private readonly retry = this.ctx.getService('retry'); diff --git a/test/api_integration/apis/console/helpers.ts b/packages/kbn-ftr-common-functional-services/services/console.ts similarity index 95% rename from test/api_integration/apis/console/helpers.ts rename to packages/kbn-ftr-common-functional-services/services/console.ts index cfd1365f212f..1ca5128d83f7 100644 --- a/test/api_integration/apis/console/helpers.ts +++ b/packages/kbn-ftr-common-functional-services/services/console.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import type { FtrProviderContext } from '../../ftr_provider_context'; +import type { FtrProviderContext } from './ftr_provider_context'; -export function helpers(getService: FtrProviderContext['getService']) { +export function ConsoleProvider({ getService }: FtrProviderContext) { const client = getService('es'); const createIndex = async (indexName: string) => { diff --git a/test/common/services/deployment.ts b/packages/kbn-ftr-common-functional-services/services/deployment.ts similarity index 96% rename from test/common/services/deployment.ts rename to packages/kbn-ftr-common-functional-services/services/deployment.ts index e61d6b360da1..28474a6bc60e 100644 --- a/test/common/services/deployment.ts +++ b/packages/kbn-ftr-common-functional-services/services/deployment.ts @@ -11,7 +11,7 @@ import { Agent } from 'https'; import fetch from 'node-fetch'; import { getUrl } from '@kbn/test'; -import { FtrService } from '../ftr_provider_context'; +import { FtrService } from './ftr_provider_context'; export class DeploymentService extends FtrService { private readonly config = this.ctx.getService('config'); diff --git a/test/common/services/es_delete_all_indices.ts b/packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts similarity index 97% rename from test/common/services/es_delete_all_indices.ts rename to packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts index 5f0ecba2cbde..cf3f93d9ef6a 100644 --- a/test/common/services/es_delete_all_indices.ts +++ b/packages/kbn-ftr-common-functional-services/services/es_delete_all_indices.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from './ftr_provider_context'; export function EsDeleteAllIndicesProvider({ getService }: FtrProviderContext) { const log = getService('log'); diff --git a/test/common/services/index_patterns.ts b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts similarity index 74% rename from test/common/services/index_patterns.ts rename to packages/kbn-ftr-common-functional-services/services/index_patterns.ts index 3fe02863b856..f6610a8d8434 100644 --- a/test/common/services/index_patterns.ts +++ b/packages/kbn-ftr-common-functional-services/services/index_patterns.ts @@ -6,10 +6,14 @@ * Side Public License, v 1. */ -import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { INITIAL_REST_VERSION } from '@kbn/data-views-plugin/server/constants'; -import { DataViewSpec } from '@kbn/data-plugin/common'; -import { FtrService } from '../ftr_provider_context'; +import type { DataViewSpec } from '@kbn/data-plugin/common'; +import { FtrService } from './ftr_provider_context'; + +// The fallowing two constant values live in +// '@kbn/data-views-plugin/server/constants' and +// '@kbn/core-http-common' respectively. +const INITIAL_REST_VERSION = '2023-10-31' as const; +const ELASTIC_HTTP_VERSION_HEADER = 'elastic-api-version' as const; export class IndexPatternsService extends FtrService { private readonly kibanaServer = this.ctx.getService('kibanaServer'); diff --git a/test/common/services/randomness.ts b/packages/kbn-ftr-common-functional-services/services/randomness.ts similarity index 97% rename from test/common/services/randomness.ts rename to packages/kbn-ftr-common-functional-services/services/randomness.ts index c799c34539f1..d3ea0c74ff5d 100644 --- a/test/common/services/randomness.ts +++ b/packages/kbn-ftr-common-functional-services/services/randomness.ts @@ -9,7 +9,7 @@ import Chance from 'chance'; import { ToolingLog } from '@kbn/tooling-log'; -import { FtrService } from '../ftr_provider_context'; +import { FtrService } from './ftr_provider_context'; let __CACHED_SEED__: number | undefined; function getSeed(log: ToolingLog) { diff --git a/test/common/services/saved_object_info/index.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts similarity index 100% rename from test/common/services/saved_object_info/index.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/index.ts diff --git a/test/common/services/saved_object_info/saved_object_info.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts similarity index 97% rename from test/common/services/saved_object_info/saved_object_info.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts index a1b98cbd408b..289c730cac17 100644 --- a/test/common/services/saved_object_info/saved_object_info.ts +++ b/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_object_info.ts @@ -13,7 +13,7 @@ import { flow, pipe } from 'fp-ts/function'; import * as TE from 'fp-ts/lib/TaskEither'; import * as T from 'fp-ts/lib/Task'; import { ToolingLog } from '@kbn/tooling-log'; -import { FtrService } from '../../ftr_provider_context'; +import { FtrService } from '../ftr_provider_context'; import { print } from './utils'; const pluck = diff --git a/test/common/services/saved_object_info/saved_objects_info_svc.md b/packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md similarity index 100% rename from test/common/services/saved_object_info/saved_objects_info_svc.md rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/saved_objects_info_svc.md diff --git a/test/common/services/saved_object_info/use_with_jq.md b/packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md similarity index 100% rename from test/common/services/saved_object_info/use_with_jq.md rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/use_with_jq.md diff --git a/test/common/services/saved_object_info/utils.ts b/packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts similarity index 100% rename from test/common/services/saved_object_info/utils.ts rename to packages/kbn-ftr-common-functional-services/services/saved_object_info/utils.ts diff --git a/packages/kbn-ftr-common-functional-services/tsconfig.json b/packages/kbn-ftr-common-functional-services/tsconfig.json index 56a442ad2f5a..cde384b3d689 100644 --- a/packages/kbn-ftr-common-functional-services/tsconfig.json +++ b/packages/kbn-ftr-common-functional-services/tsconfig.json @@ -16,8 +16,14 @@ "@kbn/es-archiver", "@kbn/test", "@kbn/expect", + "@kbn/search-types", + "@kbn/core-http-common", + "@kbn/bfetch-plugin", + "@kbn/data-plugin", + "@kbn/dev-cli-runner", + "@kbn/dev-cli-errors", "@kbn/repo-info", - "@kbn/es", + "@kbn/es" ], "exclude": [ "target/**/*", diff --git a/packages/kbn-ftr-common-functional-ui-services/index.ts b/packages/kbn-ftr-common-functional-ui-services/index.ts index cd383a03e5f5..f5f5b9df5b8a 100644 --- a/packages/kbn-ftr-common-functional-ui-services/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/index.ts @@ -22,3 +22,4 @@ export { } from './services/remote/network_profiles'; export type { TimeoutOpt } from './types'; export { TestSubjects } from './services/test_subjects'; +export { SecurityService } from './services/security'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/all.ts b/packages/kbn-ftr-common-functional-ui-services/services/all.ts index bffa7468e14e..610697c69dfb 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/all.ts @@ -12,6 +12,7 @@ import { FindProvider } from './find'; import { TestSubjects } from './test_subjects'; import { BrowserProvider } from './browser'; import { ToastsService } from './toasts'; +import { SecurityServiceProvider } from './security'; export const services = { retryOnStale: RetryOnStaleProvider, @@ -20,4 +21,5 @@ export const services = { testSubjects: TestSubjects, browser: BrowserProvider, toasts: ToastsService, + security: SecurityServiceProvider, }; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts index 992fe27059e4..6f589ac6d1bb 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts @@ -7,12 +7,18 @@ */ import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; -import { RetryService } from '@kbn/ftr-common-functional-services'; +import { + RetryService, + EsProvider, + KibanaServerProvider, +} from '@kbn/ftr-common-functional-services'; import { services as commonFunctionalUiServices } from './all'; const services = { ...commonFunctionalUiServices, retry: RetryService, + es: EsProvider, + kibanaServer: KibanaServerProvider, }; export type FtrProviderContext = GenericFtrProviderContext; diff --git a/test/common/services/security/index.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts similarity index 83% rename from test/common/services/security/index.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/index.ts index d34246c0c441..308b2f8b075a 100644 --- a/test/common/services/security/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { SecurityServiceProvider } from './security'; +export { SecurityService, SecurityServiceProvider } from './security'; diff --git a/test/common/services/security/role.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/role.ts similarity index 100% rename from test/common/services/security/role.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/role.ts diff --git a/test/common/services/security/role_mappings.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts similarity index 100% rename from test/common/services/security/role_mappings.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/role_mappings.ts diff --git a/test/common/services/security/security.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/security.ts similarity index 95% rename from test/common/services/security/security.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/security.ts index a182f225f238..5a5ff531acd5 100644 --- a/test/common/services/security/security.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/security.ts @@ -9,7 +9,7 @@ import { Role } from './role'; import { User } from './user'; import { RoleMappings } from './role_mappings'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../ftr_provider_context'; import { createTestUserService, TestUserSupertestProvider, TestUser } from './test_user'; import { createSystemIndicesUser } from './system_indices_user'; diff --git a/test/common/services/security/system_indices_user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts similarity index 97% rename from test/common/services/security/system_indices_user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts index 52e166c64509..9d6016ebb17e 100644 --- a/test/common/services/security/system_indices_user.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/system_indices_user.ts @@ -13,7 +13,7 @@ import { createEsClientForFtrConfig, createRemoteEsClientForFtrConfig, } from '@kbn/test'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../ftr_provider_context'; const SYSTEM_INDICES_SUPERUSER_ROLE = 'system_indices_superuser'; diff --git a/test/common/services/security/test_user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts similarity index 96% rename from test/common/services/security/test_user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts index f3012304a95b..10a6da9f707d 100644 --- a/test/common/services/security/test_user.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/security/test_user.ts @@ -9,10 +9,11 @@ import { format as formatUrl } from 'url'; import supertest from 'supertest'; -import { type Browser, TestSubjects } from '@kbn/ftr-common-functional-ui-services'; +import type { Browser } from '../browser'; +import type { TestSubjects } from '../test_subjects'; import { Role } from './role'; import { User } from './user'; -import { FtrService, FtrProviderContext } from '../../ftr_provider_context'; +import { FtrService, FtrProviderContext } from '../ftr_provider_context'; const TEST_USER_NAME = 'test_user'; const TEST_USER_PASSWORD = 'changeme'; diff --git a/test/common/services/security/user.ts b/packages/kbn-ftr-common-functional-ui-services/services/security/user.ts similarity index 100% rename from test/common/services/security/user.ts rename to packages/kbn-ftr-common-functional-ui-services/services/security/user.ts diff --git a/scripts/saved_objs_info.js b/scripts/saved_objs_info.js index f17a2897b83d..229565921ba9 100644 --- a/scripts/saved_objs_info.js +++ b/scripts/saved_objs_info.js @@ -7,4 +7,4 @@ */ require('../src/setup_node_env'); -require('@kbn/test-suites-src/common/services/saved_object_info').runSavedObjInfoSvc(); +require('@kbn/ftr-common-functional-services').runSavedObjInfoSvc(); diff --git a/test/analytics/services/index.ts b/test/analytics/services/index.ts index 0c75df9bc205..0d3465986249 100644 --- a/test/analytics/services/index.ts +++ b/test/analytics/services/index.ts @@ -7,14 +7,17 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services as commonServices } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + import { services as functionalServices } from '../../functional/services'; import { pageObjects } from '../../functional/page_objects'; import { KibanaEBTServerProvider, KibanaEBTUIProvider } from './kibana_ebt'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, ...functionalServices, kibana_ebt_server: KibanaEBTServerProvider, kibana_ebt_ui: KibanaEBTUIProvider, diff --git a/test/api_integration/apis/console/autocomplete_entities.ts b/test/api_integration/apis/console/autocomplete_entities.ts index a410e50950cd..1993ef1f7fe1 100644 --- a/test/api_integration/apis/console/autocomplete_entities.ts +++ b/test/api_integration/apis/console/autocomplete_entities.ts @@ -8,25 +8,11 @@ import expect from '@kbn/expect'; import type { FtrProviderContext } from '../../ftr_provider_context'; -import { helpers } from './helpers'; export default ({ getService }: FtrProviderContext) => { - const { - createIndex, - createAlias, - createLegacyTemplate, - createIndexTemplate, - createComponentTemplate, - createDataStream, - deleteIndex, - deleteAlias, - deleteLegacyTemplate, - deleteIndexTemplate, - deleteComponentTemplate, - deleteDataStream, - } = helpers(getService); - + const console = getService('console'); const supertest = getService('supertest'); + const sendRequest = (query: object) => supertest.get('/api/console/autocomplete_entities').query(query); @@ -40,22 +26,26 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { // Setup indices, aliases, templates, and data streams - await createIndex(indexName); - await createAlias(indexName, aliasName); - await createComponentTemplate(componentTemplateName); - await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); - await createDataStream(dataStreamName); - await createLegacyTemplate(legacyTemplateName); + await console.createIndex(indexName); + await console.createAlias(indexName, aliasName); + await console.createComponentTemplate(componentTemplateName); + await console.createIndexTemplate( + indexTemplateName, + [dataStreamName], + [componentTemplateName] + ); + await console.createDataStream(dataStreamName); + await console.createLegacyTemplate(legacyTemplateName); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await deleteAlias(indexName, aliasName); - await deleteIndex(indexName); - await deleteDataStream(dataStreamName); - await deleteIndexTemplate(indexTemplateName); - await deleteComponentTemplate(componentTemplateName); - await deleteLegacyTemplate(legacyTemplateName); + await console.deleteAlias(indexName, aliasName); + await console.deleteIndex(indexName); + await console.deleteDataStream(dataStreamName); + await console.deleteIndexTemplate(indexTemplateName); + await console.deleteComponentTemplate(componentTemplateName); + await console.deleteLegacyTemplate(legacyTemplateName); }); it('should not succeed if no settings are provided in query params', async () => { diff --git a/test/api_integration/services/index.ts b/test/api_integration/services/index.ts index 42a2616b781a..f72460b7ffc5 100644 --- a/test/api_integration/services/index.ts +++ b/test/api_integration/services/index.ts @@ -6,12 +6,13 @@ * Side Public License, v 1. */ -import { services as commonServices } from '../../common/services'; - +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { KibanaSupertestProvider, ElasticsearchSupertestProvider } from './supertest'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, supertest: KibanaSupertestProvider, esSupertest: ElasticsearchSupertestProvider, }; diff --git a/test/common/config.js b/test/common/config.js index 163703a69335..8f2d6b7e1401 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -9,7 +9,6 @@ import path from 'path'; import { format as formatUrl } from 'url'; import { esTestConfig, kbnTestConfig, kibanaServerTestUser } from '@kbn/test'; -import { services } from './services'; export default function () { const servers = { @@ -85,6 +84,5 @@ export default function () { })}`, ], }, - services, }; } diff --git a/test/common/ftr_provider_context.ts b/test/common/ftr_provider_context.ts deleted file mode 100644 index 6d21aedfe1d5..000000000000 --- a/test/common/ftr_provider_context.ts +++ /dev/null @@ -1,14 +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 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { GenericFtrProviderContext, GenericFtrService } from '@kbn/test'; - -import { services } from './services'; - -export type FtrProviderContext = GenericFtrProviderContext; -export class FtrService extends GenericFtrService {} diff --git a/test/common/services/console.ts b/test/common/services/console.ts deleted file mode 100644 index a864952fa081..000000000000 --- a/test/common/services/console.ts +++ /dev/null @@ -1,15 +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 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import type { FtrProviderContext } from '../ftr_provider_context'; -import { helpers } from '../../api_integration/apis/console/helpers'; -export function ConsoleProvider({ getService }: FtrProviderContext) { - return { - helpers: helpers(getService), - }; -} diff --git a/test/common/services/index.ts b/test/common/services/index.ts deleted file mode 100644 index ccc786d4ccc6..000000000000 --- a/test/common/services/index.ts +++ /dev/null @@ -1,36 +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 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; -import { DeploymentService } from './deployment'; -import { RandomnessService } from './randomness'; -import { SecurityServiceProvider } from './security'; -import { EsDeleteAllIndicesProvider } from './es_delete_all_indices'; -import { SavedObjectInfoService } from './saved_object_info'; -import { IndexPatternsService } from './index_patterns'; -import { BsearchService } from './bsearch'; -import { ConsoleProvider } from './console'; - -// pick only services that work for any FTR config, e.g. 'samlAuth' requires SAML setup in config file -const { es, esArchiver, kibanaServer, retry, supertestWithoutAuth } = commonFunctionalServices; - -export const services = { - es, - esArchiver, - kibanaServer, - retry, - supertestWithoutAuth, - deployment: DeploymentService, - randomness: RandomnessService, - security: SecurityServiceProvider, - esDeleteAllIndices: EsDeleteAllIndicesProvider, - savedObjectInfo: SavedObjectInfoService, - indexPatterns: IndexPatternsService, - bsearch: BsearchService, - console: ConsoleProvider, -}; diff --git a/test/functional/apps/discover/ftr_provider_context.d.ts b/test/functional/apps/discover/ftr_provider_context.d.ts index 5bf34af1bf9f..b006a98a73d7 100644 --- a/test/functional/apps/discover/ftr_provider_context.d.ts +++ b/test/functional/apps/discover/ftr_provider_context.d.ts @@ -7,7 +7,13 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services } from '../../services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { services as functionalServces } from '../../services'; import { pageObjects } from '../../page_objects'; +const services = { + ...functionalServces, + ...commonFunctionalServices, +}; + export type FtrProviderContext = GenericFtrProviderContext; diff --git a/test/functional/services/index.ts b/test/functional/services/index.ts index 83672889eff7..01df9b5fdcbb 100644 --- a/test/functional/services/index.ts +++ b/test/functional/services/index.ts @@ -7,7 +7,7 @@ */ import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; -import { services as commonServiceProviders } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { AppsMenuService } from './apps_menu'; import { @@ -57,7 +57,7 @@ import { ESQLService } from './esql'; import { DataViewsService } from './data_views'; export const services = { - ...commonServiceProviders, + ...commonFunctionalServices, ...commonFunctionalUIServices, filterBar: FilterBarService, queryBar: QueryBarService, diff --git a/test/health_gateway/services/index.ts b/test/health_gateway/services/index.ts index b9c44e227ada..5a89fb849f95 100644 --- a/test/health_gateway/services/index.ts +++ b/test/health_gateway/services/index.ts @@ -6,11 +6,13 @@ * Side Public License, v 1. */ -import { services as commonServices } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { HealthGatewayService } from './health_gateway'; export const services = { - ...commonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, healthGateway: HealthGatewayService, }; diff --git a/test/server_integration/config.base.js b/test/server_integration/config.base.js index 71006c258c42..61243595505e 100644 --- a/test/server_integration/config.base.js +++ b/test/server_integration/config.base.js @@ -12,13 +12,15 @@ import { ElasticsearchSupertestProvider, } from './services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; + export default async function ({ readConfigFile }) { const commonConfig = await readConfigFile(require.resolve('../common/config')); const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js')); return { services: { - ...commonConfig.get('services'), + ...commonFunctionalServices, supertest: createKibanaSupertestProvider(), supertestWithoutAuth: KibanaSupertestWithoutAuthProvider, esSupertest: ElasticsearchSupertestProvider, diff --git a/test/server_integration/services/types.d.ts b/test/server_integration/services/types.d.ts index 2df95f0297f9..204c0ae0106e 100644 --- a/test/server_integration/services/types.d.ts +++ b/test/server_integration/services/types.d.ts @@ -7,7 +7,14 @@ */ import { GenericFtrProviderContext } from '@kbn/test'; -import { services as kibanaCommonServices } from '../../common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const kibanaCommonServices = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; + import { services as kibanaApiIntegrationServices } from '../../api_integration/services'; export type FtrProviderContext = GenericFtrProviderContext< diff --git a/test/tsconfig.json b/test/tsconfig.json index 9f9f062a1649..8b0d946bded6 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -47,8 +47,6 @@ "@kbn/controls-plugin", "@kbn/field-formats-plugin", "@kbn/axe-config", - "@kbn/dev-cli-runner", - "@kbn/dev-cli-errors", "@kbn/data-view-field-editor-plugin", "@kbn/data-views-plugin", "@kbn/guided-onboarding-plugin", @@ -71,7 +69,6 @@ "@kbn/links-plugin", "@kbn/ftr-common-functional-ui-services", "@kbn/monaco", - "@kbn/search-types", "@kbn/console-plugin", "@kbn/core-chrome-browser", "@kbn/default-nav-ml", diff --git a/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts b/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts index 13bc2ee7de9d..7c21e6df09f8 100644 --- a/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts +++ b/x-pack/test/api_integration/apis/cloud_security_posture/helper.ts @@ -11,7 +11,7 @@ import expect from '@kbn/expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import type { IndexDetails } from '@kbn/cloud-security-posture-common'; import { CLOUD_SECURITY_PLUGIN_VERSION } from '@kbn/cloud-security-posture-plugin/common/constants'; -import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import { SecurityService } from '@kbn/ftr-common-functional-ui-services'; export interface RoleCredentials { apiKey: { id: string; name: string }; diff --git a/x-pack/test/api_integration/apis/telemetry/telemetry.ts b/x-pack/test/api_integration/apis/telemetry/telemetry.ts index bae5c5b8cdc4..5e034ce3a184 100644 --- a/x-pack/test/api_integration/apis/telemetry/telemetry.ts +++ b/x-pack/test/api_integration/apis/telemetry/telemetry.ts @@ -26,7 +26,7 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; -import type { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; import basicClusterFixture from './fixtures/basiccluster.json'; import multiClusterFixture from './fixtures/multicluster.json'; import type { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/common/services/bsearch_secure.ts b/x-pack/test/common/services/bsearch_secure.ts index f454aa3818ea..ccd1866ddd66 100644 --- a/x-pack/test/common/services/bsearch_secure.ts +++ b/x-pack/test/common/services/bsearch_secure.ts @@ -5,8 +5,8 @@ * 2.0. */ -// NOTE: This is pretty much a copy/paste from test/common/services/bsearch.ts but with the ability -// to provide custom auth +// NOTE: This is pretty much a copy/paste from packages/kbn-ftr-common-functional-services/services/bsearch.ts +// but with the ability to provide custom auth import expect from '@kbn/expect'; import request from 'superagent'; diff --git a/x-pack/test/common/services/index.ts b/x-pack/test/common/services/index.ts index 5e931b440654..edf64c828e94 100644 --- a/x-pack/test/common/services/index.ts +++ b/x-pack/test/common/services/index.ts @@ -6,7 +6,8 @@ */ import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; -import { services as kibanaCommonServices } from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; import { InfraLogViewsServiceProvider } from './infra_log_views'; import { SpacesServiceProvider } from './spaces'; import { BsearchSecureService } from './bsearch_secure'; @@ -14,7 +15,8 @@ import { ApmSynthtraceKibanaClientProvider } from './apm_synthtrace_kibana_clien import { InfraSynthtraceKibanaClientProvider } from './infra_synthtrace_kibana_client'; export const services = { - ...kibanaCommonServices, + ...commonFunctionalServices, + ...commonFunctionalUIServices, infraLogViews: InfraLogViewsServiceProvider, supertest: kibanaApiIntegrationServices.supertest, spaces: SpacesServiceProvider, diff --git a/x-pack/test/defend_workflows_cypress/services.ts b/x-pack/test/defend_workflows_cypress/services.ts index 272cf7eb8da4..95fd493e6f66 100644 --- a/x-pack/test/defend_workflows_cypress/services.ts +++ b/x-pack/test/defend_workflows_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/fleet_api_integration/apis/test_users.ts b/x-pack/test/fleet_api_integration/apis/test_users.ts index f84c1f72fb65..74581fd681af 100644 --- a/x-pack/test/fleet_api_integration/apis/test_users.ts +++ b/x-pack/test/fleet_api_integration/apis/test_users.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; export const testUsers: { [rollName: string]: { username: string; password: string; permissions?: any }; diff --git a/x-pack/test/fleet_cypress/services.ts b/x-pack/test/fleet_cypress/services.ts index 272cf7eb8da4..8986c0928d75 100644 --- a/x-pack/test/fleet_cypress/services.ts +++ b/x-pack/test/fleet_cypress/services.ts @@ -4,5 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; -export * from '@kbn/test-suites-src/common/services'; +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/osquery_cypress/services.ts b/x-pack/test/osquery_cypress/services.ts index 272cf7eb8da4..95fd493e6f66 100644 --- a/x-pack/test/osquery_cypress/services.ts +++ b/x-pack/test/osquery_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts b/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts index 679a750af410..2f467d4507e7 100644 --- a/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts +++ b/x-pack/test/profiling_api_integration/common/create_profiling_users/helpers/create_or_update_user.ts @@ -8,7 +8,7 @@ /* eslint-disable no-console */ import { difference, union } from 'lodash'; -import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; import { Elasticsearch, Kibana } from '..'; import { callKibana, isAxiosError } from './call_kibana'; diff --git a/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts b/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts index d7c101dd52ea..18a056b001c5 100644 --- a/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts +++ b/x-pack/test/profiling_api_integration/common/create_profiling_users/index.ts @@ -5,7 +5,7 @@ * 2.0. */ import { asyncForEach } from '@kbn/std'; -import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; import { ProfilingUsername, profilingUsers } from './authentication'; import { AbortError, callKibana } from './helpers/call_kibana'; import { createOrUpdateUser } from './helpers/create_or_update_user'; diff --git a/x-pack/test/saved_objects_field_count/config.ts b/x-pack/test/saved_objects_field_count/config.ts index eb2aeb1df90a..603a325ca047 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -6,6 +6,7 @@ */ import { FtrConfigProviderContext } from '@kbn/test'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const kibanaCommonTestsConfig = await readConfigFile( @@ -15,6 +16,10 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...kibanaCommonTestsConfig.getAll(), + services: { + ...commonFunctionalServices, + }, + testFiles: [require.resolve('./test')], esTestCluster: { diff --git a/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts b/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts index da57ccf64860..00df4f0374c2 100644 --- a/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts +++ b/x-pack/test/security_solution_api_integration/config/services/security_solution_serverless_utils.ts @@ -9,7 +9,7 @@ import supertest from 'supertest'; import { format as formatUrl } from 'url'; import { IEsSearchResponse } from '@kbn/search-types'; import { RoleCredentials } from '@kbn/test-suites-serverless/shared/services'; -import type { SendOptions } from '@kbn/test-suites-src/common/services/bsearch'; +import type { SendOptions } from '@kbn/ftr-common-functional-services'; import type { SendOptions as SecureBsearchSendOptions } from '@kbn/test-suites-serverless/shared/services/bsearch_secure'; import type { FtrProviderContext } from '../../ftr_provider_context'; import type { SecuritySolutionUtilsInterface } from './types'; diff --git a/x-pack/test/security_solution_api_integration/config/services/types.ts b/x-pack/test/security_solution_api_integration/config/services/types.ts index 72397582dad0..838f31e69412 100644 --- a/x-pack/test/security_solution_api_integration/config/services/types.ts +++ b/x-pack/test/security_solution_api_integration/config/services/types.ts @@ -9,7 +9,7 @@ import TestAgent from 'supertest/lib/agent'; import type { IEsSearchResponse } from '@kbn/search-types'; import type { BsearchSecureService } from '@kbn/test-suites-serverless/shared/services/bsearch_secure'; -import type { BsearchService, SendOptions } from '@kbn/test-suites-src/common/services/bsearch'; +import type { BsearchService, SendOptions } from '@kbn/ftr-common-functional-services'; export interface SecuritySolutionServerlessBsearch extends Omit { send: (options: SendOptions) => Promise; diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts index 3bccaf4a00fe..a9663cd943a7 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/utils/users_and_roles.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SecurityService } from '@kbn/test-suites-src/common/services/security/security'; +import type { SecurityService } from '@kbn/ftr-common-functional-ui-services'; export const usersAndRolesFactory = (security: SecurityService) => ({ createRole: async ({ name, privileges }: { name: string; privileges: any }) => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts index 1c74a987e4fe..cf2ac65f1086 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/host_details.ts @@ -11,7 +11,7 @@ import { HostsQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; import { hostDetailsFilebeatExpectedResult } from '../mocks/host_details'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts index a39da25c81aa..80052ef3ddf5 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/hosts.ts @@ -16,7 +16,7 @@ import { FirstLastSeenStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts index 19710d4eedf4..22001c26b66b 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/hosts/trial_license_complete_tier/tests/uncommon_processes.ts @@ -12,7 +12,7 @@ import { HostsUncommonProcessesStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; const FROM = '2000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts index 5e9040424713..166af42ba570 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_details.ts @@ -11,7 +11,7 @@ import { NetworkQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts index 7254dc6e99a5..22edc8cff64d 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_dns.ts @@ -14,7 +14,7 @@ import { NetworkDnsStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts index 230686147107..8b1adb16975f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/network_top_n_flow.ts @@ -15,7 +15,7 @@ import { NetworkTopNFlowStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts index 4c555ca0d655..36b2b677a194 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/network/trial_license_complete_tier/tests/tls.ts @@ -14,7 +14,8 @@ import { NetworkTlsStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts index d99fbd296ba3..ffb287239ac0 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_host.ts @@ -12,7 +12,7 @@ import { HostsOverviewStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts index 952e3eed8f8a..f8d4aa80c0e3 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/overview/trial_license_complete_tier/tests/overview_network.ts @@ -11,7 +11,7 @@ import { NetworkQueries, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; export default function ({ getService }: FtrProviderContextWithSpaces) { diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts index d7329a597e2e..39dddc7a0c04 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/authentications.ts @@ -15,7 +15,7 @@ import { import type { UserAuthenticationsRequestOptions } from '@kbn/security-solution-plugin/common/api/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; const FROM = '2000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts index 65b44bf4cbc5..6765e6d2bb16 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/explore/users/trial_license_complete_tier/tests/users.ts @@ -14,7 +14,8 @@ import { NetworkUsersStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts index c66978bbe1b4..c42ac64de4a2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/events.ts @@ -14,8 +14,9 @@ import { TimelineEventsAllStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; + import { getFieldsToRequest, getFilterValue } from '../../../../utils'; const TO = '3000-01-01T00:00:00.000Z'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts index 1e3119260455..12539d43a145 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/tests/timeline_details.ts @@ -13,7 +13,8 @@ import { TimelineKpiStrategyResponse, } from '@kbn/security-solution-plugin/common/search_strategy'; import TestAgent from 'supertest/lib/agent'; -import { BsearchService } from '@kbn/test-suites-src/common/services/bsearch'; + +import { BsearchService } from '@kbn/ftr-common-functional-services'; import { FtrProviderContextWithSpaces } from '../../../../../ftr_provider_context_with_spaces'; import { timelineDetailsFilebeatExpectedResults as EXPECTED_DATA } from '../mocks/timeline_details'; diff --git a/x-pack/test/security_solution_api_integration/tsconfig.json b/x-pack/test/security_solution_api_integration/tsconfig.json index 2f420920027d..1f558e3c3f05 100644 --- a/x-pack/test/security_solution_api_integration/tsconfig.json +++ b/x-pack/test/security_solution_api_integration/tsconfig.json @@ -49,6 +49,6 @@ "@kbn/dev-cli-runner", "@kbn/search-types", "@kbn/security-plugin", - "@kbn/test-suites-src", + "@kbn/ftr-common-functional-ui-services", ] } diff --git a/x-pack/test/threat_intelligence_cypress/services.ts b/x-pack/test/threat_intelligence_cypress/services.ts index 272cf7eb8da4..95fd493e6f66 100644 --- a/x-pack/test/threat_intelligence_cypress/services.ts +++ b/x-pack/test/threat_intelligence_cypress/services.ts @@ -5,4 +5,10 @@ * 2.0. */ -export * from '@kbn/test-suites-src/common/services'; +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { commonFunctionalUIServices } from '@kbn/ftr-common-functional-ui-services'; + +export const services = { + ...commonFunctionalServices, + ...commonFunctionalUIServices, +} as const; diff --git a/x-pack/test/upgrade_assistant_integration/config.js b/x-pack/test/upgrade_assistant_integration/config.js index dbdf0ade8aff..9529e4bc568d 100644 --- a/x-pack/test/upgrade_assistant_integration/config.js +++ b/x-pack/test/upgrade_assistant_integration/config.js @@ -5,6 +5,8 @@ * 2.0. */ +import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; + export default async function ({ readConfigFile }) { // Read the Kibana API integration tests config file so that we can utilize its services. const kibanaAPITestsConfig = await readConfigFile( @@ -13,15 +15,12 @@ export default async function ({ readConfigFile }) { const xPackFunctionalTestsConfig = await readConfigFile( require.resolve('../functional/config.base.js') ); - const kibanaCommonConfig = await readConfigFile( - require.resolve('@kbn/test-suites-src/common/config') - ); return { testFiles: [require.resolve('./upgrade_assistant')], servers: xPackFunctionalTestsConfig.get('servers'), services: { - ...kibanaCommonConfig.get('services'), + ...commonFunctionalServices, supertest: kibanaAPITestsConfig.get('services.supertest'), }, junit: { diff --git a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts b/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts index 72640103c0ef..3ec162ad28ff 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts +++ b/x-pack/test_serverless/api_integration/test_suites/common/console/autocomplete_entities.ts @@ -11,7 +11,7 @@ import { InternalRequestHeader, RoleCredentials } from '../../../../shared/servi export default ({ getService }: FtrProviderContext) => { const svlCommonApi = getService('svlCommonApi'); - const consoleService = getService('console'); + const console = getService('console'); const svlUserManager = getService('svlUserManager'); const supertestWithoutAuth = getService('supertestWithoutAuth'); @@ -27,17 +27,6 @@ export default ({ getService }: FtrProviderContext) => { }; describe('/api/console/autocomplete_entities', function () { - let createIndex: (typeof consoleService)['helpers']['createIndex']; - let createAlias: (typeof consoleService)['helpers']['createAlias']; - let createIndexTemplate: (typeof consoleService)['helpers']['createIndexTemplate']; - let createComponentTemplate: (typeof consoleService)['helpers']['createComponentTemplate']; - let createDataStream: (typeof consoleService)['helpers']['createDataStream']; - let deleteIndex: (typeof consoleService)['helpers']['deleteIndex']; - let deleteAlias: (typeof consoleService)['helpers']['deleteAlias']; - let deleteIndexTemplate: (typeof consoleService)['helpers']['deleteIndexTemplate']; - let deleteComponentTemplate: (typeof consoleService)['helpers']['deleteComponentTemplate']; - let deleteDataStream: (typeof consoleService)['helpers']['deleteDataStream']; - const indexName = 'test-index-1'; const aliasName = 'test-alias-1'; const indexTemplateName = 'test-index-template-1'; @@ -47,36 +36,26 @@ export default ({ getService }: FtrProviderContext) => { before(async () => { roleAuthc = await svlUserManager.createM2mApiKeyWithRoleScope('admin'); internalRequestHeader = svlCommonApi.getInternalRequestHeader(); - ({ - helpers: { - createIndex, - createAlias, - createIndexTemplate, - createComponentTemplate, - createDataStream, - deleteIndex, - deleteAlias, - deleteIndexTemplate, - deleteComponentTemplate, - deleteDataStream, - }, - } = consoleService); // Setup indices, aliases, templates, and data streams - await createIndex(indexName); - await createAlias(indexName, aliasName); - await createComponentTemplate(componentTemplateName); - await createIndexTemplate(indexTemplateName, [dataStreamName], [componentTemplateName]); - await createDataStream(dataStreamName); + await console.createIndex(indexName); + await console.createAlias(indexName, aliasName); + await console.createComponentTemplate(componentTemplateName); + await console.createIndexTemplate( + indexTemplateName, + [dataStreamName], + [componentTemplateName] + ); + await console.createDataStream(dataStreamName); }); after(async () => { // Cleanup indices, aliases, templates, and data streams - await deleteAlias(indexName, aliasName); - await deleteIndex(indexName); - await deleteDataStream(dataStreamName); - await deleteIndexTemplate(indexTemplateName); - await deleteComponentTemplate(componentTemplateName); + await console.deleteAlias(indexName, aliasName); + await console.deleteIndex(indexName); + await console.deleteDataStream(dataStreamName); + await console.deleteIndexTemplate(indexTemplateName); + await console.deleteComponentTemplate(componentTemplateName); await svlUserManager.invalidateM2mApiKeyWithRoleScope(roleAuthc); }); diff --git a/x-pack/test_serverless/shared/services/bsearch_secure.ts b/x-pack/test_serverless/shared/services/bsearch_secure.ts index 7ebe89bed824..03f8241c9e12 100644 --- a/x-pack/test_serverless/shared/services/bsearch_secure.ts +++ b/x-pack/test_serverless/shared/services/bsearch_secure.ts @@ -5,8 +5,8 @@ * 2.0. */ -// NOTE: This is pretty much a copy/paste from test/common/services/bsearch.ts but with the ability -// to provide custom auth +// NOTE: This is pretty much a copy/paste from packages/kbn-ftr-common-functional-services/services/bsearch.ts +// but with the ability to provide custom auth import expect from '@kbn/expect'; import { GenericFtrService } from '@kbn/test';