diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5bf4539d002b7..0178163a5a02c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1347,6 +1347,19 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /x-pack/test_serverless/api_integration/test_suites/observability/logs_essentials_only @elastic/observability-ui /x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/serverless/oblt.logs_essentials.index.ts @elastic/observability-ui /x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/oblt.logs_essentials.serverless.config.ts @elastic/observability-ui +/x-pack/solutions/observability/test/kibana.jsonc @elastic/observability-ui +/x-pack/solutions/observability/test/tsconfig.json @elastic/observability-ui +/x-pack/solutions/observability/test/accessibility/ @elastic/observability-ui +/x-pack/solutions/observability/test/api_integration/config.ts @elastic/observability-ui +/x-pack/solutions/observability/test/api_integration/ftr_provider_context.d.ts @elastic/observability-ui +/x-pack/solutions/observability/test/alerting_api_integration/ftr_provider_context.d.ts @elastic/observability-ui +/x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/ @elastic/observability-ui +/x-pack/solutions/observability/test/api_integration_deployment_agnostic/ftr_provider_context.d.ts @elastic/observability-ui +/x-pack/solutions/observability/test/functional/config.base.ts @elastic/observability-ui +/x-pack/solutions/observability/test/functional/ftr_provider_context.d.ts @elastic/observability-ui +/x-pack/solutions/observability/test/functional/page_objects/index.ts @elastic/observability-ui +/x-pack/solutions/observability/test/functional/services/index.ts @elastic/observability-ui +/x-pack/solutions/observability/test/functional_with_es_ssl/apps/index.ts @elastic/observability-ui ### Observability Plugins @@ -1461,7 +1474,6 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /x-pack/solutions/observability/test/services/slo @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional/apps/slo @elastic/obs-ux-management-team /x-pack/solutions/observability/test/observability_api_integration @elastic/obs-ux-management-team # Assigned per https://github.com/elastic/kibana/pull/182243 -/x-pack/test/functional/services/observability @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional/services/observability @elastic/obs-ux-management-team /x-pack/test/api_integration/apis/slos @elastic/obs-ux-management-team /x-pack/test/accessibility/apps/group1/uptime.ts @elastic/obs-ux-management-team @@ -1504,9 +1516,9 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /x-pack/test/accessibility/apps/group3/stack_monitoring.ts @elastic/stack-monitoring # Fleet -/x-pack/test/common/services/ingest_manager.ts @elastic/fleet # Assigned per https://github.com/elastic/kibana/pull/201648#discussion_r1859018893 +/x-pack/platform/test/api_integration/services/ingest_manager.ts @elastic/fleet /x-pack/test/functional/es_archives/fleet @elastic/fleet -/x-pack/test/api_integration/services/fleet_and_agents.ts @elastic/fleet +/x-pack/platform/test/api_integration/services/fleet_and_agents.ts @elastic/fleet /x-pack/solutions/security/test/fleet_api_integration @elastic/fleet /x-pack/platform/test/fleet_api_integration @elastic/fleet /x-pack/platform/test/fleet_packages @elastic/fleet @@ -1536,7 +1548,6 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions #CC# /x-pack/plugins/observability_solution/observability/ @elastic/apm-ui # Uptime -/x-pack/test/functional/page_objects/uptime_page.ts @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional/page_objects/uptime_page.ts @elastic/obs-ux-management-team /x-pack/solutions/observability/test/accessibility/apps/uptime.ts @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional_with_es_ssl/apps/uptime/ @elastic/obs-ux-management-team @@ -1544,7 +1555,6 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /x-pack/solutions/observability/test/functional_with_es_ssl/ftr_provider_context.ts @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional/apps/uptime @elastic/obs-ux-management-team /x-pack/test/functional/es_archives/uptime @elastic/obs-ux-management-team -/x-pack/test/functional/services/uptime @elastic/obs-ux-management-team /x-pack/solutions/observability/test/functional/services/uptime @elastic/obs-ux-management-team /x-pack/solutions/observability/test/api_integration/apis/uptime @elastic/obs-ux-management-team /x-pack/solutions/observability/test/api_integration/apis/synthetics @elastic/obs-ux-management-team @@ -1566,7 +1576,6 @@ x-pack/solutions/observability/plugins/observability/server/lib/esql_extensions /x-pack/solutions/observability/test/functional/page_objects/dataset_quality.ts @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/test_suites/observability/index* @elastic/obs-ux-logs-team /x-pack/test_serverless/functional/test_suites/observability/cypress @elastic/obs-ux-logs-team -/x-pack/test/functional/services/infra_source_configuration_form.ts @elastic/obs-ux-infra_services-team /x-pack/solutions/observability/test/functional/services/infra_source_configuration_form.ts @elastic/obs-ux-infra_services-team /x-pack/solutions/observability/test/functional/services/logs_ui @elastic/obs-ux-logs-team /x-pack/test/functional/page_objects/observability_logs_explorer.ts @elastic/obs-ux-logs-team @@ -1868,6 +1877,8 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/test/functional/config.*.* @elastic/appex-qa /x-pack/platform/test/functional/config.*.* @elastic/appex-qa /x-pack/test/api_integration/ftr_provider_context.d.ts @elastic/appex-qa # Maybe this should be a glob? +/x-pack/test/functional/services/observability/alerts/common.ts @elastic/appex-qa +/x-pack/test/functional/services/observability/overview/common.ts @elastic/appex-qa /x-pack/test/accessibility/services.ts @elastic/appex-qa /x-pack/test/accessibility/page_objects.ts @elastic/appex-qa /x-pack/test/accessibility/ftr_provider_context.d.ts @elastic/appex-qa @@ -1887,7 +1898,6 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /src/platform/test/functional/services/lib @elastic/appex-qa /src/platform/test/functional/services/remote @elastic/appex-qa /src/platform/test/visual_regression @elastic/appex-qa -/x-pack/test/visual_regression @elastic/appex-qa /src/platform/packages/shared/kbn-test/src/functional_test_runner @elastic/appex-qa /packages/kbn-performance-testing-dataset-extractor @elastic/appex-qa /x-pack/test_serverless/**/*config.base.ts @elastic/appex-qa @@ -1908,36 +1918,15 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/platform/test/tsconfig.json @elastic/appex-qa /x-pack/platform/test/api_integration_basic/config.basic_license.ts @elastic/appex-qa /x-pack/platform/test/api_integration_basic/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/kibana.jsonc @elastic/appex-qa -/x-pack/solutions/observability/test/tsconfig.json @elastic/appex-qa -/x-pack/solutions/observability/test/api_integration/config.ts @elastic/appex-qa -/x-pack/solutions/observability/test/api_integration/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/api_integration_deployment_agnostic/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/alerting_api_integration/ftr_provider_context.d.ts @elastic/appex-qa /x-pack/solutions/security/test/kibana.jsonc @elastic/appex-qa /x-pack/solutions/security/test/tsconfig.json @elastic/appex-qa /x-pack/solutions/security/test/api_integration/config.ts @elastic/appex-qa /x-pack/solutions/security/test/api_integration/ftr_provider_context.d.ts @elastic/appex-qa /x-pack/solutions/security/test/api_integration/services/index.ts @elastic/appex-qa /x-pack/solutions/security/test/alerting_api_integration/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/serverless/oblt.index.ts @elastic/appex-qa # temporarily due to SKA tests relocation -/x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/serverless/oblt.serverless.config.ts @elastic/appex-qa # temporarily due to SKA tests relocation -/x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/stateful/oblt.index.ts @elastic/appex-qa # temporarily due to SKA tests relocation -/x-pack/solutions/observability/test/api_integration_deployment_agnostic/feature_flag_configs/stateful/oblt.stateful.config.ts @elastic/appex-qa # temporarily due to SKA tests relocation /x-pack/platform/test/serverless @elastic/appex-qa /x-pack/test/api_integration/deployment_agnostic @elastic/appex-qa /x-pack/platform/test/functional/services/ml/api.ts @elastic/appex-qa # temporarily due to SKA tests relocation -/x-pack/solutions/observability/test/functional/config.base.ts @elastic/appex-qa -/x-pack/solutions/observability/test/functional/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/functional/page_objects/index.ts @elastic/appex-qa -/x-pack/solutions/observability/test/functional/services/index.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/config.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/ftr_provider_context.d.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/index.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/page_objects.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/services.ts @elastic/appex-qa -/x-pack/solutions/observability/test/accessibility/apps/index.ts @elastic/appex-qa -/x-pack/solutions/observability/test/functional_with_es_ssl/apps/index.ts @elastic/appex-qa /x-pack/platform/test/.gitignore @elastic/appex-qa /x-pack/solutions/**/test/.gitignore @elastic/appex-qa /x-pack/platform/test/functional/services/pipeline_list.ts @elastic/appex-qa @@ -1962,7 +1951,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security /x-pack/platform/test/functional/page_objects/share_saved_objects_to_space_page.ts @elastic/kibana-core /x-pack/platform/test/functional/page_objects/banners_page.ts @elastic/kibana-core /x-pack/platform/test/common/lib/test_data_loader.ts @elastic/kibana-core -/x-pack/test/api_integration/services/usage_api.ts @elastic/kibana-core +/x-pack/platform/test/api_integration/services/usage_api.ts @elastic/kibana-core /x-pack/platform/test/api_integration/apis/kibana @elastic/kibana-core /src/platform/test/api_integration/fixtures/import.ndjson @elastic/kibana-core /x-pack/platform/test/plugin_api_integration @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/146704 @@ -2365,7 +2354,6 @@ x-pack/platform/test/functional/page_objects/search_profiler_page.ts @elastic/se # Security Solution /x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space @elastic/security-solution # Assigned per only use: https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_api_integration/test_suites/investigation/timeline/tests/timeline_migrations.ts#L58 /x-pack/test/functional/es_archives/packetbeat @elastic/security-solution -/x-pack/test/common/services/ingest_manager.ts @elastic/security-solution # Assigned per blame /x-pack/test/security_solution_ftr @elastic/security-solution /x-pack/test/functional/es_archives/security_solution @elastic/security-solution /x-pack/test/functional/es_archives/rule_exceptions @elastic/security-solution # Assigned per https://github.com/elastic/kibana/pull/199795/files/ae80bb252bc71f787c122849fcb9b01e386fc5e9#r1840233040 diff --git a/x-pack/platform/test/api_integration/services/index.ts b/x-pack/platform/test/api_integration/services/index.ts index 308a82b08ad69..7160566ce2028 100644 --- a/x-pack/platform/test/api_integration/services/index.ts +++ b/x-pack/platform/test/api_integration/services/index.ts @@ -20,6 +20,7 @@ import { IndexManagementProvider } from './index_management'; import { AlertingApiProvider } from './alerting_api'; import { MachineLearningProvider } from './ml'; import { ApmSynthtraceKibanaClientProvider } from './apm_synthtrace_kibana_client'; +import { IngestManagerProvider } from './ingest_manager'; export const services = { ...kibanaApiIntegrationServices, @@ -36,4 +37,5 @@ export const services = { transform: TransformProvider, usageAPI: UsageAPIProvider, apmSynthtraceKibanaClient: ApmSynthtraceKibanaClientProvider, + ingestManager: IngestManagerProvider, }; diff --git a/x-pack/test/common/services/ingest_manager.ts b/x-pack/platform/test/api_integration/services/ingest_manager.ts similarity index 100% rename from x-pack/test/common/services/ingest_manager.ts rename to x-pack/platform/test/api_integration/services/ingest_manager.ts diff --git a/x-pack/test/api_integration/deployment_agnostic/services/custom_role_scoped_supertest.ts b/x-pack/test/api_integration/deployment_agnostic/services/custom_role_scoped_supertest.ts deleted file mode 100644 index 2e52420cec287..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/custom_role_scoped_supertest.ts +++ /dev/null @@ -1,55 +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 { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; -import { SupertestWithRoleScope } from './role_scoped_supertest'; - -export interface RequestHeadersOptions { - useCookieHeader?: boolean; - withInternalHeaders?: boolean; - withCommonHeaders?: boolean; - withCustomHeaders?: Record; -} - -/** - * Provides a customized 'supertest' instance that is authenticated using the custom role-based API key - * and enriched with the appropriate request headers. This service allows you to perform - * HTTP requests with specific authentication and header configurations, ensuring that - * the requests are scoped to the provided role and environment. - * - * Use this service to easily test API endpoints with role-specific authorization and - * custom headers, both in serverless and stateful environments. - * - * Pass '{ useCookieHeader: true }' to use Cookie header for authentication instead of API key. - * It is the correct way to perform HTTP requests for internal end-points. - */ -export function CustomRoleScopedSupertestProvider({ - getService, -}: DeploymentAgnosticFtrProviderContext) { - const supertestWithoutAuth = getService('supertestWithoutAuth'); - const samlAuth = getService('samlAuth'); - - return { - async getSupertestWithCustomRoleScope( - options: RequestHeadersOptions = { - useCookieHeader: false, - withCommonHeaders: false, - withInternalHeaders: false, - } - ) { - // if 'useCookieHeader' set to 'true', HTTP requests will be called with cookie Header (like in browser) - if (options.useCookieHeader) { - const cookieHeader = await samlAuth.getM2MApiCookieCredentialsWithCustomRoleScope(); - return new SupertestWithRoleScope(cookieHeader, supertestWithoutAuth, samlAuth, options); - } - - // HTTP requests will be called with API key in header by default - const roleAuthc = await samlAuth.createM2mApiKeyWithCustomRoleScope(); - return new SupertestWithRoleScope(roleAuthc, supertestWithoutAuth, samlAuth, options); - }, - }; -} diff --git a/x-pack/test/api_integration/deployment_agnostic/services/deployment_agnostic_services.ts b/x-pack/test/api_integration/deployment_agnostic/services/deployment_agnostic_services.ts deleted file mode 100644 index 52223b69bcc86..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/deployment_agnostic_services.ts +++ /dev/null @@ -1,30 +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 _ from 'lodash'; -import { services as apiIntegrationServices } from '../../services'; - -/** - * Load only services that support both stateful & serverless deployments (including Cloud/MKI), - * e.g. `randomness` or `retry` are deployment agnostic - */ -export const deploymentAgnosticServices = _.pick(apiIntegrationServices, [ - 'supertest', // TODO: review its behaviour - 'es', - 'esDeleteAllIndices', // TODO: review its behaviour - 'esArchiver', - 'esSupertest', // TODO: review its behaviour - 'indexPatterns', - 'ingestPipelines', - 'kibanaServer', - 'ml', - 'randomness', - 'retry', - 'security', - 'usageAPI', - 'spaces', -]); diff --git a/x-pack/test/api_integration/deployment_agnostic/services/index.ts b/x-pack/test/api_integration/deployment_agnostic/services/index.ts index 92bb663aa0dc1..dd636a14de8e3 100644 --- a/x-pack/test/api_integration/deployment_agnostic/services/index.ts +++ b/x-pack/test/api_integration/deployment_agnostic/services/index.ts @@ -7,9 +7,6 @@ import { services as platformDeploymentAgnosticServices } from '@kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/services'; import { SupertestWithRoleScope } from '@kbn/test-suites-xpack-platform/api_integration_deployment_agnostic/services/role_scoped_supertest'; -import { SynthtraceProvider } from './synthtrace'; -import { ObservabilityAIAssistantApiProvider } from './observability_ai_assistant_api'; -import { AlertingApiProvider } from './alerting_api'; export type { InternalRequestHeader, @@ -20,9 +17,6 @@ export type { export const services = { ...platformDeploymentAgnosticServices, // these services are left for compatibility with existing tests in x-pack/test and should not be used in new tests - alertingApi: AlertingApiProvider, - synthtrace: SynthtraceProvider, - observabilityAIAssistantApi: ObservabilityAIAssistantApiProvider, }; export type SupertestWithRoleScopeType = SupertestWithRoleScope; diff --git a/x-pack/test/api_integration/deployment_agnostic/services/observability_ai_assistant_api.ts b/x-pack/test/api_integration/deployment_agnostic/services/observability_ai_assistant_api.ts deleted file mode 100644 index ad325338b673e..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/observability_ai_assistant_api.ts +++ /dev/null @@ -1,182 +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 { format } from 'url'; -import request from 'superagent'; -import type { - APIReturnType, - ObservabilityAIAssistantAPIClientRequestParamsOf as APIClientRequestParamsOf, - ObservabilityAIAssistantAPIEndpoint as APIEndpoint, -} from '@kbn/observability-ai-assistant-plugin/public'; -import { formatRequest } from '@kbn/server-route-repository'; -import type { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; - -type Options = { - type?: 'form-data'; - endpoint: TEndpoint; - spaceId?: string; -} & APIClientRequestParamsOf & { - params?: { query?: { _inspect?: boolean } }; - }; - -function createObservabilityAIAssistantApiClient({ - getService, -}: DeploymentAgnosticFtrProviderContext) { - const supertestWithoutAuth = getService('supertestWithoutAuth'); - const samlAuth = getService('samlAuth'); - const logger = getService('log'); - - async function sendApiRequest({ - options, - headers, - }: { - options: Options; - headers: Record; - }): Promise> { - const { endpoint, type } = options; - - const params = 'params' in options ? (options.params as Record) : {}; - - const { method, pathname, version } = formatRequest(endpoint, params.path); - const pathnameWithSpaceId = options.spaceId ? `/s/${options.spaceId}${pathname}` : pathname; - const url = format({ pathname: pathnameWithSpaceId, query: params?.query }); - - logger.debug(`Calling observability_ai_assistant API: ${method.toUpperCase()} ${url}`); - - if (version) { - headers['Elastic-Api-Version'] = version; - } - - let res: request.Response; - - if (type === 'form-data') { - const fields: Array<[string, any]> = Object.entries(params.body); - const formDataRequest = supertestWithoutAuth[method](url) - .set(headers) - .set('Content-type', 'multipart/form-data'); - - for (const field of fields) { - void formDataRequest.field(field[0], field[1]); - } - - res = await formDataRequest; - } else if (params.body) { - res = await supertestWithoutAuth[method](url).send(params.body).set(headers); - } else { - res = await supertestWithoutAuth[method](url).set(headers); - } - - return res; - } - - function makeApiRequest(role: string) { - return async ( - options: Options - ): Promise> => { - const headers: Record = { - ...samlAuth.getInternalRequestHeader(), - ...(await samlAuth.getM2MApiCookieCredentialsWithRoleScope(role)), - }; - - return sendApiRequest({ - options, - headers, - }); - }; - } - - async function deleteAllActionConnectors(): Promise { - const internalReqHeader = samlAuth.getInternalRequestHeader(); - const roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('editor'); - const res = await supertestWithoutAuth - .get(`/api/actions/connectors`) - .set(roleAuthc.apiKeyHeader) - .set(internalReqHeader); - - const body = res.body as Array<{ id: string; connector_type_id: string; name: string }>; - return Promise.all(body.map(({ id }) => deleteActionConnector({ actionId: id }))); - } - - async function deleteActionConnector({ actionId }: { actionId: string }) { - const internalReqHeader = samlAuth.getInternalRequestHeader(); - const roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('editor'); - return supertestWithoutAuth - .delete(`/api/actions/connector/${actionId}`) - .set(roleAuthc.apiKeyHeader) - .set(internalReqHeader); - } - - async function createProxyActionConnector({ port }: { port: number }) { - const internalReqHeader = samlAuth.getInternalRequestHeader(); - const roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('editor'); - try { - const res = await supertestWithoutAuth - .post('/api/actions/connector') - .set(roleAuthc.apiKeyHeader) - .set(internalReqHeader) - .set('kbn-xsrf', 'foo') - .send({ - name: 'OpenAI Proxy', - connector_type_id: '.gen-ai', - config: { - apiProvider: 'OpenAI', - apiUrl: `http://localhost:${port}`, - }, - secrets: { - apiKey: 'my-api-key', - }, - }) - .expect(200); - - const connectorId = res.body.id as string; - return connectorId; - } catch (e) { - logger.error(`Failed to create action connector due to: ${e}`); - throw e; - } - } - - return { - makeApiRequest, - deleteAllActionConnectors, - deleteActionConnector, - createProxyActionConnector, - }; -} - -export type ApiSupertest = ReturnType; - -export class ApiError extends Error { - status: number; - - constructor(res: request.Response, endpoint: string) { - super(`Error calling ${endpoint}: ${res.status} - ${res.text}`); - this.name = 'ApiError'; - this.status = res.status; - } -} - -export interface SupertestReturnType { - status: number; - body: APIReturnType; -} - -export function ObservabilityAIAssistantApiProvider(context: DeploymentAgnosticFtrProviderContext) { - const observabilityAIAssistantApiClient = createObservabilityAIAssistantApiClient(context); - return { - admin: observabilityAIAssistantApiClient.makeApiRequest('admin'), - viewer: observabilityAIAssistantApiClient.makeApiRequest('viewer'), - editor: observabilityAIAssistantApiClient.makeApiRequest('editor'), - deleteAllActionConnectors: observabilityAIAssistantApiClient.deleteAllActionConnectors, - createProxyActionConnector: observabilityAIAssistantApiClient.createProxyActionConnector, - deleteActionConnector: observabilityAIAssistantApiClient.deleteActionConnector, - }; -} - -export type ObservabilityAIAssistantApiClient = ReturnType< - typeof ObservabilityAIAssistantApiProvider ->; diff --git a/x-pack/test/api_integration/deployment_agnostic/services/role_scoped_supertest.ts b/x-pack/test/api_integration/deployment_agnostic/services/role_scoped_supertest.ts deleted file mode 100644 index 35c8bde01f0a6..0000000000000 --- a/x-pack/test/api_integration/deployment_agnostic/services/role_scoped_supertest.ts +++ /dev/null @@ -1,151 +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 { - RoleCredentials, - CookieCredentials, - SupertestWithoutAuthProviderType, - SamlAuthProviderType, -} from '@kbn/ftr-common-functional-services'; -import { Test } from 'supertest'; -import { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; - -export interface RequestHeadersOptions { - useCookieHeader?: boolean; - withInternalHeaders?: boolean; - withCommonHeaders?: boolean; - withCustomHeaders?: Record; -} - -export class SupertestWithRoleScope { - private authValue: RoleCredentials | CookieCredentials | null; - private readonly supertestWithoutAuth: SupertestWithoutAuthProviderType; - private samlAuth: SamlAuthProviderType; - private readonly options: RequestHeadersOptions; - - constructor( - authValue: RoleCredentials | CookieCredentials | null, - supertestWithoutAuth: SupertestWithoutAuthProviderType, - samlAuth: SamlAuthProviderType, - options: RequestHeadersOptions - ) { - this.authValue = authValue; - this.supertestWithoutAuth = supertestWithoutAuth; - this.samlAuth = samlAuth; - this.options = options; - } - - private isRoleCredentials(value: any): value is RoleCredentials { - return value && typeof value === 'object' && 'apiKey' in value && 'apiKeyHeader' in value; - } - - async destroy() { - if (this.isRoleCredentials(this.authValue)) { - await this.samlAuth.invalidateM2mApiKeyWithRoleScope(this.authValue); - this.authValue = null; - } - } - - private addHeaders(agent: Test): Test { - const { useCookieHeader, withInternalHeaders, withCommonHeaders, withCustomHeaders } = - this.options; - - if (useCookieHeader) { - if (!this.authValue || !('Cookie' in this.authValue)) { - throw new Error('The instance has already been destroyed or cookieHeader is missing.'); - } - // set cookie header - void agent.set(this.authValue); - } else { - if (!this.authValue || !this.isRoleCredentials(this.authValue)) { - throw new Error('The instance has already been destroyed or roleAuthc is missing.'); - } - // set API key header - void agent.set(this.authValue.apiKeyHeader); - } - - if (withInternalHeaders) { - void agent.set(this.samlAuth.getInternalRequestHeader()); - } - - if (withCommonHeaders) { - void agent.set(this.samlAuth.getCommonRequestHeader()); - } - - if (withCustomHeaders) { - void agent.set(withCustomHeaders); - } - - return agent; - } - - private request(method: 'post' | 'get' | 'put' | 'delete' | 'patch', url: string): Test { - if (!this.authValue) { - throw new Error('Instance has been destroyed and cannot be used for making requests.'); - } - const agent = this.supertestWithoutAuth[method](url); - return this.addHeaders(agent); - } - - post(url: string) { - return this.request('post', url); - } - - get(url: string) { - return this.request('get', url); - } - - put(url: string) { - return this.request('put', url); - } - - delete(url: string) { - return this.request('delete', url); - } - - patch(url: string) { - return this.request('patch', url); - } -} - -/** - * Provides a customized 'supertest' instance that is authenticated using a role-based API key - * and enriched with the appropriate request headers. This service allows you to perform - * HTTP requests with specific authentication and header configurations, ensuring that - * the requests are scoped to the provided role and environment. - * - * Use this service to easily test API endpoints with role-specific authorization and - * custom headers, both in serverless and stateful environments. - * - * Pass '{ useCookieHeader: true }' to use Cookie header for authentication instead of API key. - * It is the correct way to perform HTTP requests for internal end-points. - */ -export function RoleScopedSupertestProvider({ getService }: DeploymentAgnosticFtrProviderContext) { - const supertestWithoutAuth = getService('supertestWithoutAuth'); - const samlAuth = getService('samlAuth'); - - return { - async getSupertestWithRoleScope( - role: string, - options: RequestHeadersOptions = { - useCookieHeader: false, - withCommonHeaders: false, - withInternalHeaders: false, - } - ) { - // if 'useCookieHeader' set to 'true', HTTP requests will be called with cookie Header (like in browser) - if (options.useCookieHeader) { - const cookieHeader = await samlAuth.getM2MApiCookieCredentialsWithRoleScope(role); - return new SupertestWithRoleScope(cookieHeader, supertestWithoutAuth, samlAuth, options); - } - - // HTTP requests will be called with API key in header by default - const roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope(role); - return new SupertestWithRoleScope(roleAuthc, supertestWithoutAuth, samlAuth, options); - }, - }; -} diff --git a/x-pack/test/api_integration/services/fleet_and_agents.ts b/x-pack/test/api_integration/services/fleet_and_agents.ts deleted file mode 100644 index 8ca8c95c008c1..0000000000000 --- a/x-pack/test/api_integration/services/fleet_and_agents.ts +++ /dev/null @@ -1,39 +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 { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; -import { FtrProviderContext } from '../ftr_provider_context'; - -export async function FleetAndAgents({ getService }: FtrProviderContext) { - const es = getService('es'); - const supertestWithoutAuth = getService('supertestWithoutAuth'); - - return { - async setup() { - // Use elastic/fleet-server service account to execute setup to verify privilege configuration - const { token } = await es.security.createServiceToken({ - namespace: 'elastic', - service: 'fleet-server', - }); - - await supertestWithoutAuth - .post(`/api/fleet/setup`) - .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') - .set('kbn-xsrf', 'xxx') - .set('Authorization', `Bearer ${token.value}`) - .send() - .expect(200); - await supertestWithoutAuth - .post(`/api/fleet/agents/setup`) - .set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31') - .set('kbn-xsrf', 'xxx') - .set('Authorization', `Bearer ${token.value}`) - .send({ forceRecreate: true }) - .expect(200); - }, - }; -} diff --git a/x-pack/test/api_integration/services/index.ts b/x-pack/test/api_integration/services/index.ts index d4313ac8fa76e..2fb0a07d3db9e 100644 --- a/x-pack/test/api_integration/services/index.ts +++ b/x-pack/test/api_integration/services/index.ts @@ -7,16 +7,13 @@ import { services as kibanaApiIntegrationServices } from '@kbn/test-suites-src/api_integration/services'; import { MachineLearningProvider } from '@kbn/test-suites-xpack-platform/api_integration/services/ml'; +import { IngestManagerProvider } from '@kbn/test-suites-xpack-platform/api_integration/services/ingest_manager'; +import { UsageAPIProvider } from '@kbn/test-suites-xpack-platform/api_integration/services/usage_api'; import { services as commonServices } from '../../common/services'; // @ts-ignore not ts yet import { EsSupertestWithoutAuthProvider } from './es_supertest_without_auth'; - -import { UsageAPIProvider } from './usage_api'; - -import { IngestManagerProvider } from '../../common/services/ingest_manager'; import { SecuritySolutionApiProvider } from './security_solution_api.gen'; -import { FleetAndAgents } from './fleet_and_agents'; export const services = { ...commonServices, @@ -28,5 +25,4 @@ export const services = { ml: MachineLearningProvider, ingestManager: IngestManagerProvider, securitySolutionApi: SecuritySolutionApiProvider, - fleetAndAgents: FleetAndAgents, }; diff --git a/x-pack/test/functional/page_objects/index.ts b/x-pack/test/functional/page_objects/index.ts index 8fbc731e5b703..e2d7266bc131c 100644 --- a/x-pack/test/functional/page_objects/index.ts +++ b/x-pack/test/functional/page_objects/index.ts @@ -45,7 +45,6 @@ import { InfraHostsViewProvider } from './infra_hosts_view'; import { InfraLogsPageProvider } from './infra_logs_page'; import { ObservabilityLogsExplorerPageObject } from './observability_logs_explorer'; import { DatasetQualityPageObject } from './dataset_quality'; -import { UptimePageObject } from './uptime_page'; import { SearchPlaygroundPageProvider } from './search_playground_page'; import { SearchSynonymsPageProvider } from './search_synonyms_page'; import { SearchQueryRulesPageProvider } from './search_query_rules_page'; @@ -95,7 +94,6 @@ export const pageObjects = { spaceSelector: SpaceSelectorPageObject, tagManagement: TagManagementPageObject, upgradeAssistant: UpgradeAssistantFlyoutObject, - uptime: UptimePageObject, userProfiles: UserProfilePageProvider, watcher: WatcherPageObject, }; diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts deleted file mode 100644 index 07c7e25edd975..0000000000000 --- a/x-pack/test/functional/page_objects/uptime_page.ts +++ /dev/null @@ -1,126 +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 expect from '@kbn/expect'; -import { FtrService } from '../ftr_provider_context'; - -export class UptimePageObject extends FtrService { - private readonly timePicker = this.ctx.getPageObject('timePicker'); - private readonly header = this.ctx.getPageObject('header'); - - private readonly commonService = this.ctx.getService('uptime').common; - private readonly monitor = this.ctx.getService('uptime').monitor; - private readonly navigation = this.ctx.getService('uptime').navigation; - private readonly retry = this.ctx.getService('retry'); - - public async goToRoot(refresh?: boolean) { - await this.navigation.goToUptime(); - if (refresh) { - await this.navigation.refreshApp(); - } - } - - public async setDateRange(start: string, end: string) { - const { start: prevStart, end: prevEnd } = await this.timePicker.getTimeConfig(); - if (start !== prevStart || prevEnd !== end) { - await this.timePicker.setAbsoluteRange(start, end); - } else { - await this.navigation.refreshApp(); - } - } - - public async goToUptimeOverviewAndLoadData( - dateStart: string, - dateEnd: string, - monitorIdToCheck?: string - ) { - await this.navigation.goToUptime(); - await this.setDateRange(dateStart, dateEnd); - if (monitorIdToCheck) { - await this.commonService.monitorIdExists(monitorIdToCheck); - } - await this.header.waitUntilLoadingHasFinished(); - } - - public async loadDataAndGoToMonitorPage(dateStart: string, dateEnd: string, monitorId: string) { - await this.header.waitUntilLoadingHasFinished(); - await this.setDateRange(dateStart, dateEnd); - await this.navigation.goToMonitor(monitorId); - } - - public async inputFilterQuery(filterQuery: string) { - await this.commonService.setFilterText(filterQuery); - } - - public async pageHasDataMissing() { - return await this.commonService.pageHasDataMissing(); - } - - public async pageHasExpectedIds(monitorIdsToCheck: string[]): Promise { - return this.retry.tryForTime(15000, async () => { - await Promise.all( - monitorIdsToCheck.map((id) => this.commonService.monitorPageLinkExists(id)) - ); - }); - } - - public async pageUrlContains(value: string, expected: boolean = true): Promise { - return this.retry.tryForTime(12000, async () => { - expect(await this.commonService.urlContains(value)).to.eql(expected); - }); - } - - public async changePage(direction: 'next' | 'prev') { - if (direction === 'next') { - await this.commonService.goToNextPage(); - } else if (direction === 'prev') { - await this.commonService.goToPreviousPage(); - } - } - - public async setStatusFilter(value: 'up' | 'down') { - if (value === 'up') { - await this.commonService.setStatusFilterUp(); - } else if (value === 'down') { - await this.commonService.setStatusFilterDown(); - } - } - - public async selectFilterItems(filters: Record) { - for (const key in filters) { - if (Object.hasOwn(filters, key)) { - const values = filters[key]; - for (let i = 0; i < values.length; i++) { - await this.commonService.selectFilterItem(key, values[i]); - } - } - } - } - - public async getSnapshotCount() { - return await this.commonService.getSnapshotCount(); - } - - public async setAlertKueryBarText(filters: string) { - const { setKueryBarText } = this.commonService; - await setKueryBarText('xpack.synthetics.alerts.monitorStatus.filterBar', filters); - } - - public async setMonitorListPageSize(size: number): Promise { - await this.commonService.openPageSizeSelectPopover(); - return this.commonService.clickPageSizeSelectPopoverItem(size); - } - - public async checkPingListInteractions(timestamps: string[]): Promise { - return this.monitor.checkForPingListTimestamps(timestamps); - } - - public async resetFilters() { - await this.inputFilterQuery(''); - await this.commonService.resetStatusFilter(); - } -} diff --git a/x-pack/test/functional/services/index.ts b/x-pack/test/functional/services/index.ts index 9c8ae08300544..0e8af51734031 100644 --- a/x-pack/test/functional/services/index.ts +++ b/x-pack/test/functional/services/index.ts @@ -58,11 +58,6 @@ import { } from '@kbn/test-suites-xpack-platform/functional/services/monitoring'; import { services as kibanaXPackApiIntegrationServices } from '../../api_integration/services'; import { services as commonServices } from '../../common/services'; - -// @ts-ignore not ts yet -import { UptimeProvider } from './uptime'; -import { InfraSourceConfigurationFormProvider } from './infra_source_configuration_form'; -import { ObservabilityProvider } from './observability'; // define the name and providers for services that should be // available to your tests. If you don't specify anything here // only the built-in services will be available @@ -109,14 +104,11 @@ export const services = { canvasElement: CanvasElementProvider, grokDebugger: GrokDebuggerProvider, userMenu: UserMenuProvider, - uptime: UptimeProvider, - infraSourceConfigurationForm: InfraSourceConfigurationFormProvider, ml: MachineLearningProvider, transform: TransformProvider, reporting: ReportingFunctionalProvider, sampleData: SampleDataServiceProvider, searchSessions: SearchSessionsService, - observability: ObservabilityProvider, actions: ActionsServiceProvider, rules: RulesServiceProvider, cases: CasesServiceProvider, diff --git a/x-pack/test/functional/services/infra_source_configuration_form.ts b/x-pack/test/functional/services/infra_source_configuration_form.ts deleted file mode 100644 index 9589debf5d289..0000000000000 --- a/x-pack/test/functional/services/infra_source_configuration_form.ts +++ /dev/null @@ -1,72 +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 { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; -import { FtrProviderContext } from '../ftr_provider_context'; - -export function InfraSourceConfigurationFormProvider({ - getService, - getPageObject, -}: FtrProviderContext) { - const retry = getService('retry'); - const testSubjects = getService('testSubjects'); - - return { - /** - * Indices and fields - */ - async getNameInput(): Promise { - return await testSubjects.findDescendant('~nameInput', await this.getForm()); - }, - async getMetricIndicesInput(): Promise { - return await testSubjects.findDescendant('~metricIndicesInput', await this.getForm()); - }, - async selectIndicesPanel(): Promise { - return await testSubjects.click('logIndicesCheckableCard'); - }, - - /** - * Infra Metrics bottom actions bar - */ - async getSaveButton(): Promise { - return await testSubjects.find('infraBottomBarActionsButton'); - }, - - async saveInfraSettings() { - await (await this.getSaveButton()).click(); - - await retry.try(async () => { - const element = await this.getSaveButton(); - return !(await element.isDisplayed()); - }); - }, - - async discardInfraSettingsChanges() { - await (await testSubjects.find('infraBottomBarActionsDiscardChangesButton')).click(); - }, - - /** - * Form - */ - async getForm(): Promise { - return await testSubjects.find('~sourceConfigurationContent'); - }, - async saveConfiguration() { - await ( - await testSubjects.findDescendant('~applySettingsButton', await this.getForm()) - ).click(); - - await retry.try(async () => { - const element = await testSubjects.findDescendant( - '~applySettingsButton', - await this.getForm() - ); - return !(await element.isEnabled()); - }); - }, - }; -} diff --git a/x-pack/test/functional/services/observability/alerts/add_to_case.ts b/x-pack/test/functional/services/observability/alerts/add_to_case.ts deleted file mode 100644 index 6197273243432..0000000000000 --- a/x-pack/test/functional/services/observability/alerts/add_to_case.ts +++ /dev/null @@ -1,76 +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 '../../../ftr_provider_context'; - -const ADD_TO_EXISTING_CASE_SELECTOR = 'add-to-existing-case-action'; -const ADD_TO_NEW_CASE_SELECTOR = 'add-to-new-case-action'; -const CREATE_CASE_FLYOUT = 'create-case-flyout'; -const SELECT_CASE_MODAL = 'all-cases-modal'; - -export function ObservabilityAlertsAddToCaseProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - const getAddToExistingCaseSelector = async () => { - return await testSubjects.find(ADD_TO_EXISTING_CASE_SELECTOR); - }; - - const getAddToExistingCaseSelectorOrFail = async () => { - return await testSubjects.existOrFail(ADD_TO_EXISTING_CASE_SELECTOR); - }; - - const missingAddToExistingCaseSelectorOrFail = async () => { - return await testSubjects.missingOrFail(ADD_TO_EXISTING_CASE_SELECTOR); - }; - - const getAddToNewCaseSelector = async () => { - return await testSubjects.find(ADD_TO_NEW_CASE_SELECTOR); - }; - - const getAddToNewCaseSelectorOrFail = async () => { - return await testSubjects.existOrFail(ADD_TO_NEW_CASE_SELECTOR); - }; - - const missingAddToNewCaseSelectorOrFail = async () => { - return await testSubjects.missingOrFail(ADD_TO_NEW_CASE_SELECTOR); - }; - - const addToNewCaseButtonClick = async () => { - return await (await getAddToNewCaseSelector()).click(); - }; - - const addToExistingCaseButtonClick = async () => { - return await (await getAddToExistingCaseSelector()).click(); - }; - - const getCreateCaseFlyoutOrFail = async () => { - return await testSubjects.existOrFail(CREATE_CASE_FLYOUT); - }; - - const closeFlyout = async () => { - await testSubjects.click('euiFlyoutCloseButton'); // click close button - await testSubjects.missingOrFail('euiFlyoutCloseButton'); // wait for flyout to be closed - }; - - const getAddToExistingCaseModalOrFail = async () => { - return await testSubjects.existOrFail(SELECT_CASE_MODAL); - }; - - return { - getAddToExistingCaseSelector, - getAddToExistingCaseSelectorOrFail, - missingAddToExistingCaseSelectorOrFail, - getAddToNewCaseSelector, - getAddToNewCaseSelectorOrFail, - missingAddToNewCaseSelectorOrFail, - getCreateCaseFlyoutOrFail, - closeFlyout, - addToNewCaseButtonClick, - addToExistingCaseButtonClick, - getAddToExistingCaseModalOrFail, - }; -} diff --git a/x-pack/test/functional/services/observability/alerts/index.ts b/x-pack/test/functional/services/observability/alerts/index.ts deleted file mode 100644 index a617fdab808a6..0000000000000 --- a/x-pack/test/functional/services/observability/alerts/index.ts +++ /dev/null @@ -1,27 +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 { ObservabilityAlertsPaginationProvider } from './pagination'; -import { ObservabilityAlertsCommonProvider } from './common'; -import { ObservabilityAlertsAddToCaseProvider } from './add_to_case'; -import { ObservabilityAlertsRulesProvider } from './rules_page'; - -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export function ObservabilityAlertsProvider(context: FtrProviderContext) { - const common = ObservabilityAlertsCommonProvider(context); - const pagination = ObservabilityAlertsPaginationProvider(context); - const addToCase = ObservabilityAlertsAddToCaseProvider(context); - const rulesPage = ObservabilityAlertsRulesProvider(context); - - return { - common, - pagination, - addToCase, - rulesPage, - }; -} diff --git a/x-pack/test/functional/services/observability/alerts/pagination.ts b/x-pack/test/functional/services/observability/alerts/pagination.ts deleted file mode 100644 index 91959e95d75af..0000000000000 --- a/x-pack/test/functional/services/observability/alerts/pagination.ts +++ /dev/null @@ -1,115 +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 '../../../ftr_provider_context'; - -const ROWS_PER_PAGE_SELECTOR = 'tablePaginationPopoverButton'; -const PREV_BUTTON_SELECTOR = 'pagination-button-previous'; -const NEXT_BUTTON_SELECTOR = 'pagination-button-next'; -const TEN_ROWS_SELECTOR = 'tablePagination-10-rows'; -const TWENTY_ROWS_SELECTOR = 'tablePagination-20-rows'; -const FIFTY_ROWS_SELECTOR = 'tablePagination-50-rows'; -const BUTTON_ONE_SELECTOR = 'pagination-button-0'; -const BUTTON_TWO_SELECTOR = 'pagination-button-1'; - -export function ObservabilityAlertsPaginationProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - const getPageSizeSelector = async () => { - return await testSubjects.find(ROWS_PER_PAGE_SELECTOR); - }; - - const getPageSizeSelectorOrFail = async () => { - return await testSubjects.existOrFail(ROWS_PER_PAGE_SELECTOR); - }; - - const missingPageSizeSelectorOrFail = async () => { - return await testSubjects.missingOrFail(ROWS_PER_PAGE_SELECTOR); - }; - - const getTenRowsPageSelector = async () => { - return await testSubjects.find(TEN_ROWS_SELECTOR); - }; - - const getTwentyRowsPageSelector = async () => { - return await testSubjects.find(TWENTY_ROWS_SELECTOR); - }; - - const getFiftyRowsPageSelector = async () => { - return await testSubjects.find(FIFTY_ROWS_SELECTOR); - }; - - const getPrevPageButton = async () => { - return await testSubjects.find(PREV_BUTTON_SELECTOR); - }; - - const getPrevPageButtonOrFail = async () => { - return await testSubjects.existOrFail(PREV_BUTTON_SELECTOR); - }; - - const missingPrevPageButtonOrFail = async () => { - return await testSubjects.missingOrFail(PREV_BUTTON_SELECTOR); - }; - - const getNextPageButton = async () => { - return await testSubjects.find(NEXT_BUTTON_SELECTOR); - }; - - const getNextPageButtonOrFail = async () => { - return await testSubjects.existOrFail(NEXT_BUTTON_SELECTOR); - }; - - const getPaginationButtonOne = async () => { - return await testSubjects.find(BUTTON_ONE_SELECTOR); - }; - - const getPaginationButtonTwo = async () => { - return await testSubjects.find(BUTTON_TWO_SELECTOR); - }; - - const goToNextPage = async () => { - return await (await getNextPageButton()).click(); - }; - - const goToPrevPage = async () => { - return await (await getPrevPageButton()).click(); - }; - - const goToFirstPage = async () => { - await (await getPaginationButtonOne()).click(); - }; - - const goToNthPage = async (page: number) => { - const pageButton = await testSubjects.find(`pagination-button-${page - 1}`); - await pageButton.click(); - }; - - const getPrevButtonDisabledValue = async () => { - return await (await getPrevPageButton()).getAttribute('disabled'); - }; - - return { - getPageSizeSelector, - getPageSizeSelectorOrFail, - missingPageSizeSelectorOrFail, - getTenRowsPageSelector, - getTwentyRowsPageSelector, - getFiftyRowsPageSelector, - getPrevPageButton, - getPrevPageButtonOrFail, - missingPrevPageButtonOrFail, - getNextPageButton, - getNextPageButtonOrFail, - getPaginationButtonOne, - getPaginationButtonTwo, - goToNextPage, - goToPrevPage, - goToFirstPage, - getPrevButtonDisabledValue, - goToNthPage, - }; -} diff --git a/x-pack/test/functional/services/observability/alerts/rules_page.ts b/x-pack/test/functional/services/observability/alerts/rules_page.ts deleted file mode 100644 index 588e64fca0bfb..0000000000000 --- a/x-pack/test/functional/services/observability/alerts/rules_page.ts +++ /dev/null @@ -1,75 +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 '../../../ftr_provider_context'; - -const METRIC_THRESHOLD_RULE_TYPE_SELECTOR = 'metrics.alert.threshold-SelectOption'; -const CUSTOM_THRESHOLD_RULE_TYPE_SELECTOR = 'observability.rules.custom_threshold-SelectOption'; - -export function ObservabilityAlertsRulesProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const find = getService('find'); - const log = getService('log'); - - const getManageRulesPageHref = async () => { - const manageRulesPageButton = await testSubjects.find('manageRulesPageButton'); - return manageRulesPageButton.getAttribute('href'); - }; - - const clickCreateRuleButton = async () => { - await testSubjects.existOrFail('createRuleButton'); - const createRuleButton = await testSubjects.find('createRuleButton'); - log.debug(`clicking on ${await createRuleButton.getAttribute('innerText')}`); - return await createRuleButton.click(); - }; - - const clickRuleStatusDropDownMenu = async () => testSubjects.click('statusDropdown'); - - const clickDisableFromDropDownMenu = async () => testSubjects.click('statusDropdownDisabledItem'); - - const clickLogsTab = async () => testSubjects.click('ruleLogsTab'); - - const clickOnRuleInEventLogs = async () => { - await find.clickByButtonText('metric-threshold'); - }; - - const clickOnInfrastructureCategory = async () => { - await testSubjects.existOrFail('ruleTypeModal'); - const categories = await testSubjects.find('ruleTypeModal'); - const category = await categories.findByCssSelector(`.euiFacetButton[title="Infrastructure"]`); - await category.click(); - }; - - const clickOnMetricThresholdRule = async () => { - await testSubjects.existOrFail(METRIC_THRESHOLD_RULE_TYPE_SELECTOR); - await testSubjects.click(METRIC_THRESHOLD_RULE_TYPE_SELECTOR); - }; - - const clickOnObservabilityCategory = async () => { - await testSubjects.existOrFail('ruleTypeModal'); - const categories = await testSubjects.find('ruleTypeModal'); - const category = await categories.findByCssSelector(`.euiFacetButton[title="Observability"]`); - await category.click(); - }; - - const clickOnCustomThresholdRule = async () => { - await testSubjects.existOrFail(CUSTOM_THRESHOLD_RULE_TYPE_SELECTOR); - await testSubjects.click(CUSTOM_THRESHOLD_RULE_TYPE_SELECTOR); - }; - - return { - getManageRulesPageHref, - clickCreateRuleButton, - clickRuleStatusDropDownMenu, - clickDisableFromDropDownMenu, - clickLogsTab, - clickOnRuleInEventLogs, - clickOnInfrastructureCategory, - clickOnMetricThresholdRule, - clickOnObservabilityCategory, - clickOnCustomThresholdRule, - }; -} diff --git a/x-pack/test/functional/services/observability/components/alert_search_bar.ts b/x-pack/test/functional/services/observability/components/alert_search_bar.ts deleted file mode 100644 index 12781afb67b4f..0000000000000 --- a/x-pack/test/functional/services/observability/components/alert_search_bar.ts +++ /dev/null @@ -1,38 +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 dateMath from '@kbn/datemath'; -import { FtrProviderContext } from '../../../ftr_provider_context'; - -const FROM_SELECTOR = 'superDatePickerstartDatePopoverButton'; -const TO_SELECTOR = 'superDatePickerendDatePopoverButton'; - -export function ObservabilityAlertSearchBarProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - const getAbsoluteTimeRange = async () => { - // Since FTR uses UTC, with this format, we remove local browser timezone - const format = 'YYYY-MM-DDTHH:mm:ss.SSS'; - - const fromMoment = dateMath.parse( - await (await testSubjects.find(FROM_SELECTOR)).getVisibleText() - ); - const from = fromMoment!.format(format); - - const toMoment = dateMath.parse(await (await testSubjects.find(TO_SELECTOR)).getVisibleText()); - const to = toMoment!.format(format); - - return { - from, - to, - }; - }; - - return { - getAbsoluteTimeRange, - }; -} diff --git a/x-pack/test/functional/services/observability/components/alert_summary_widget.ts b/x-pack/test/functional/services/observability/components/alert_summary_widget.ts deleted file mode 100644 index f689f973d57aa..0000000000000 --- a/x-pack/test/functional/services/observability/components/alert_summary_widget.ts +++ /dev/null @@ -1,63 +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 '../../../ftr_provider_context'; - -const COMPACT_COMPONENT_SELECTOR = 'alertSummaryWidgetCompact'; -const COMPACT_TIME_RANGE_TITLE_SELECTOR = 'timeRangeTitle'; - -const FULL_SIZE_COMPONENT_SELECTOR = 'alertSummaryWidgetFullSize'; - -const ACTIVE_ALERT_SELECTOR = 'activeAlertCount'; -const TOTAL_ALERT_SELECTOR = 'totalAlertCount'; - -export function ObservabilityAlertSummaryWidgetProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - const getCompactComponentSelectorOrFail = async () => { - return await testSubjects.existOrFail(COMPACT_COMPONENT_SELECTOR); - }; - - const getFullSizeComponentSelectorOrFail = async () => { - return await testSubjects.existOrFail(FULL_SIZE_COMPONENT_SELECTOR); - }; - - const getCompactTimeRangeTitle = async () => { - return (await testSubjects.find(COMPACT_TIME_RANGE_TITLE_SELECTOR)).getVisibleText(); - }; - - const getCompactWidgetSelector = async () => { - return await testSubjects.find(COMPACT_COMPONENT_SELECTOR); - }; - - const getActiveAlertSelector = async () => { - return await testSubjects.find(ACTIVE_ALERT_SELECTOR); - }; - - const getTotalAlertSelector = async () => { - return await testSubjects.find(TOTAL_ALERT_SELECTOR); - }; - - const getActiveAlertCount = async () => { - return (await getActiveAlertSelector()).getVisibleText(); - }; - - const getTotalAlertCount = async () => { - return (await getTotalAlertSelector()).getVisibleText(); - }; - - return { - getCompactComponentSelectorOrFail, - getCompactWidgetSelector, - getCompactTimeRangeTitle, - getFullSizeComponentSelectorOrFail, - getTotalAlertSelector, - getActiveAlertSelector, - getTotalAlertCount, - getActiveAlertCount, - }; -} diff --git a/x-pack/test/functional/services/observability/components/index.ts b/x-pack/test/functional/services/observability/components/index.ts deleted file mode 100644 index 0a11968a0cb56..0000000000000 --- a/x-pack/test/functional/services/observability/components/index.ts +++ /dev/null @@ -1,21 +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 { ObservabilityAlertSearchBarProvider } from './alert_search_bar'; -import { ObservabilityAlertSummaryWidgetProvider } from './alert_summary_widget'; - -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export function ObservabilityComponentsProvider(context: FtrProviderContext) { - const alertSearchBar = ObservabilityAlertSearchBarProvider(context); - const alertSummaryWidget = ObservabilityAlertSummaryWidgetProvider(context); - - return { - alertSearchBar, - alertSummaryWidget, - }; -} diff --git a/x-pack/test/functional/services/observability/index.ts b/x-pack/test/functional/services/observability/index.ts deleted file mode 100644 index db262cef8bf63..0000000000000 --- a/x-pack/test/functional/services/observability/index.ts +++ /dev/null @@ -1,26 +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 '../../ftr_provider_context'; -import { ObservabilityUsersProvider } from './users'; -import { ObservabilityAlertsProvider } from './alerts'; -import { ObservabilityOverviewProvider } from './overview'; -import { ObservabilityComponentsProvider } from './components'; - -export function ObservabilityProvider(context: FtrProviderContext) { - const alerts = ObservabilityAlertsProvider(context); - const components = ObservabilityComponentsProvider(context); - const users = ObservabilityUsersProvider(context); - const overview = ObservabilityOverviewProvider(context); - - return { - alerts, - components, - users, - overview, - }; -} diff --git a/x-pack/test/functional/services/observability/overview/index.ts b/x-pack/test/functional/services/observability/overview/index.ts deleted file mode 100644 index 5c34d4afce99e..0000000000000 --- a/x-pack/test/functional/services/observability/overview/index.ts +++ /dev/null @@ -1,18 +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 { ObservabilityOverviewCommonProvider } from './common'; - -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export function ObservabilityOverviewProvider(context: FtrProviderContext) { - const common = ObservabilityOverviewCommonProvider(context); - - return { - common, - }; -} diff --git a/x-pack/test/functional/services/observability/users.ts b/x-pack/test/functional/services/observability/users.ts deleted file mode 100644 index 68de5f2ad03fb..0000000000000 --- a/x-pack/test/functional/services/observability/users.ts +++ /dev/null @@ -1,107 +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 { Role } from '@kbn/security-plugin/common'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -type CreateRolePayload = Pick; - -const OBSERVABILITY_TEST_ROLE_NAME = 'observability-functional-test-role'; -const HOME_PAGE_SELECTOR = 'homeApp'; - -export function ObservabilityUsersProvider({ getPageObject, getService }: FtrProviderContext) { - const security = getService('security'); - const testSubjects = getService('testSubjects'); - const commonPageObject = getPageObject('common'); - - /** - * Creates a test role and set it as the test user's role. Performs a page - * reload to apply the role change, but doesn't require a re-login. - * - * @arg roleDefinition - the privileges of the test role - */ - const setTestUserRole = async (roleDefinition: CreateRolePayload) => { - // return to neutral grounds to avoid running into permission problems on reload - await commonPageObject.navigateToActualUrl('home'); - await testSubjects.existOrFail(HOME_PAGE_SELECTOR); - - await security.role.create(OBSERVABILITY_TEST_ROLE_NAME, roleDefinition); - - await security.testUser.setRoles([OBSERVABILITY_TEST_ROLE_NAME]); // performs a page reload - }; - - /** - * Deletes the test role and restores thedefault test user role. Performs a - * page reload to apply the role change, but doesn't require a re-login. - */ - const restoreDefaultTestUserRole = async () => { - await Promise.all([ - security.role.delete(OBSERVABILITY_TEST_ROLE_NAME), - security.testUser.restoreDefaults(), - ]); - }; - - return { - defineBasicObservabilityRole, - restoreDefaultTestUserRole, - setTestUserRole, - }; -} - -/** - * Generates a combination of Elasticsearch and Kibana privileges for given - * observability features. - */ -const defineBasicObservabilityRole = ( - features: Partial<{ - observabilityCasesV3: string[]; - apm: string[]; - logs: string[]; - infrastructure: string[]; - uptime: string[]; - }> -): CreateRolePayload => { - return { - elasticsearch: { - cluster: ['all'], - indices: [ - ...((features.logs?.length ?? 0) > 0 - ? [{ names: ['filebeat-*', 'logs-*'], privileges: ['all'] }] - : []), - ...((features.infrastructure?.length ?? 0) > 0 - ? [{ names: ['metricbeat-*', 'metrics-*'], privileges: ['all'] }] - : []), - ...((features.apm?.length ?? 0) > 0 - ? [ - { - names: [ - 'apm-*', - 'logs-apm*', - 'metrics-apm*', - 'traces-apm*', - 'observability-annotations', - ], - privileges: ['read', 'view_index_metadata'], - }, - ] - : []), - ...((features.uptime?.length ?? 0) > 0 - ? [{ names: ['heartbeat-*,synthetics-*'], privileges: ['all'] }] - : []), - ], - run_as: [], - }, - kibana: [ - { - spaces: ['*'], - base: [], - // undefined props yet - feature: features, - }, - ], - }; -}; diff --git a/x-pack/test/functional/services/uptime/alerts.ts b/x-pack/test/functional/services/uptime/alerts.ts deleted file mode 100644 index 35fed9796d250..0000000000000 --- a/x-pack/test/functional/services/uptime/alerts.ts +++ /dev/null @@ -1,123 +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 '../../ftr_provider_context'; - -export function UptimeAlertsProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const browser = getService('browser'); - - return { - async openFlyout(alertType: 'monitorStatus' | 'tls') { - await testSubjects.click('xpack.synthetics.alertsPopover.toggleButton'); - await testSubjects.click('xpack.synthetics.openAlertContextPanel'); - if (alertType === 'monitorStatus') { - await testSubjects.click('xpack.synthetics.toggleAlertFlyout'); - } else if (alertType === 'tls') { - await testSubjects.click('xpack.synthetics.toggleTlsAlertFlyout'); - } - // ensure the flyout has opened - await testSubjects.exists('ruleFlyoutTitle'); - }, - async openMonitorStatusAlertType(alertType: string) { - await testSubjects.click(`xpack.synthetics.alerts.${alertType}-SelectOption`); - }, - async setAlertTags(tags: string[]) { - await testSubjects.click('ruleFormStep-details'); - for (let i = 0; i < tags.length; i += 1) { - await testSubjects.click('comboBoxSearchInput'); - await testSubjects.setValue('comboBoxInput', tags[i]); - await browser.pressKeys(browser.keys.ENTER); - } - }, - async setAlertName(name: string) { - await testSubjects.click('ruleFormStep-details'); - await testSubjects.setValue('ruleDetailsNameInput', name); - }, - async setAlertInterval(value: string) { - await testSubjects.click('ruleFormStep-definition'); - await testSubjects.setValue('ruleScheduleNumberInput', value); - }, - async setAlertThrottleInterval(value: string) { - await testSubjects.click('notifyWhenSelect'); - await testSubjects.click('onThrottleInterval'); - await testSubjects.setValue('throttleInput', value); - }, - async setAlertExpressionValue( - expressionAttribute: string, - fieldAttribute: string, - value: string - ) { - await testSubjects.click(expressionAttribute); - await testSubjects.setValue(fieldAttribute, value); - await testSubjects.click(expressionAttribute); - }, - async setAlertStatusNumTimes(value: string) { - await this.setAlertExpressionValue( - 'xpack.synthetics.alerts.monitorStatus.numTimesExpression', - 'xpack.synthetics.alerts.monitorStatus.numTimesField', - value - ); - }, - async setAlertTimerangeSelection(value: string) { - await this.setAlertExpressionValue( - 'xpack.synthetics.alerts.monitorStatus.timerangeValueExpression', - 'xpack.synthetics.alerts.monitorStatus.timerangeValueField', - value - ); - }, - async setAlertExpressionSelectable( - expressionAttribute: string, - selectableAttribute: string, - optionAttributes: string[] - ) { - await testSubjects.click(expressionAttribute); - await testSubjects.click(selectableAttribute); - for (let i = 0; i < optionAttributes.length; i += 1) { - await testSubjects.click(optionAttributes[i]); - } - await testSubjects.click(expressionAttribute); - }, - async setMonitorStatusSelectableToHours() { - await this.setAlertExpressionSelectable( - 'xpack.synthetics.alerts.monitorStatus.timerangeUnitExpression', - 'xpack.synthetics.alerts.monitorStatus.timerangeUnitSelectable', - ['xpack.synthetics.alerts.monitorStatus.timerangeUnitSelectable.hoursOption'] - ); - }, - async clickAddFilter() { - await testSubjects.click('uptimeCreateAlertAddFilter'); - }, - async clickAddFilterLocation() { - await this.clickAddFilter(); - await testSubjects.click('uptimeAlertAddFilter.observer.geo.name'); - await testSubjects.click('uptimeCreateStatusAlert.filter_location'); - }, - async clickAddFilterPort() { - await this.clickAddFilter(); - await testSubjects.click('uptimeAlertAddFilter.url.port'); - await testSubjects.click('uptimeCreateStatusAlert.filter_port'); - }, - async clickAddFilterType() { - await this.clickAddFilter(); - await testSubjects.click('uptimeAlertAddFilter.monitor.type'); - await testSubjects.click('uptimeCreateStatusAlert.filter_scheme'); - }, - async clickSaveRuleButton(name: string) { - /* The most common cause of flakiness in this test is the absence of value for the name field, - * While this field is set in previous step, it is possible that component rerendering could be - * clearing out the value after it's filled in. To prevent this particular issue with flakiness, - * we should attempt to set the name again before saving the alert */ - await testSubjects.click('ruleFormStep-details'); - await testSubjects.setValue('ruleDetailsNameInput', name); - await testSubjects.click('ruleFlyoutFooterSaveButton'); - }, - async clickSaveAlertsConfirmButton() { - await testSubjects.click('confirmModalConfirmButton', 20000); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/certificates.ts b/x-pack/test/functional/services/uptime/certificates.ts deleted file mode 100644 index 830423109509b..0000000000000 --- a/x-pack/test/functional/services/uptime/certificates.ts +++ /dev/null @@ -1,70 +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 expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export function UptimeCertProvider({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - const find = getService('find'); - - const PageObjects = getPageObjects(['common', 'timePicker', 'header']); - - const changeSearchField = async (text: string) => { - const input = await testSubjects.find('uptimeCertSearch'); - await input.clearValueWithKeyboard(); - await input.type(text); - }; - - const refreshApp = async () => { - await testSubjects.click('superDatePickerApplyTimeButton', 10000); - }; - - return { - async hasViewCertButton() { - return retry.tryForTime(15000, async () => { - await find.existsByCssSelector('[href="/app/uptime/certificates"]'); - }); - }, - async certificateExists(cert: { certId: string; monitorId: string }) { - return retry.tryForTime(60 * 1000, async () => { - if (!(await testSubjects.exists(cert.certId))) { - await refreshApp(); - } - await testSubjects.existOrFail(cert.certId); - await testSubjects.existOrFail('monitor-page-link-' + cert.monitorId); - }); - }, - async hasCertificates(expectedTotal?: number) { - return retry.tryForTime(60 * 1000, async () => { - const totalCerts = await testSubjects.getVisibleText('uptimeCertTotal'); - if (expectedTotal) { - expect(Number(totalCerts)).to.eql(expectedTotal); - } else { - if (Number(totalCerts) < 1) { - await refreshApp(); - } - expect(Number(totalCerts) > 0).to.eql(true); - } - }); - }, - async searchIsWorking(monId: string) { - const self = this; - return retry.tryForTime(60 * 1000, async () => { - await changeSearchField(monId); - await PageObjects.header.waitUntilLoadingHasFinished(); - await self.hasCertificates(1); - }); - }, - async displaysEmptyMessage() { - await testSubjects.existOrFail('uptimeCertsEmptyMessage'); - const emptyText = await testSubjects.getVisibleText('uptimeCertsEmptyMessage'); - expect(emptyText).to.eql('No Certificates found.'); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/common.ts b/x-pack/test/functional/services/uptime/common.ts deleted file mode 100644 index d78aea22f8167..0000000000000 --- a/x-pack/test/functional/services/uptime/common.ts +++ /dev/null @@ -1,122 +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 '../../ftr_provider_context'; - -export function UptimeCommonProvider({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const browser = getService('browser'); - const retry = getService('retry'); - const find = getService('find'); - - const { header } = getPageObjects(['header']); - - return { - async assertExists(key: string) { - if (!(await testSubjects.exists(key))) { - throw new Error(`Couldn't find expected element with key "${key}".`); - } - }, - async monitorIdExists(key: string) { - await retry.tryForTime(10000, async () => { - await testSubjects.existOrFail(key); - }); - }, - async monitorPageLinkExists(monitorId: string) { - await testSubjects.existOrFail(`monitor-page-link-${monitorId}`); - }, - async urlContains(expected: string) { - const url = await browser.getCurrentUrl(); - return url.indexOf(expected) >= 0; - }, - async pageHasDataMissing() { - return await testSubjects.find('data-missing', 5000); - }, - async setKueryBarText(attribute: string, value: string) { - await testSubjects.click(attribute); - await testSubjects.setValue(attribute, value); - await browser.pressKeys(browser.keys.ENTER); - }, - async setFilterText(filterQuery: string) { - await this.setKueryBarText('queryInput', filterQuery); - }, - async goToNextPage() { - await testSubjects.click('xpack.uptime.monitorList.nextButton', 5000); - }, - async goToPreviousPage() { - await testSubjects.click('xpack.synthetics.monitorList.prevButton', 5000); - }, - async setStatusFilterUp() { - await testSubjects.click('xpack.synthetics.filterBar.filterStatusUp'); - }, - async setStatusFilterDown() { - await testSubjects.click('xpack.synthetics.filterBar.filterStatusDown'); - }, - async resetStatusFilter() { - const upFilter = await find.byCssSelector( - '[data-test-subj="xpack.synthetics.filterBar.filterStatusUp"]' - ); - if (await upFilter.elementHasClass('euiFilterButton-hasActiveFilters')) { - await this.setStatusFilterUp(); - } - const downFilter = await find.byCssSelector( - '[data-test-subj="xpack.synthetics.filterBar.filterStatusDown"]' - ); - if (await downFilter.elementHasClass('euiFilterButton-hasActiveFilters')) { - await this.setStatusFilterDown(); - } - }, - async selectFilterItem(filterType: string, itemArg: string | string[]) { - const itemList = Array.isArray(itemArg) ? itemArg : [itemArg]; - const filterPopoverButton = await find.byCssSelector( - `[aria-label="expands filter group for ${filterType} filter"]` - ); - await filterPopoverButton.click(); - await this.clickFilterItems(itemList); - return this.applyFilterItems(filterType); - }, - async clickFilterItems(itemList: string[]) { - for (const title of itemList) { - await find.clickByCssSelector(`li[title="${title}"]`); - } - }, - async applyFilterItems(filterType: string) { - const applyButton = await find.byCssSelector( - `[aria-label="Apply the selected filters for ${filterType}"]` - ); - await applyButton.click(); - }, - async getSnapshotCount() { - return { - up: await testSubjects.getVisibleText('xpack.synthetics.snapshot.donutChart.up'), - down: await testSubjects.getVisibleText('xpack.synthetics.snapshot.donutChart.down'), - }; - }, - async openPageSizeSelectPopover(): Promise { - return testSubjects.click('xpack.uptime.monitorList.pageSizeSelect.popoverOpen', 5000); - }, - async clickPageSizeSelectPopoverItem(size: number = 10): Promise { - return testSubjects.click( - `xpack.uptime.monitorList.pageSizeSelect.sizeSelectItem${size.toString()}`, - 5000 - ); - }, - async waitUntilDataIsLoaded() { - await header.waitUntilLoadingHasFinished(); - return retry.tryForTime(60 * 1000, async () => { - if (await testSubjects.exists('data-missing')) { - await browser.refresh(); - await header.waitUntilLoadingHasFinished(); - } - await testSubjects.missingOrFail('data-missing'); - }); - }, - async hasMappingsError() { - return testSubjects.exists('xpack.synthetics.mappingsErrorPage'); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/index.ts b/x-pack/test/functional/services/uptime/index.ts deleted file mode 100644 index 649408c03284d..0000000000000 --- a/x-pack/test/functional/services/uptime/index.ts +++ /dev/null @@ -1,8 +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. - */ - -export { UptimeProvider } from './uptime'; diff --git a/x-pack/test/functional/services/uptime/ml_anomaly.ts b/x-pack/test/functional/services/uptime/ml_anomaly.ts deleted file mode 100644 index 9825245591c9e..0000000000000 --- a/x-pack/test/functional/services/uptime/ml_anomaly.ts +++ /dev/null @@ -1,82 +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 '../../ftr_provider_context'; - -export function UptimeMLAnomalyProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - const log = getService('log'); - - return { - async openMLFlyout() { - return retry.tryForTime(15000, async () => { - await testSubjects.click('uptimeEnableAnomalyBtn'); - await testSubjects.existOrFail('uptimeMLFlyout'); - }); - }, - - async openMLManageMenu() { - await this.cancelAlertFlyout(); - return retry.tryForTime(30000, async () => { - await testSubjects.click('uptimeManageMLJobBtn'); - await testSubjects.existOrFail('uptimeManageMLContextMenu'); - }); - }, - - async cancelAlertFlyout() { - if (await testSubjects.exists('euiFlyoutCloseButton')) - await testSubjects.click('euiFlyoutCloseButton', 60 * 1000); - if (await testSubjects.exists('ruleFlyoutConfirmCancelConfirmButton')) - await testSubjects.click('ruleFlyoutConfirmCancelConfirmButton', 60 * 1000); - }, - - async alreadyHasJob() { - return await testSubjects.exists('uptimeManageMLJobBtn'); - }, - - async createMLJob() { - await testSubjects.click('uptimeMLCreateJobBtn'); - return retry.tryForTime(30000, async () => { - await testSubjects.existOrFail('uptimeMLJobSuccessfullyCreated'); - log.info('Job successfully created'); - }); - }, - - async deleteMLJob() { - await testSubjects.click('uptimeDeleteMLJobBtn'); - return retry.tryForTime(10000, async () => { - await testSubjects.click('uptimeMLJobDeleteConfirmModel > confirmModalConfirmButton'); - await testSubjects.existOrFail('uptimeMLJobSuccessfullyDeleted'); - log.info('Job successfully deleted'); - }); - }, - - async canCreateJob() { - const createJobBtn = await testSubjects.find('uptimeMLCreateJobBtn'); - return !!(await createJobBtn.getAttribute('disabled')); - }, - - async hasNoLicenseInfo() { - return await testSubjects.missingOrFail('uptimeMLLicenseInfo', { timeout: 1000 }); - }, - - async openAlertFlyout() { - return await testSubjects.click('uptimeEnableAnomalyAlertBtn'); - }, - - async manageAnomalyAlertIsVisible() { - return await testSubjects.exists('uptimeManageAnomalyAlertBtn'); - }, - - async changeAlertThreshold(level: string) { - await testSubjects.click('uptimeAnomalySeverity'); - await testSubjects.click('anomalySeveritySelect'); - await testSubjects.click(`alertAnomaly${level}`); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/monitor.ts b/x-pack/test/functional/services/uptime/monitor.ts deleted file mode 100644 index 529cbf6eac2da..0000000000000 --- a/x-pack/test/functional/services/uptime/monitor.ts +++ /dev/null @@ -1,68 +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 expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export function UptimeMonitorProvider({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - - const PageObjects = getPageObjects(['header']); - - return { - async displayOverallAvailability(availabilityVal: string) { - return retry.tryForTime(60 * 1000, async () => { - await testSubjects.existOrFail('uptimeOverallAvailability'); - const availability = await testSubjects.getVisibleText('uptimeOverallAvailability'); - expect(availability).to.be(availabilityVal); - }); - }, - async setPingListLocation(location: string) { - await testSubjects.click('xpack.synthetics.pingList.locationSelect', 5000); - return testSubjects.click(`xpack.synthetics.pingList.locationOptions.${location}`, 5000); - }, - async setPingListStatus(status: string) { - await testSubjects.click('xpack.synthetics.pingList.statusSelect', 5000); - return testSubjects.click(`xpack.synthetics.pingList.statusOptions.${status}`, 5000); - }, - async checkForPingListTimestamps(timestamps: string[]): Promise { - return retry.tryForTime(10000, async () => { - await Promise.all( - timestamps.map( - async (timestamp) => - await testSubjects.existOrFail(`xpack.synthetics.pingList.ping-${timestamp}`) - ) - ); - }); - }, - async hasRedirectInfo() { - return retry.tryForTime(30000, async () => { - await testSubjects.existOrFail('uptimeMonitorRedirectInfo'); - }); - }, - async expandPingRow() { - return retry.tryForTime( - 60 * 3000, - async () => { - await testSubjects.existOrFail('uptimePingListExpandBtn', { timeout: 5000 }); - await testSubjects.click('uptimePingListExpandBtn'); - }, - async () => { - await testSubjects.click('superDatePickerApplyTimeButton'); - await PageObjects.header.waitUntilLoadingHasFinished(); - } - ); - }, - async hasRedirectInfoInPingList() { - await this.expandPingRow(); - return retry.tryForTime(60 * 1000, async () => { - await testSubjects.existOrFail('uptimeMonitorPingListRedirectInfo'); - }); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/navigation.ts b/x-pack/test/functional/services/uptime/navigation.ts deleted file mode 100644 index 8a3898e813c6a..0000000000000 --- a/x-pack/test/functional/services/uptime/navigation.ts +++ /dev/null @@ -1,97 +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 '../../ftr_provider_context'; - -export function UptimeNavigationProvider({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const browser = getService('browser'); - const testSubjects = getService('testSubjects'); - const find = getService('find'); - const PageObjects = getPageObjects(['common', 'timePicker', 'header']); - - const goToUptimeRoot = async () => { - // Check if are already on overview uptime page, we don't need to repeat the step - await retry.tryForTime(60 * 1000, async () => { - if (await testSubjects.exists('uptimeSettingsToOverviewLink', { timeout: 0 })) { - await testSubjects.click('uptimeSettingsToOverviewLink'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await testSubjects.existOrFail('uptimeOverviewPage', { timeout: 2000 }); - } else { - await PageObjects.common.navigateToApp('uptime'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await testSubjects.existOrFail('uptimeOverviewPage', { timeout: 2000 }); - } - }); - }; - - return { - async refreshApp() { - await browser.refresh(); - await PageObjects.common.sleep(1000); - await PageObjects.header.waitUntilLoadingHasFinished(); - }, - - async goToUptime() { - await goToUptimeRoot(); - }, - - goToSettings: async () => { - await goToUptimeRoot(); - await testSubjects.click('settings-page-link', 5000); - await testSubjects.existOrFail('uptimeSettingsPage', { timeout: 10000 }); - }, - - checkIfOnMonitorPage: async (monitorId: string) => { - const monitorPage = await testSubjects.exists('uptimeMonitorPage', { timeout: 1000 }); - if (monitorId && monitorPage) { - const thisMonitorPage = - (await testSubjects.getVisibleText('monitor-page-title')) === monitorId; - return monitorPage && thisMonitorPage; - } else { - return monitorPage; - } - }, - - goToMonitor: async (monitorId: string) => { - // only go to monitor page if not already there - if (!(await testSubjects.exists('uptimeMonitorPage', { timeout: 0 }))) { - return retry.try(async () => { - await testSubjects.click(`monitor-page-link-${monitorId}`); - }); - await testSubjects.existOrFail('uptimeMonitorPage', { - timeout: 30000, - }); - } - }, - - goToCertificates: async () => { - if (!(await testSubjects.exists('uptimeCertificatesPage', { timeout: 0 }))) { - return retry.try(async () => { - if (await find.existsByCssSelector('[href="/app/uptime/certificates"]', 0)) { - await find.clickByCssSelector('[href="/app/uptime/certificates"]'); - } - await testSubjects.existOrFail('uptimeCertificatesPage'); - }); - } - return true; - }, - - async loadDataAndGoToMonitorPage(dateStart: string, dateEnd: string, monitorId: string) { - await PageObjects.timePicker.setAbsoluteRange(dateStart, dateEnd); - await this.goToMonitor(monitorId); - }, - - async isOnDetailsPage() { - return await testSubjects.exists('uptimeMonitorPage', { timeout: 0 }); - }, - - async goToHomeViaBreadCrumb() { - await testSubjects.click('breadcrumb first'); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/overview.ts b/x-pack/test/functional/services/uptime/overview.ts deleted file mode 100644 index 34b2531b76561..0000000000000 --- a/x-pack/test/functional/services/uptime/overview.ts +++ /dev/null @@ -1,45 +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 '../../ftr_provider_context'; - -export function UptimeOverviewProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - - return { - async expandMonitorDetail(id: string): Promise { - return testSubjects.click(`xpack.synthetics.monitorList.${id}.expandMonitorDetail`); - }, - async openIntegrationsPopoverForMonitor(id: string, plugin = 'synthetics'): Promise { - return testSubjects.click(`xpack.${plugin}.monitorList.actionsPopover.${id}`); - }, - async openAlertsPopover(): Promise { - return testSubjects.click('xpack.synthetics.alertsPopover.toggleButton'); - }, - /** - * If the popover is already open, click the nested button. - * Otherwise, open the popover, then click the nested button. - */ - async navigateToNestedPopover(): Promise { - if (await testSubjects.exists('xpack.synthetics.openAlertContextPanel')) { - return testSubjects.click('xpack.synthetics.openAlertContextPanel'); - } - await testSubjects.click('xpack.synthetics.alertsPopover.toggleButton'); - return testSubjects.click('xpack.synthetics.openAlertContextPanel'); - }, - - async clickDefineSettings() { - return retry.tryForTime(60 * 1000, async () => { - if (await testSubjects.exists('errorToastMessage', { timeout: 0 })) { - await testSubjects.click('toastCloseButton'); - } - await testSubjects.click('uptimeSettingsLink'); - }); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/settings.ts b/x-pack/test/functional/services/uptime/settings.ts deleted file mode 100644 index 46d8041b4028d..0000000000000 --- a/x-pack/test/functional/services/uptime/settings.ts +++ /dev/null @@ -1,65 +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 { DynamicSettings } from '@kbn/uptime-plugin/common/runtime_types'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export function UptimeSettingsProvider({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - - const changeInputField = async (text: string, field: string) => { - const input = await testSubjects.find(field, 5000); - await input.clearValueWithKeyboard(); - await input.type(text); - }; - - return { - go: async () => { - await testSubjects.click('settings-page-link', 5000); - }, - - changeHeartbeatIndicesInput: async (text: string) => { - await changeInputField(text, 'heartbeat-indices-input-loaded'); - }, - changeErrorThresholdInput: async (text: string) => { - await changeInputField(text, 'expiration-threshold-input-loaded'); - }, - changeWarningThresholdInput: async (text: string) => { - await changeInputField(text, 'age-threshold-input-loaded'); - }, - loadFields: async (): Promise => { - const indInput = await testSubjects.find('heartbeat-indices-input-loaded', 5000); - const expirationInput = await testSubjects.find('expiration-threshold-input-loaded', 5000); - const ageInput = await testSubjects.find('age-threshold-input-loaded', 5000); - const heartbeatIndices = (await indInput.getAttribute('value')) ?? '0'; - const expiration = (await expirationInput.getAttribute('value')) ?? '0'; - const age = (await ageInput.getAttribute('value')) ?? '0'; - - return { - heartbeatIndices, - certAgeThreshold: parseInt(age, 10), - certExpirationThreshold: parseInt(expiration, 10), - defaultConnectors: [], - defaultEmail: { to: [], cc: [], bcc: [] }, - }; - }, - applyButtonIsDisabled: async () => { - return !!(await (await testSubjects.find('apply-settings-button')).getAttribute('disabled')); - }, - apply: async () => { - await (await testSubjects.find('apply-settings-button')).click(); - await retry.waitFor('submit to succeed', async () => { - // When the form submit is complete the form will no longer be disabled - const disabled = await ( - await testSubjects.find('heartbeat-indices-input-loaded', 5000) - ).getAttribute('disabled'); - return disabled === null; - }); - }, - }; -} diff --git a/x-pack/test/functional/services/uptime/uptime.ts b/x-pack/test/functional/services/uptime/uptime.ts deleted file mode 100644 index b345be012968d..0000000000000 --- a/x-pack/test/functional/services/uptime/uptime.ts +++ /dev/null @@ -1,39 +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 '../../ftr_provider_context'; - -import { UptimeSettingsProvider } from './settings'; -import { UptimeCommonProvider } from './common'; -import { UptimeMonitorProvider } from './monitor'; -import { UptimeNavigationProvider } from './navigation'; -import { UptimeAlertsProvider } from './alerts'; -import { UptimeMLAnomalyProvider } from './ml_anomaly'; -import { UptimeCertProvider } from './certificates'; -import { UptimeOverviewProvider } from './overview'; - -export function UptimeProvider(context: FtrProviderContext) { - const common = UptimeCommonProvider(context); - const settings = UptimeSettingsProvider(context); - const monitor = UptimeMonitorProvider(context); - const navigation = UptimeNavigationProvider(context); - const alerts = UptimeAlertsProvider(context); - const ml = UptimeMLAnomalyProvider(context); - const cert = UptimeCertProvider(context); - const overview = UptimeOverviewProvider(context); - - return { - common, - settings, - monitor, - navigation, - alerts, - ml, - cert, - overview, - }; -} diff --git a/x-pack/test/security_solution_endpoint/services/index.ts b/x-pack/test/security_solution_endpoint/services/index.ts index 666378e4492c5..20937271c2762 100644 --- a/x-pack/test/security_solution_endpoint/services/index.ts +++ b/x-pack/test/security_solution_endpoint/services/index.ts @@ -7,8 +7,8 @@ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { SvlCommonApiServiceProvider } from '@kbn/test-suites-serverless/shared/services/svl_common_api'; +import { IngestManagerProvider } from '@kbn/test-suites-xpack-platform/api_integration/services/ingest_manager'; import { services as xPackFunctionalServices } from '../../functional/services'; -import { IngestManagerProvider } from '../../common/services/ingest_manager'; import { EndpointTelemetryTestResourcesProvider } from './endpoint_telemetry'; import { EndpointTestResources } from './endpoint'; import { TimelineTestService } from '../../security_solution_ftr/services/timeline'; diff --git a/x-pack/test/security_solution_endpoint/tsconfig.json b/x-pack/test/security_solution_endpoint/tsconfig.json index 3cd4edc22d2cb..58da787d4b965 100644 --- a/x-pack/test/security_solution_endpoint/tsconfig.json +++ b/x-pack/test/security_solution_endpoint/tsconfig.json @@ -30,5 +30,6 @@ "@kbn/ftr-common-functional-services", "@kbn/spaces-plugin", "@kbn/scout-info", + "@kbn/test-suites-xpack-platform", ] } diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 75d9a7f8b8d07..a659ecbe65fec 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -25,14 +25,9 @@ ], "kbn_references": [ "@kbn/test-suites-src", - "@kbn/telemetry-collection-manager-plugin", "@kbn/alerting-plugin", - "@kbn/apm-plugin", "@kbn/fleet-plugin", - "@kbn/infra-plugin", "@kbn/ml-plugin", - "@kbn/observability-plugin", - "@kbn/security-plugin", "@kbn/security-solution-plugin", "@kbn/spaces-plugin", "@kbn/task-manager-plugin", @@ -49,12 +44,9 @@ "@kbn/test-subj-selector", "@kbn/rison", "@kbn/data-views-plugin", - "@kbn/datemath", "@kbn/es-archiver", "@kbn/es-query", - "@kbn/server-route-repository", "@kbn/core-http-common", - "@kbn/observability-ai-assistant-plugin", "@kbn/dataset-quality-plugin", "@kbn/ftr-common-functional-ui-services", "@kbn/search-types", @@ -66,8 +58,6 @@ "@kbn/osquery-plugin", "@kbn/scout-info", "@kbn/test-suites-xpack-platform", - "@kbn/response-ops-rule-params", "@kbn/ml-string-hash", - "@kbn/uptime-plugin", ] } diff --git a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts b/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts index e4541a77d95e3..c9349c7b63899 100644 --- a/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts +++ b/x-pack/test_serverless/api_integration/test_suites/common/telemetry/snapshot_telemetry.ts @@ -21,7 +21,7 @@ import xpackSecurityTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin import xpackChatTelemetrySchema from '@kbn/telemetry-collection-xpack-plugin/schema/xpack_chat.json'; import { assertTelemetryPayload } from '@kbn/telemetry-tools'; import type { TelemetrySchemaObject } from '@kbn/telemetry-tools/src/schema_ftr_validations/schema_to_config_schema'; -import type { UsageStatsPayloadTestFriendly } from '@kbn/test-suites-xpack/api_integration/services/usage_api'; +import type { UsageStatsPayloadTestFriendly } from '../../../../shared/services/usage_api'; import type { RoleCredentials } from '../../../../shared/services'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test_serverless/functional/services/deployment_agnostic_services.ts b/x-pack/test_serverless/functional/services/deployment_agnostic_services.ts index caf22c6b38bbb..77130d27e26e9 100644 --- a/x-pack/test_serverless/functional/services/deployment_agnostic_services.ts +++ b/x-pack/test_serverless/functional/services/deployment_agnostic_services.ts @@ -5,78 +5,67 @@ * 2.0. */ -import _ from 'lodash'; - -import { services as functionalServices } from '@kbn/test-suites-xpack/functional/services'; +import { services as functionalPlatformServices } from '@kbn/test-suites-xpack-platform/functional/services'; import { services as deploymentAgnosticSharedServices } from '../../shared/services/deployment_agnostic_services'; -/* - * Some FTR services from stateful functional tests are compatible with serverless environment - * While adding a new one, make sure to verify that it works on both Kibana CI and MKI - */ -const deploymentAgnosticFunctionalServices = _.pick(functionalServices, [ - '__webdriver__', - 'aceEditor', - 'actions', - 'appsMenu', - 'browser', - 'canvasElement', - 'cases', - 'comboBox', - 'selectable', - 'dashboardAddPanel', - 'dashboardBadgeActions', - 'dashboardCustomizePanel', - 'dashboardDrilldownPanelActions', - 'dashboardDrilldownsManage', - 'dashboardExpect', - 'dashboardPanelActions', - 'dashboardSettings', - 'dashboardVisualizations', - 'dataGrid', - 'dataStreams', - 'dataViews', - 'elasticChart', - 'embedding', - 'failureDebugging', - 'fieldEditor', - 'filterBar', - 'find', - 'flyout', - 'globalNav', - 'inspector', - 'listingTable', - 'managementMenu', - 'menuToggle', - 'ml', - 'monacoEditor', - 'esql', - 'pieChart', - 'pipelineEditor', - 'pipelineList', - 'png', - 'queryBar', - 'random', - 'renderable', - 'reporting', - 'retryOnStale', - 'rules', - 'sampleData', - 'savedObjectsFinder', - 'savedQueryManagementComponent', - 'screenshots', - 'snapshots', - 'supertest', - 'testSubjects', - 'transform', - 'toasts', - 'uptime', - 'usageCollection', - 'userMenu', - 'vegaDebugInspector', -]); - export const services = { ...deploymentAgnosticSharedServices, - ...deploymentAgnosticFunctionalServices, + __webdriver__: functionalPlatformServices.__webdriver__, + aceEditor: functionalPlatformServices.aceEditor, + actions: functionalPlatformServices.actions, + appsMenu: functionalPlatformServices.appsMenu, + browser: functionalPlatformServices.browser, + canvasElement: functionalPlatformServices.canvasElement, + cases: functionalPlatformServices.cases, + comboBox: functionalPlatformServices.comboBox, + selectable: functionalPlatformServices.selectable, + dashboardAddPanel: functionalPlatformServices.dashboardAddPanel, + dashboardBadgeActions: functionalPlatformServices.dashboardBadgeActions, + dashboardCustomizePanel: functionalPlatformServices.dashboardCustomizePanel, + dashboardDrilldownPanelActions: functionalPlatformServices.dashboardDrilldownPanelActions, + dashboardDrilldownsManage: functionalPlatformServices.dashboardDrilldownsManage, + dashboardExpect: functionalPlatformServices.dashboardExpect, + dashboardPanelActions: functionalPlatformServices.dashboardPanelActions, + dashboardSettings: functionalPlatformServices.dashboardSettings, + dashboardVisualizations: functionalPlatformServices.dashboardVisualizations, + dataGrid: functionalPlatformServices.dataGrid, + dataStreams: functionalPlatformServices.dataStreams, + dataViews: functionalPlatformServices.dataViews, + elasticChart: functionalPlatformServices.elasticChart, + embedding: functionalPlatformServices.embedding, + failureDebugging: functionalPlatformServices.failureDebugging, + fieldEditor: functionalPlatformServices.fieldEditor, + filterBar: functionalPlatformServices.filterBar, + find: functionalPlatformServices.find, + flyout: functionalPlatformServices.flyout, + globalNav: functionalPlatformServices.globalNav, + inspector: functionalPlatformServices.inspector, + listingTable: functionalPlatformServices.listingTable, + managementMenu: functionalPlatformServices.managementMenu, + menuToggle: functionalPlatformServices.menuToggle, + ml: functionalPlatformServices.ml, + monacoEditor: functionalPlatformServices.monacoEditor, + esql: functionalPlatformServices.esql, + pieChart: functionalPlatformServices.pieChart, + pipelineEditor: functionalPlatformServices.pipelineEditor, + pipelineList: functionalPlatformServices.pipelineList, + png: functionalPlatformServices.png, + queryBar: functionalPlatformServices.queryBar, + random: functionalPlatformServices.random, + renderable: functionalPlatformServices.renderable, + reporting: functionalPlatformServices.reporting, + retryOnStale: functionalPlatformServices.retryOnStale, + rules: functionalPlatformServices.rules, + sampleData: functionalPlatformServices.sampleData, + savedObjectsFinder: functionalPlatformServices.savedObjectsFinder, + savedQueryManagementComponent: functionalPlatformServices.savedQueryManagementComponent, + screenshots: functionalPlatformServices.screenshots, + snapshots: functionalPlatformServices.snapshots, + supertest: functionalPlatformServices.supertest, + testSubjects: functionalPlatformServices.testSubjects, + transform: functionalPlatformServices.transform, + toasts: functionalPlatformServices.toasts, + usageCollection: functionalPlatformServices.usageCollection, + userMenu: functionalPlatformServices.userMenu, + vegaDebugInspector: functionalPlatformServices.vegaDebugInspector, }; diff --git a/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts b/x-pack/test_serverless/shared/services/alerting_api.ts similarity index 99% rename from x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts rename to x-pack/test_serverless/shared/services/alerting_api.ts index dedc24e7e6614..da4e6948ce295 100644 --- a/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts +++ b/x-pack/test_serverless/shared/services/alerting_api.ts @@ -19,7 +19,7 @@ import { ApmRuleParamsType } from '@kbn/apm-plugin/common/rules/apm_rule_types'; import { v4 as uuidv4 } from 'uuid'; import moment from 'moment'; import type { SyntheticsMonitorStatusRuleParams as StatusRuleParams } from '@kbn/response-ops-rule-params/synthetics_monitor_status'; -import { DeploymentAgnosticFtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../functional/ftr_provider_context'; export interface SloBurnRateRuleParams { sloId: string; @@ -71,7 +71,7 @@ const RETRY_COUNT = 10; const RETRY_DELAY = 1000; const generateUniqueKey = () => uuidv4().replace(/-/g, ''); -export function AlertingApiProvider({ getService }: DeploymentAgnosticFtrProviderContext) { +export function AlertingApiProvider({ getService }: FtrProviderContext) { const samlAuth = getService('samlAuth'); const supertestWithoutAuth = getService('supertestWithoutAuth'); const es = getService('es'); diff --git a/x-pack/test_serverless/shared/services/deployment_agnostic_services.ts b/x-pack/test_serverless/shared/services/deployment_agnostic_services.ts index 0e11b3b10c25c..3ffddedf743d0 100644 --- a/x-pack/test_serverless/shared/services/deployment_agnostic_services.ts +++ b/x-pack/test_serverless/shared/services/deployment_agnostic_services.ts @@ -6,10 +6,11 @@ */ import { services as apiIntegrationServices } from '@kbn/test-suites-xpack/api_integration/services'; -import { services as apiIntegrationDeploymentAgnosticServices } from '@kbn/test-suites-xpack/api_integration/deployment_agnostic/services'; import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { SecuritySolutionApiProvider } from '@kbn/test-suites-xpack/api_integration/services/security_solution_api.gen'; import { services as platformApiIntegrationServices } from '@kbn/test-suites-xpack-platform/api_integration/services'; +import { AlertingApiProvider } from './alerting_api'; +import { UsageAPIProvider } from './usage_api'; // pick only services that work for any FTR config, e.g. 'samlAuth' requires SAML setup in config file const { @@ -41,8 +42,8 @@ export const services = { randomness, retry, security, - usageAPI: platformApiIntegrationServices.usageAPI, + usageAPI: UsageAPIProvider, console, securitySolutionApi: SecuritySolutionApiProvider, - alertingApi: apiIntegrationDeploymentAgnosticServices.alertingApi, + alertingApi: AlertingApiProvider, }; diff --git a/x-pack/test/api_integration/services/usage_api.ts b/x-pack/test_serverless/shared/services/usage_api.ts similarity index 96% rename from x-pack/test/api_integration/services/usage_api.ts rename to x-pack/test_serverless/shared/services/usage_api.ts index 7ce533a229a77..339ca0ca05f1c 100644 --- a/x-pack/test/api_integration/services/usage_api.ts +++ b/x-pack/test_serverless/shared/services/usage_api.ts @@ -10,7 +10,7 @@ import { ELASTIC_HTTP_VERSION_HEADER, X_ELASTIC_INTERNAL_ORIGIN_REQUEST, } from '@kbn/core-http-common'; -import type { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../functional/ftr_provider_context'; export interface UsageStatsPayloadTestFriendly extends UsageStatsPayload { // Overwriting the `object` type to a more test-friendly type diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index 6a6f51a167627..6e46c5389eae3 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -92,5 +92,10 @@ "@kbn/test-suites-xpack-platform", "@kbn/test-suites-xpack-security", "@kbn/test-suites-xpack-observability", + "@kbn/streams-schema", + "@kbn/infra-plugin", + "@kbn/observability-plugin", + "@kbn/response-ops-rule-params", + "@kbn/telemetry-collection-manager-plugin", ] }