From 46707e46de1059360f178b336689fd1761258fd3 Mon Sep 17 00:00:00 2001 From: Tre Date: Tue, 9 Jan 2024 11:43:39 +0000 Subject: [PATCH] [FTR] Mv test subjs svc to shared location (#174048) ## Summary Refactoring general ui service to a kbn package. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 1 + packages/kbn-ftr-common-functional-ui-services/index.ts | 2 ++ .../kbn-ftr-common-functional-ui-services/services/all.ts | 4 ++++ .../services}/browser.ts | 4 ++-- .../services/ftr_provider_context.ts | 4 +--- .../services}/test_subjects.ts | 5 +++-- packages/kbn-ftr-common-functional-ui-services/tsconfig.json | 3 ++- test/common/services/security/test_user.ts | 3 +-- test/functional/services/common/index.ts | 3 --- test/functional/services/index.ts | 4 ---- .../apps/infra/logs/ml_job_id_formats/request_tracker.ts | 2 +- .../with_host_configured/app_search/engines.ts | 2 +- .../functional_enterprise_search/page_objects/app_search.ts | 2 +- yarn.lock | 5 +++-- 14 files changed, 22 insertions(+), 22 deletions(-) rename {test/functional/services/common => packages/kbn-ftr-common-functional-ui-services/services}/browser.ts (99%) rename {test/functional/services/common => packages/kbn-ftr-common-functional-ui-services/services}/test_subjects.ts (99%) diff --git a/package.json b/package.json index b5968e48b79e1..ebe28eb8f8b43 100644 --- a/package.json +++ b/package.json @@ -1631,6 +1631,7 @@ "sass-embedded": "^1.69.5", "sass-loader": "^10.5.1", "selenium-webdriver": "^4.16.0", + "sharp": "0.32.6", "simple-git": "^3.16.0", "sinon": "^7.4.2", "sort-package-json": "^1.53.1", diff --git a/packages/kbn-ftr-common-functional-ui-services/index.ts b/packages/kbn-ftr-common-functional-ui-services/index.ts index e975c838a54a4..cd383a03e5f5d 100644 --- a/packages/kbn-ftr-common-functional-ui-services/index.ts +++ b/packages/kbn-ftr-common-functional-ui-services/index.ts @@ -14,9 +14,11 @@ export type { CustomCheerioStatic, } from './services/web_element_wrapper/custom_cheerio_api'; export { Browsers } from './services/remote/browsers'; +export { type Browser } from './services/browser'; export { NETWORK_PROFILES, type NetworkOptions, type NetworkProfile, } from './services/remote/network_profiles'; export type { TimeoutOpt } from './types'; +export { TestSubjects } from './services/test_subjects'; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/all.ts b/packages/kbn-ftr-common-functional-ui-services/services/all.ts index a27655fc867eb..313aa6eb0b71f 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/all.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/all.ts @@ -9,9 +9,13 @@ import { RetryOnStaleProvider } from './retry_on_stale'; import { RemoteProvider } from './remote'; import { FindProvider } from './find'; +import { TestSubjects } from './test_subjects'; +import { BrowserProvider } from './browser'; export const services = { retryOnStale: RetryOnStaleProvider, __webdriver__: RemoteProvider, find: FindProvider, + testSubjects: TestSubjects, + browser: BrowserProvider, }; diff --git a/test/functional/services/common/browser.ts b/packages/kbn-ftr-common-functional-ui-services/services/browser.ts similarity index 99% rename from test/functional/services/common/browser.ts rename to packages/kbn-ftr-common-functional-ui-services/services/browser.ts index 8054816bb4ee3..8e26a0d9dac9f 100644 --- a/test/functional/services/common/browser.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/browser.ts @@ -21,8 +21,8 @@ import { NETWORK_PROFILES, type NetworkOptions, type NetworkProfile, -} from '@kbn/ftr-common-functional-ui-services'; -import { FtrService, type FtrProviderContext } from '../../ftr_provider_context'; +} from '..'; +import { FtrService, type FtrProviderContext } from './ftr_provider_context'; export type Browser = BrowserService; diff --git a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts index bf80085dd4590..992fe27059e45 100644 --- a/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/ftr_provider_context.ts @@ -15,7 +15,5 @@ const services = { retry: RetryService, }; -type Services = typeof services; - -export type FtrProviderContext = GenericFtrProviderContext; +export type FtrProviderContext = GenericFtrProviderContext; export class FtrService extends GenericFtrService {} diff --git a/test/functional/services/common/test_subjects.ts b/packages/kbn-ftr-common-functional-ui-services/services/test_subjects.ts similarity index 99% rename from test/functional/services/common/test_subjects.ts rename to packages/kbn-ftr-common-functional-ui-services/services/test_subjects.ts index 57d2bbbd64244..ec9960290a5dc 100644 --- a/test/functional/services/common/test_subjects.ts +++ b/packages/kbn-ftr-common-functional-ui-services/services/test_subjects.ts @@ -7,8 +7,9 @@ */ import { subj as testSubjSelector } from '@kbn/test-subj-selector'; -import { WebElementWrapper, type TimeoutOpt } from '@kbn/ftr-common-functional-ui-services'; -import { FtrService } from '../../ftr_provider_context'; +import { WebElementWrapper } from './web_element_wrapper'; +import type { TimeoutOpt } from '../types'; +import { FtrService } from './ftr_provider_context'; interface ExistsOptions { timeout?: number; diff --git a/packages/kbn-ftr-common-functional-ui-services/tsconfig.json b/packages/kbn-ftr-common-functional-ui-services/tsconfig.json index f8ae6aae1b9be..ccba7988041f7 100644 --- a/packages/kbn-ftr-common-functional-ui-services/tsconfig.json +++ b/packages/kbn-ftr-common-functional-ui-services/tsconfig.json @@ -11,6 +11,7 @@ "@kbn/tooling-log", "@kbn/repo-info", "@kbn/test-subj-selector", - "@kbn/ftr-common-functional-services" + "@kbn/ftr-common-functional-services", + "@kbn/std" ] } diff --git a/test/common/services/security/test_user.ts b/test/common/services/security/test_user.ts index e8d88d81bb167..f3012304a95bd 100644 --- a/test/common/services/security/test_user.ts +++ b/test/common/services/security/test_user.ts @@ -9,11 +9,10 @@ import { format as formatUrl } from 'url'; import supertest from 'supertest'; +import { type Browser, TestSubjects } from '@kbn/ftr-common-functional-ui-services'; import { Role } from './role'; import { User } from './user'; import { FtrService, FtrProviderContext } from '../../ftr_provider_context'; -import { Browser } from '../../../functional/services/common'; -import { TestSubjects } from '../../../functional/services/common'; const TEST_USER_NAME = 'test_user'; const TEST_USER_PASSWORD = 'changeme'; diff --git a/test/functional/services/common/index.ts b/test/functional/services/common/index.ts index 3d1078d92dc5e..478d2ee2fb27e 100644 --- a/test/functional/services/common/index.ts +++ b/test/functional/services/common/index.ts @@ -6,10 +6,7 @@ * Side Public License, v 1. */ -export type { Browser } from './browser'; -export { BrowserProvider } from './browser'; export { FailureDebuggingProvider } from './failure_debugging'; export { PngService } from './png'; export { ScreenshotsService } from './screenshots'; export { SnapshotsService } from './snapshots'; -export { TestSubjects } from './test_subjects'; diff --git a/test/functional/services/index.ts b/test/functional/services/index.ts index de503f8ccf99a..e8b8fafc8852d 100644 --- a/test/functional/services/index.ts +++ b/test/functional/services/index.ts @@ -11,12 +11,10 @@ import { services as commonServiceProviders } from '../../common/services'; import { AppsMenuService } from './apps_menu'; import { - BrowserProvider, FailureDebuggingProvider, PngService, ScreenshotsService, SnapshotsService, - TestSubjects, } from './common'; import { ComboBoxService } from './combo_box'; import { @@ -61,7 +59,6 @@ export const services = { ...commonFunctionalUIServices, filterBar: FilterBarService, queryBar: QueryBarService, - testSubjects: TestSubjects, docTable: DocTableService, png: PngService, screenshots: ScreenshotsService, @@ -83,7 +80,6 @@ export const services = { dataGrid: DataGridService, embedding: EmbeddingService, renderable: RenderableService, - browser: BrowserProvider, pieChart: PieChartService, inspector: InspectorService, fieldEditor: FieldEditorService, diff --git a/x-pack/test/functional/apps/infra/logs/ml_job_id_formats/request_tracker.ts b/x-pack/test/functional/apps/infra/logs/ml_job_id_formats/request_tracker.ts index fe7fb5a49b15d..df02224012ccf 100644 --- a/x-pack/test/functional/apps/infra/logs/ml_job_id_formats/request_tracker.ts +++ b/x-pack/test/functional/apps/infra/logs/ml_job_id_formats/request_tracker.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Browser } from '../../../../../../../test/functional/services/common/browser'; +import type { Browser } from '@kbn/ftr-common-functional-ui-services'; import { CommonPageObject } from '../../../../../../../test/functional/page_objects/common_page'; type PerformanceResourceTimingWithHttpStatus = PerformanceResourceTiming & { diff --git a/x-pack/test/functional_enterprise_search/apps/enterprise_search/with_host_configured/app_search/engines.ts b/x-pack/test/functional_enterprise_search/apps/enterprise_search/with_host_configured/app_search/engines.ts index 5b10de7b3e036..5a528391e06b9 100644 --- a/x-pack/test/functional_enterprise_search/apps/enterprise_search/with_host_configured/app_search/engines.ts +++ b/x-pack/test/functional_enterprise_search/apps/enterprise_search/with_host_configured/app_search/engines.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; +import type { Browser } from '@kbn/ftr-common-functional-ui-services'; import { AppSearchService, IEngine } from '../../../../services/app_search_service'; -import { Browser } from '../../../../../../../test/functional/services/common'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function enterpriseSearchSetupEnginesTests({ diff --git a/x-pack/test/functional_enterprise_search/page_objects/app_search.ts b/x-pack/test/functional_enterprise_search/page_objects/app_search.ts index 75fe3da03ed1e..9ae967265d1b8 100644 --- a/x-pack/test/functional_enterprise_search/page_objects/app_search.ts +++ b/x-pack/test/functional_enterprise_search/page_objects/app_search.ts @@ -6,8 +6,8 @@ */ import { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; +import { TestSubjects } from '@kbn/ftr-common-functional-ui-services'; import { FtrProviderContext } from '../ftr_provider_context'; -import { TestSubjects } from '../../../../test/functional/services/common'; export function AppSearchPageProvider({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common']); diff --git a/yarn.lock b/yarn.lock index 1a1d578e7f7ff..ddfb556b671f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4993,7 +4993,8 @@ uid "" "@kbn/lens-inline-editing-example-plugin@link:x-pack/examples/lens_embeddable_inline_editing_example": - + version "0.0.0" + uid "" "@kbn/lens-plugin@link:x-pack/plugins/lens": version "0.0.0" @@ -27629,7 +27630,7 @@ sharp@0.32.1: tar-fs "^2.1.1" tunnel-agent "^0.6.0" -sharp@^0.32.6: +sharp@0.32.6, sharp@^0.32.6: version "0.32.6" resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.32.6.tgz#6ad30c0b7cd910df65d5f355f774aa4fce45732a" integrity sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==