From f5759138507fbb00504bcc6760653a47de026570 Mon Sep 17 00:00:00 2001 From: Dmitry Lemeshko Date: Fri, 15 May 2020 18:28:28 +0200 Subject: [PATCH] FTR: move basic services under common folder (#66563) * [CODEOWNERS] set kibana-qa to own test/functional/services * [functional/services] move low-level services to common folder * update codeowners * update imports Co-authored-by: Elastic Machine --- .github/CODEOWNERS | 3 +++ test/common/services/security/test_user.ts | 4 +-- .../services/{ => common}/browser.ts | 8 +++--- .../{ => common}/failure_debugging.ts | 2 +- test/functional/services/{ => common}/find.ts | 4 +-- test/functional/services/common/index.ts | 25 +++++++++++++++++++ .../services/{ => common}/screenshots.ts | 6 ++--- .../services/{ => common}/snapshots.ts | 2 +- .../services/{ => common}/test_subjects.ts | 4 +-- test/functional/services/index.ts | 14 ++++++----- 10 files changed, 51 insertions(+), 21 deletions(-) rename test/functional/services/{ => common}/browser.ts (98%) rename test/functional/services/{ => common}/failure_debugging.ts (97%) rename test/functional/services/{ => common}/find.ts (99%) create mode 100644 test/functional/services/common/index.ts rename test/functional/services/{ => common}/screenshots.ts (95%) rename test/functional/services/{ => common}/snapshots.ts (97%) rename test/functional/services/{ => common}/test_subjects.ts (99%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 19116977756f4..0000fc6f56af3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -130,6 +130,9 @@ # Quality Assurance /src/dev/code_coverage @elastic/kibana-qa +/test/functional/services/common @elastic/kibana-qa +/test/functional/services/lib @elastic/kibana-qa +/test/functional/services/remote @elastic/kibana-qa # Platform /src/core/ @elastic/kibana-platform diff --git a/test/common/services/security/test_user.ts b/test/common/services/security/test_user.ts index 7f01c64d291a5..e72ded3a6f2fd 100644 --- a/test/common/services/security/test_user.ts +++ b/test/common/services/security/test_user.ts @@ -19,8 +19,8 @@ import { Role } from './role'; import { User } from './user'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { Browser } from '../../../functional/services/browser'; -import { TestSubjects } from '../../../functional/services/test_subjects'; +import { Browser } from '../../../functional/services/common'; +import { TestSubjects } from '../../../functional/services/common'; export async function createTestUserService( role: Role, diff --git a/test/functional/services/browser.ts b/test/functional/services/common/browser.ts similarity index 98% rename from test/functional/services/browser.ts rename to test/functional/services/common/browser.ts index 13d2365c07191..4b5a3c101b51c 100644 --- a/test/functional/services/browser.ts +++ b/test/functional/services/common/browser.ts @@ -24,10 +24,10 @@ import { LegacyActionSequence } from 'selenium-webdriver/lib/actions'; import { ProvidedType } from '@kbn/test/types/ftr'; import Jimp from 'jimp'; -import { modifyUrl } from '../../../src/core/utils'; -import { WebElementWrapper } from './lib/web_element_wrapper'; -import { FtrProviderContext } from '../ftr_provider_context'; -import { Browsers } from './remote/browsers'; +import { modifyUrl } from '../../../../src/core/utils'; +import { WebElementWrapper } from '../lib/web_element_wrapper'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { Browsers } from '../remote/browsers'; export type Browser = ProvidedType; export async function BrowserProvider({ getService }: FtrProviderContext) { diff --git a/test/functional/services/failure_debugging.ts b/test/functional/services/common/failure_debugging.ts similarity index 97% rename from test/functional/services/failure_debugging.ts rename to test/functional/services/common/failure_debugging.ts index cd12f1b75c828..aa67c455e0100 100644 --- a/test/functional/services/failure_debugging.ts +++ b/test/functional/services/common/failure_debugging.ts @@ -22,7 +22,7 @@ import { writeFile, mkdir } from 'fs'; import { promisify } from 'util'; import del from 'del'; -import { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; interface Test { fullTitle(): string; diff --git a/test/functional/services/find.ts b/test/functional/services/common/find.ts similarity index 99% rename from test/functional/services/find.ts rename to test/functional/services/common/find.ts index 3697e94461074..727d81377b141 100644 --- a/test/functional/services/find.ts +++ b/test/functional/services/common/find.ts @@ -18,8 +18,8 @@ */ import { WebDriver, WebElement, By, until } from 'selenium-webdriver'; -import { FtrProviderContext } from '../ftr_provider_context'; -import { WebElementWrapper } from './lib/web_element_wrapper'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { WebElementWrapper } from '../lib/web_element_wrapper'; export async function FindProvider({ getService }: FtrProviderContext) { const log = getService('log'); diff --git a/test/functional/services/common/index.ts b/test/functional/services/common/index.ts new file mode 100644 index 0000000000000..fc483ca512679 --- /dev/null +++ b/test/functional/services/common/index.ts @@ -0,0 +1,25 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { BrowserProvider, Browser } from './browser'; +export { FailureDebuggingProvider } from './failure_debugging'; +export { FindProvider } from './find'; +export { ScreenshotsProvider } from './screenshots'; +export { SnapshotsProvider } from './snapshots'; +export { TestSubjectsProvider, TestSubjects } from './test_subjects'; diff --git a/test/functional/services/screenshots.ts b/test/functional/services/common/screenshots.ts similarity index 95% rename from test/functional/services/screenshots.ts rename to test/functional/services/common/screenshots.ts index 4c5728174cf99..daa55240f3eb7 100644 --- a/test/functional/services/screenshots.ts +++ b/test/functional/services/common/screenshots.ts @@ -23,9 +23,9 @@ import { promisify } from 'util'; import del from 'del'; -import { comparePngs } from './lib/compare_pngs'; -import { FtrProviderContext } from '../ftr_provider_context'; -import { WebElementWrapper } from './lib/web_element_wrapper'; +import { comparePngs } from '../lib/compare_pngs'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { WebElementWrapper } from '../lib/web_element_wrapper'; const mkdirAsync = promisify(mkdir); const writeFileAsync = promisify(writeFile); diff --git a/test/functional/services/snapshots.ts b/test/functional/services/common/snapshots.ts similarity index 97% rename from test/functional/services/snapshots.ts rename to test/functional/services/common/snapshots.ts index 84526878a7bb4..2e0b360e594e5 100644 --- a/test/functional/services/snapshots.ts +++ b/test/functional/services/common/snapshots.ts @@ -23,7 +23,7 @@ import { promisify } from 'util'; import expect from '@kbn/expect'; import del from 'del'; -import { FtrProviderContext } from '../ftr_provider_context'; +import { FtrProviderContext } from '../../ftr_provider_context'; const mkdirAsync = promisify(mkdir); const writeFileAsync = promisify(writeFile); diff --git a/test/functional/services/test_subjects.ts b/test/functional/services/common/test_subjects.ts similarity index 99% rename from test/functional/services/test_subjects.ts rename to test/functional/services/common/test_subjects.ts index 090dc995ddc11..e4e0e7ce70bc4 100644 --- a/test/functional/services/test_subjects.ts +++ b/test/functional/services/common/test_subjects.ts @@ -20,8 +20,8 @@ import testSubjSelector from '@kbn/test-subj-selector'; import { map as mapAsync } from 'bluebird'; import { ProvidedType } from '@kbn/test/types/ftr'; -import { WebElementWrapper } from './lib/web_element_wrapper'; -import { FtrProviderContext } from '../ftr_provider_context'; +import { WebElementWrapper } from '../lib/web_element_wrapper'; +import { FtrProviderContext } from '../../ftr_provider_context'; interface ExistsOptions { timeout?: number; diff --git a/test/functional/services/index.ts b/test/functional/services/index.ts index 02ed9e9865d9a..cbb0c6790dbe9 100644 --- a/test/functional/services/index.ts +++ b/test/functional/services/index.ts @@ -20,7 +20,14 @@ import { services as commonServiceProviders } from '../../common/services'; import { AppsMenuProvider } from './apps_menu'; -import { BrowserProvider } from './browser'; +import { + BrowserProvider, + FailureDebuggingProvider, + FindProvider, + ScreenshotsProvider, + SnapshotsProvider, + TestSubjectsProvider, +} from './common'; import { ComboBoxProvider } from './combo_box'; import { DashboardAddPanelProvider, @@ -33,19 +40,14 @@ import { import { DocTableProvider } from './doc_table'; import { ElasticChartProvider } from './elastic_chart'; import { EmbeddingProvider } from './embedding'; -import { FailureDebuggingProvider } from './failure_debugging'; import { FilterBarProvider } from './filter_bar'; -import { FindProvider } from './find'; import { FlyoutProvider } from './flyout'; import { GlobalNavProvider } from './global_nav'; import { InspectorProvider } from './inspector'; import { QueryBarProvider } from './query_bar'; import { RemoteProvider } from './remote'; import { RenderableProvider } from './renderable'; -import { ScreenshotsProvider } from './screenshots'; -import { SnapshotsProvider } from './snapshots'; import { TableProvider } from './table'; -import { TestSubjectsProvider } from './test_subjects'; import { ToastsProvider } from './toasts'; // @ts-ignore not TS yet import { PieChartProvider } from './visualizations';