Skip to content

Commit

Permalink
[DOCS] Automate case and server log connector screenshots in serverle…
Browse files Browse the repository at this point in the history
…ss Observability project (elastic#167709)
  • Loading branch information
lcawl authored and dej611 committed Oct 17, 2023
1 parent 09188c1 commit 5a27b7d
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 10 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions x-pack/test_serverless/functional/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -26,5 +27,6 @@ export const services = {
svlSearchNavigation: SvlSearchNavigationServiceProvider,
svlSecNavigation: SvlSecNavigationServiceProvider,
svlCommonScreenshots: SvlCommonScreenshotsProvider,
svlCases: SvlCasesServiceProvider,
svlMl: MachineLearningProvider,
};
Original file line number Diff line number Diff line change
@@ -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'],
});
Original file line number Diff line number Diff line change
@@ -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'));
});
}
Original file line number Diff line number Diff line change
@@ -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'));
});
}
Original file line number Diff line number Diff line change
@@ -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);
});
});
}
Original file line number Diff line number Diff line change
@@ -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'));
});
}
Original file line number Diff line number Diff line change
@@ -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();
});
});
}
Original file line number Diff line number Diff line change
@@ -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'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { createTestConfig } from '../../config.base';

const enabledActionTypes = ['.index', '.server-log'];
const enabledActionTypes = ['.index'];

export default createTestConfig({
serverlessProject: 'es',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -58,6 +50,5 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) {
});

loadTestFile(require.resolve('./connectors'));
// loadTestFile(require.resolve('./connector_types'));
});
}

0 comments on commit 5a27b7d

Please sign in to comment.