From 5a27b7d1c36c13347b45f8f7f6ba123755fe5713 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 5 Oct 2023 14:10:00 -0700 Subject: [PATCH] [DOCS] Automate case and server log connector screenshots in serverless Observability project (#167709) --- .buildkite/ftr_configs.yml | 1 + .../functional/services/index.ts | 2 + .../observability/config.screenshots.ts | 21 +++++++ .../screenshot_creation/index.ts | 14 +++++ .../response_ops_docs/cases/index.ts | 20 ++++++ .../response_ops_docs/cases/list_view.ts | 63 +++++++++++++++++++ .../response_ops_docs/connectors/index.ts | 20 ++++++ .../connectors/server_log_connector.ts | 39 ++++++++++++ .../response_ops_docs/index.ts | 31 +++++++++ .../test_suites/search/config.screenshots.ts | 2 +- .../stack_connectors/index.ts | 9 --- 11 files changed, 212 insertions(+), 10 deletions(-) create mode 100644 x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/index.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/index.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/list_view.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/index.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/server_log_connector.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/index.ts diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index 409d3f7927544..b9825675143a8 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -412,6 +412,7 @@ enabled: - x-pack/test_serverless/functional/test_suites/observability/config.examples.ts - x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group1.ts - x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group2.ts + - x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts - x-pack/test_serverless/functional/test_suites/search/config.ts - x-pack/test_serverless/functional/test_suites/search/config.examples.ts - x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts diff --git a/x-pack/test_serverless/functional/services/index.ts b/x-pack/test_serverless/functional/services/index.ts index da2688b22b645..125c93de2fcff 100644 --- a/x-pack/test_serverless/functional/services/index.ts +++ b/x-pack/test_serverless/functional/services/index.ts @@ -13,6 +13,7 @@ import { SvlObltNavigationServiceProvider } from './svl_oblt_navigation'; import { SvlSearchNavigationServiceProvider } from './svl_search_navigation'; import { SvlSecNavigationServiceProvider } from './svl_sec_navigation'; import { SvlCommonScreenshotsProvider } from './svl_common_screenshots'; +import { SvlCasesServiceProvider } from '../../api_integration/services/svl_cases'; import { MachineLearningProvider } from './ml'; export const services = { @@ -26,5 +27,6 @@ export const services = { svlSearchNavigation: SvlSearchNavigationServiceProvider, svlSecNavigation: SvlSecNavigationServiceProvider, svlCommonScreenshots: SvlCommonScreenshotsProvider, + svlCases: SvlCasesServiceProvider, svlMl: MachineLearningProvider, }; diff --git a/x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts b/x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts new file mode 100644 index 0000000000000..f9a06826cb755 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts @@ -0,0 +1,21 @@ +/* + * 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 { createTestConfig } from '../../config.base'; + +const enabledActionTypes = ['.index', '.server-log']; + +export default createTestConfig({ + serverlessProject: 'oblt', + testFiles: [require.resolve('./screenshot_creation')], + kbnServerArgs: [`--xpack.actions.enabledActionTypes=${JSON.stringify(enabledActionTypes)}`], + junit: { + reportName: 'Serverless Observability Screenshot Creation', + }, + + esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], +}); diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/index.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/index.ts new file mode 100644 index 0000000000000..8710906ab6408 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/index.ts @@ -0,0 +1,14 @@ +/* + * 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 default function ({ loadTestFile }: FtrProviderContext) { + describe('Screenshots - serverless observability UI', function () { + loadTestFile(require.resolve('./response_ops_docs')); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/index.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/index.ts new file mode 100644 index 0000000000000..171215dfbf4d3 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/index.ts @@ -0,0 +1,20 @@ +/* + * 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 default function ({ loadTestFile, getService }: FtrProviderContext) { + const browser = getService('browser'); + + describe('observability cases', function () { + before(async () => { + await browser.setWindowSize(1920, 1080); + }); + + loadTestFile(require.resolve('./list_view')); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/list_view.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/list_view.ts new file mode 100644 index 0000000000000..cc1d8b5f78995 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/cases/list_view.ts @@ -0,0 +1,63 @@ +/* + * 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 { OBSERVABILITY_OWNER } from '@kbn/cases-plugin/common'; +import { FtrProviderContext } from '../../../../../ftr_provider_context'; +import { navigateToCasesApp } from '../../../../../../shared/lib/cases'; + +export default function ({ getPageObject, getPageObjects, getService }: FtrProviderContext) { + const pageObjects = getPageObjects(['common', 'header', 'svlCommonPage']); + const svlCases = getService('svlCases'); + const svlCommonScreenshots = getService('svlCommonScreenshots'); + const screenshotDirectories = ['response_ops_docs', 'observability_cases']; + const owner = OBSERVABILITY_OWNER; + + describe('list view', function () { + before(async () => { + await svlCases.api.createCase( + svlCases.api.getPostCaseRequest(owner, { + title: 'Metrics inventory', + tags: ['IBM resilient'], + description: 'Test.', + owner, + }) + ); + + await svlCases.api.createCase( + svlCases.api.getPostCaseRequest(owner, { + title: 'Logs threshold', + tags: ['jira'], + description: 'Test.', + owner, + }) + ); + + await svlCases.api.createCase( + svlCases.api.getPostCaseRequest(owner, { + title: 'Monitor uptime', + tags: ['swimlane'], + description: 'Test.', + owner, + }) + ); + }); + + after(async () => { + await svlCases.api.deleteAllCaseItems(); + await pageObjects.svlCommonPage.forceLogout(); + }); + + beforeEach(async () => { + await pageObjects.svlCommonPage.login(); + }); + + it('cases list screenshot', async () => { + await navigateToCasesApp(getPageObject, getService, owner); + await svlCommonScreenshots.takeScreenshot('cases', screenshotDirectories, 1700, 1024); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/index.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/index.ts new file mode 100644 index 0000000000000..4e2f00e35e94d --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/index.ts @@ -0,0 +1,20 @@ +/* + * 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 default function ({ loadTestFile, getService }: FtrProviderContext) { + const browser = getService('browser'); + + describe('observability connectors', function () { + before(async () => { + await browser.setWindowSize(1920, 1080); + }); + + loadTestFile(require.resolve('./server_log_connector')); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/server_log_connector.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/server_log_connector.ts new file mode 100644 index 0000000000000..7eed7d5cbbd26 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/connectors/server_log_connector.ts @@ -0,0 +1,39 @@ +/* + * 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 default function ({ getService, getPageObjects }: FtrProviderContext) { + const svlCommonScreenshots = getService('svlCommonScreenshots'); + const screenshotDirectories = ['response_ops_docs', 'observability_connectors']; + const pageObjects = getPageObjects(['common', 'header', 'svlCommonPage']); + const testSubjects = getService('testSubjects'); + + describe('server log connector', function () { + beforeEach(async () => { + await pageObjects.svlCommonPage.login(); + }); + + after(async () => { + await pageObjects.svlCommonPage.forceLogout(); + }); + + it('server log connector screenshots', async () => { + await pageObjects.common.navigateToApp('connectors'); + await pageObjects.header.waitUntilLoadingHasFinished(); + await testSubjects.click('createFirstActionButton'); + await testSubjects.click(`.server-log-card`); + await testSubjects.setValue('nameInput', 'Server log test connector'); + await svlCommonScreenshots.takeScreenshot('serverlog-connector', screenshotDirectories); + const saveTestButton = await testSubjects.find('create-connector-flyout-save-test-btn'); + await saveTestButton.click(); + await svlCommonScreenshots.takeScreenshot('serverlog-params-test', screenshotDirectories); + const flyOutCancelButton = await testSubjects.find('euiFlyoutCloseButton'); + await flyOutCancelButton.click(); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/index.ts b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/index.ts new file mode 100644 index 0000000000000..10b33b5fc944d --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/screenshot_creation/response_ops_docs/index.ts @@ -0,0 +1,31 @@ +/* + * 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 default function ({ getService, loadTestFile }: FtrProviderContext) { + const browser = getService('browser'); + const ml = getService('ml'); + + describe('response ops docs', function () { + this.tags(['responseOps']); + + before(async () => { + await ml.testResources.setKibanaTimeZoneToUTC(); + await ml.testResources.disableKibanaAnnouncements(); + await browser.setWindowSize(1920, 1080); + }); + + after(async () => { + await ml.testResources.resetKibanaTimeZone(); + await ml.testResources.resetKibanaAnnouncements(); + }); + + loadTestFile(require.resolve('./cases')); + loadTestFile(require.resolve('./connectors')); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts b/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts index b0c951ef3295c..3a8966904b5c9 100644 --- a/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts +++ b/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts @@ -7,7 +7,7 @@ import { createTestConfig } from '../../config.base'; -const enabledActionTypes = ['.index', '.server-log']; +const enabledActionTypes = ['.index']; export default createTestConfig({ serverlessProject: 'es', diff --git a/x-pack/test_serverless/functional/test_suites/search/screenshot_creation/response_ops_docs/stack_connectors/index.ts b/x-pack/test_serverless/functional/test_suites/search/screenshot_creation/response_ops_docs/stack_connectors/index.ts index f5f06e36d3ca7..e5d251e691183 100644 --- a/x-pack/test_serverless/functional/test_suites/search/screenshot_creation/response_ops_docs/stack_connectors/index.ts +++ b/x-pack/test_serverless/functional/test_suites/search/screenshot_creation/response_ops_docs/stack_connectors/index.ts @@ -18,14 +18,6 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) { describe('stack connectors', function () { before(async () => { await browser.setWindowSize(1920, 1080); - await actions.api.createConnector({ - name: 'server-log-connector', - config: {}, - secrets: {}, - connectorTypeId: '.server-log', - additionalRequestHeaders: svlCommonApi.getInternalRequestHeader(), - }); - await es.indices.create({ index: testIndex, body: { @@ -58,6 +50,5 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) { }); loadTestFile(require.resolve('./connectors')); - // loadTestFile(require.resolve('./connector_types')); }); }