[ResponseOps] Docs screenshots - initial set of automated docs screenshots (#138627)

This PR adds initial support for automated ResponseOps docs screenshots and takes the first three screenshots.
This commit is contained in:
Robert Oskamp 2022-08-15 15:08:28 +02:00 committed by GitHub
parent 68130f7037
commit 6d1f3dff2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 419 additions and 64 deletions

View file

@ -6,11 +6,12 @@
*/
import pMap from 'p-map';
import { CasePostRequest, CaseResponse } from '@kbn/cases-plugin/common/api';
import { CasePostRequest, CaseResponse, CaseStatuses } from '@kbn/cases-plugin/common/api';
import {
createCase as createCaseAPI,
deleteAllCaseItems,
createComment,
updateCase,
} from '../../../cases_api_integration/common/lib/utils';
import { FtrProviderContext } from '../../ftr_provider_context';
import { generateRandomCaseWithoutConnector } from './helpers';
@ -56,5 +57,24 @@ export function CasesAPIServiceProvider({ getService }: FtrProviderContext) {
}): Promise<CaseResponse> {
return createComment({ supertest: kbnSupertest, params, caseId });
},
async setStatus(
caseId: string,
caseVersion: string,
newStatus: 'open' | 'in-progress' | 'closed'
) {
await updateCase({
supertest: kbnSupertest,
params: {
cases: [
{
id: caseId,
version: caseVersion,
status: CaseStatuses[newStatus],
},
],
},
});
},
};
}

View file

@ -15,6 +15,8 @@ export function CasesSingleViewServiceProvider({ getService, getPageObject }: Ft
const testSubjects = getService('testSubjects');
const header = getPageObject('header');
const find = getService('find');
const lensPage = getPageObject('lens');
const retry = getService('retry');
return {
async deleteCase() {
@ -33,5 +35,56 @@ export function CasesSingleViewServiceProvider({ getService, getPageObject }: Ft
expect(userActionText).contain(contentToMatch);
},
async getCommentCount(): Promise<number> {
const commentsContainer = await testSubjects.find('user-actions');
const comments = await commentsContainer.findAllByClassName('euiComment');
return comments.length - 1; // don't count the element for adding a new comment
},
async submitComment() {
const commentCountBefore = await this.getCommentCount();
await testSubjects.click('submit-comment');
await retry.tryForTime(10 * 1000, async () => {
const commentCountAfter = await this.getCommentCount();
expect(commentCountAfter).to.eql(
commentCountBefore + 1,
`Number of comments should increase by 1`
);
});
},
async addVisualization(visName: string) {
// open saved object finder
const addCommentElement = await testSubjects.find('add-comment');
const addVisualizationButton = await addCommentElement.findByCssSelector(
'[data-test-subj="euiMarkdownEditorToolbarButton"][aria-label="Visualization"]'
);
await addVisualizationButton.click();
await testSubjects.existOrFail('savedObjectFinderItemList', { timeout: 10 * 1000 });
// select visualization
await testSubjects.setValue('savedObjectFinderSearchInput', visName, {
clearWithKeyboard: true,
});
const sourceSubj = `savedObjectTitle${visName.replaceAll(' ', '-')}`;
await testSubjects.click(sourceSubj);
await header.waitUntilLoadingHasFinished();
await lensPage.isLensPageOrFail();
// save and return to cases app, add comment
await lensPage.saveAndReturn();
await testSubjects.existOrFail('cases-app', { timeout: 10 * 1000 });
await this.submitComment();
},
async openVisualizationButtonTooltip() {
const addCommentElement = await testSubjects.find('add-comment');
const addVisualizationButton = await addCommentElement.findByCssSelector(
'[data-test-subj="euiMarkdownEditorToolbarButton"][aria-label="Visualization"]'
);
await addVisualizationButton.moveMouseTo();
await new Promise((resolve) => setTimeout(resolve, 500)); // give tooltip time to open
},
};
}

View file

@ -10,5 +10,6 @@ import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('apps', function () {
loadTestFile(require.resolve('./ml_docs'));
loadTestFile(require.resolve('./response_ops_docs'));
});
}

View file

@ -13,7 +13,7 @@ import { ECOMMERCE_INDEX_PATTERN } from '..';
export default function ({ getService }: FtrProviderContext) {
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['ml_docs', 'anomaly_detection'];
@ -73,7 +73,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.jobTable.openEditCustomUrlsForJobTab(ecommerceJobConfig.job_id);
const existingCustomUrlCount = await ml.jobTable.getExistingCustomUrlCount();
await ml.jobTable.fillInDashboardUrlForm(testDashboardCustomUrl);
await mlScreenshots.takeScreenshot('ml-customurl-edit', screenshotDirectories);
await commonScreenshots.takeScreenshot('ml-customurl-edit', screenshotDirectories);
await ml.testExecution.logTestStep('add the custom url and save the job');
await ml.jobTable.saveCustomUrl(testDashboardCustomUrl.label, existingCustomUrlCount);
@ -94,7 +94,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.anomaliesTable.scrollTableIntoView();
await ml.anomaliesTable.ensureAnomalyActionsMenuOpen(0);
await mlScreenshots.takeScreenshot('ml-population-results', screenshotDirectories);
await commonScreenshots.takeScreenshot('ml-population-results', screenshotDirectories);
});
});
}

View file

@ -15,7 +15,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const maps = getPageObject('maps');
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const renderable = getService('renderable');
const screenshotDirectories = ['ml_docs', 'anomaly_detection'];
@ -119,7 +119,10 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await maps.setView(44.1, -68.9, 4.5);
await maps.closeLegend();
await mlScreenshots.takeScreenshot('weblogs-data-visualizer-geopoint', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'weblogs-data-visualizer-geopoint',
screenshotDirectories
);
});
it('ecommerce wizard screenshot', async () => {
@ -163,8 +166,8 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
});
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot(
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'ecommerce-advanced-wizard-geopoint',
screenshotDirectories
);
@ -217,8 +220,11 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
});
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('weblogs-advanced-wizard-geopoint', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'weblogs-advanced-wizard-geopoint',
screenshotDirectories
);
});
// the job stopped to produce an anomaly, needs investigation
@ -246,7 +252,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await ml.anomaliesTable.ensureDetailsOpen(0);
await ml.anomalyExplorer.scrollChartsContainerIntoView();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'ecommerce-anomaly-explorer-geopoint',
screenshotDirectories
);
@ -284,7 +290,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await ml.anomalyExplorer.scrollChartsContainerIntoView();
await maps.closeLegend();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'weblogs-anomaly-explorer-geopoint',
screenshotDirectories
);

View file

@ -13,7 +13,7 @@ import { LOGS_INDEX_PATTERN } from '..';
export default function ({ getPageObject, getService }: FtrProviderContext) {
const header = getPageObject('header');
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const renderable = getService('renderable');
const screenshotDirectories = ['ml_docs', 'anomaly_detection'];
@ -77,7 +77,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await ml.dataVisualizerTable.ensureDetailsOpen('geo.dest');
await renderable.waitForRender();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'weblogs-data-visualizer-choropleth',
screenshotDirectories
);
@ -100,7 +100,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await ml.jobWizardMultiMetric.scrollSplitFieldIntoView();
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'weblogs-multimetric-wizard-vector',
screenshotDirectories
);
@ -119,7 +119,10 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('scroll map into view and take screenshot');
await ml.anomalyExplorer.scrollMapContainerIntoView();
await renderable.waitForRender();
await mlScreenshots.takeScreenshot('weblogs-anomaly-explorer-vectors', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'weblogs-anomaly-explorer-vectors',
screenshotDirectories
);
});
});
}

View file

@ -13,7 +13,7 @@ import { LOGS_INDEX_PATTERN } from '..';
export default function ({ getService }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const testSubjects = getService('testSubjects');
const screenshotDirectories = ['ml_docs', 'anomaly_detection'];
@ -71,8 +71,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('continue to the pick fields step and take screenshot');
await ml.jobWizardCommon.advanceToPickFieldsSection();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('ml-population-job', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot('ml-population-job', screenshotDirectories);
});
it('anomaly explorer screenshots', async () => {
@ -96,7 +96,7 @@ export default function ({ getService }: FtrProviderContext) {
yOffset: Math.floor(cellSize / 2.0),
});
await mlScreenshots.takeScreenshot('ml-population-results', screenshotDirectories);
await commonScreenshots.takeScreenshot('ml-population-results', screenshotDirectories);
await ml.testExecution.logTestStep(
'select swim lane tile, expand anomaly row and take screenshot'
@ -111,7 +111,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.anomaliesTable.ensureDetailsOpen(0);
await ml.anomaliesTable.scrollRowIntoView(0);
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'ml-population-anomaly',
screenshotDirectories,
1500,

View file

@ -13,7 +13,7 @@ import { FLIGHTS_INDEX_PATTERN } from '..';
export default function ({ getService }: FtrProviderContext) {
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['ml_docs', 'data_frame_analytics'];
@ -70,14 +70,14 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await commonScreenshots.removeFocusFromElement();
await ml.dataFrameAnalyticsCreation.scrollJobTypeSelectionIntoView();
await mlScreenshots.takeScreenshot('flights-classification-job-1', screenshotDirectories);
await commonScreenshots.takeScreenshot('flights-classification-job-1', screenshotDirectories);
await ml.testExecution.logTestStep('scroll to scatterplot matrix and take screenshot');
await ml.dataFrameAnalyticsCreation.assertScatterplotMatrixLoaded();
await ml.dataFrameAnalyticsCreation.scrollScatterplotMatrixIntoView();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'flights-classification-scatterplot',
screenshotDirectories
);
@ -97,8 +97,11 @@ export default function ({ getService }: FtrProviderContext) {
);
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('flights-classification-details', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-classification-details',
screenshotDirectories
);
});
it('results view screenshots', async () => {
@ -124,14 +127,17 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsResults.expandFeatureImportanceSection(false);
await ml.dataFrameAnalyticsResults.expandScatterplotMatrixSection(false);
await ml.dataFrameAnalyticsResults.scrollAnalysisIntoView();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('flights-classification-results', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-classification-results',
screenshotDirectories
);
await ml.testExecution.logTestStep('expand feature importance section and take screenshot');
await ml.dataFrameAnalyticsResults.expandFeatureImportanceSection(true);
await ml.dataFrameAnalyticsResults.scrollFeatureImportanceIntoView();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot(
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-classification-total-importance',
screenshotDirectories
);
@ -140,21 +146,27 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('expand evaluation section and take screenshot');
await ml.dataFrameAnalyticsResults.expandClassificationEvaluationSection(true);
await ml.dataFrameAnalyticsResults.scrollClassificationEvaluationIntoView();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot(
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-classification-evaluation',
screenshotDirectories
);
await mlScreenshots.takeScreenshot('confusion-matrix-binary', screenshotDirectories);
await mlScreenshots.takeScreenshot('confusion-matrix-binary-accuracy', screenshotDirectories);
await commonScreenshots.takeScreenshot('confusion-matrix-binary', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'confusion-matrix-binary-accuracy',
screenshotDirectories
);
await ml.dataFrameAnalyticsResults.scrollRocCurveChartIntoView();
await mlScreenshots.takeScreenshot('flights-classification-roc-curve', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'flights-classification-roc-curve',
screenshotDirectories
);
await ml.dataFrameAnalyticsResults.expandClassificationEvaluationSection(false);
await ml.testExecution.logTestStep('open decision path popover and take screenshot');
await ml.dataFrameAnalyticsResults.scrollResultsIntoView();
await ml.dataFrameAnalyticsResults.openFeatureImportancePopover();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'flights-classification-importance',
screenshotDirectories
);

View file

@ -13,7 +13,7 @@ import { LOGS_INDEX_PATTERN } from '..';
export default function ({ getService }: FtrProviderContext) {
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const transform = getService('transform');
const screenshotDirectories = ['ml_docs', 'data_frame_analytics'];
@ -79,7 +79,7 @@ export default function ({ getService }: FtrProviderContext) {
await transform.wizard.assertDefineStepActive();
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.takeScreenshot('logs-transform-preview', screenshotDirectories);
await commonScreenshots.takeScreenshot('logs-transform-preview', screenshotDirectories);
});
it('wizard screenshots', async () => {
@ -95,12 +95,12 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.takeScreenshot('weblog-outlier-job-1', screenshotDirectories);
await commonScreenshots.takeScreenshot('weblog-outlier-job-1', screenshotDirectories);
await ml.testExecution.logTestStep('scroll to scatterplot matrix and take screenshot');
await ml.dataFrameAnalyticsCreation.assertScatterplotMatrixLoaded();
await ml.dataFrameAnalyticsCreation.scrollScatterplotMatrixIntoView();
await mlScreenshots.takeScreenshot('weblog-outlier-scatterplot', screenshotDirectories);
await commonScreenshots.takeScreenshot('weblog-outlier-scatterplot', screenshotDirectories);
});
it('results view screenshots', async () => {
@ -118,15 +118,15 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('fold scatterplot section and take screenshot');
await ml.dataFrameAnalyticsResults.expandScatterplotMatrixSection(false);
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('outliers', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot('outliers', screenshotDirectories);
await ml.testExecution.logTestStep('scroll to scatterplot matrix and take screenshot');
await ml.dataFrameAnalyticsResults.expandScatterplotMatrixSection(true);
await mlScreenshots.removeFocusFromElement();
await commonScreenshots.removeFocusFromElement();
await ml.dataFrameAnalyticsResults.assertScatterplotMatrixLoaded();
await ml.dataFrameAnalyticsResults.scrollScatterplotMatrixIntoView();
await mlScreenshots.takeScreenshot('outliers-scatterplot', screenshotDirectories);
await commonScreenshots.takeScreenshot('outliers-scatterplot', screenshotDirectories);
});
});
}

View file

@ -13,7 +13,7 @@ import { FLIGHTS_INDEX_PATTERN } from '..';
export default function ({ getService }: FtrProviderContext) {
const ml = getService('ml');
const mlScreenshots = getService('mlScreenshots');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['ml_docs', 'data_frame_analytics'];
@ -72,14 +72,14 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists();
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await commonScreenshots.removeFocusFromElement();
await ml.dataFrameAnalyticsCreation.scrollJobTypeSelectionIntoView();
await mlScreenshots.takeScreenshot('flights-regression-job-1', screenshotDirectories);
await commonScreenshots.takeScreenshot('flights-regression-job-1', screenshotDirectories);
await ml.testExecution.logTestStep('scroll to scatterplot matrix and take screenshot');
await ml.dataFrameAnalyticsCreation.assertScatterplotMatrixLoaded();
await ml.dataFrameAnalyticsCreation.scrollScatterplotMatrixIntoView();
await mlScreenshots.takeScreenshot(
await commonScreenshots.takeScreenshot(
'flightdata-regression-scatterplot',
screenshotDirectories
);
@ -99,8 +99,8 @@ export default function ({ getService }: FtrProviderContext) {
);
await ml.testExecution.logTestStep('take screenshot');
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('flights-regression-details', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot('flights-regression-details', screenshotDirectories);
});
it('results view screenshots', async () => {
@ -124,8 +124,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsResults.expandScatterplotMatrixSection(false);
await ml.dataFrameAnalyticsResults.scrollAnalysisIntoView();
await ml.dataFrameAnalyticsResults.enableResultsTablePreviewHistogramCharts(true);
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot(
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-regression-results',
screenshotDirectories,
1500,
@ -135,8 +135,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('expand feature importance section and take screenshot');
await ml.dataFrameAnalyticsResults.expandFeatureImportanceSection(true);
await ml.dataFrameAnalyticsResults.scrollFeatureImportanceIntoView();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot(
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-regression-total-importance',
screenshotDirectories
);
@ -145,14 +145,20 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('expand evaluation section and take screenshot');
await ml.dataFrameAnalyticsResults.expandRegressionEvaluationSection(true);
await ml.dataFrameAnalyticsResults.scrollRegressionEvaluationIntoView();
await mlScreenshots.removeFocusFromElement();
await mlScreenshots.takeScreenshot('flights-regression-evaluation', screenshotDirectories);
await commonScreenshots.removeFocusFromElement();
await commonScreenshots.takeScreenshot(
'flights-regression-evaluation',
screenshotDirectories
);
await ml.dataFrameAnalyticsResults.expandRegressionEvaluationSection(false);
await ml.testExecution.logTestStep('open decision path popover and take screenshot');
await ml.dataFrameAnalyticsResults.scrollResultsIntoView();
await ml.dataFrameAnalyticsResults.openFeatureImportancePopover();
await mlScreenshots.takeScreenshot('flights-regression-importance', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'flights-regression-importance',
screenshotDirectories
);
});
});
}

View file

@ -0,0 +1,38 @@
/*
* 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 const ECOMMERCE_INDEX_PATTERN = 'kibana_sample_data_ecommerce';
export const FLIGHTS_INDEX_PATTERN = 'kibana_sample_data_flights';
export const LOGS_INDEX_PATTERN = 'kibana_sample_data_logs';
export default function ({ getPageObject, getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
const ml = getService('ml');
const securityPage = getPageObject('security');
describe('response ops docs', function () {
this.tags(['responseOps']);
before(async () => {
await ml.testResources.installAllKibanaSampleData();
await ml.testResources.setKibanaTimeZoneToUTC();
await browser.setWindowSize(1920, 1080);
await securityPage.login();
});
after(async () => {
await securityPage.forceLogout();
await ml.testResources.removeAllKibanaSampleData();
await ml.testResources.resetKibanaTimeZone();
});
loadTestFile(require.resolve('./stack_cases'));
loadTestFile(require.resolve('./observability_cases'));
});
}

View file

@ -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('observability cases', function () {
loadTestFile(require.resolve('./list_view'));
});
}

View file

@ -0,0 +1,64 @@
/*
* 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 { CommentType } from '@kbn/cases-plugin/common/api';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const cases = getService('cases');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'observability_cases'];
describe('list view', function () {
before(async () => {
const { id: caseIdMetrics } = await cases.api.createCase({
title: 'Metrics inventory',
tags: ['IBM resilient'],
description: 'Test.',
owner: 'observability',
});
await cases.api.createAttachment({
caseId: caseIdMetrics,
params: { comment: 'test comment', type: CommentType.user, owner: 'observability' },
});
await cases.api.createAttachment({
caseId: caseIdMetrics,
params: { comment: '2nd test comment', type: CommentType.user, owner: 'observability' },
});
const { id: caseIdLogs, version: caseVersionLogs } = await cases.api.createCase({
title: 'Logs threshold',
tags: ['jira'],
description: 'Test.',
owner: 'observability',
});
await cases.api.setStatus(caseIdLogs, caseVersionLogs, 'closed');
const { id: caseIdMonitoring } = await cases.api.createCase({
title: 'Monitor uptime',
tags: ['swimlane'],
description: 'Test.',
owner: 'observability',
});
const { version: caseVersionMonitoring } = await cases.api.createAttachment({
caseId: caseIdMonitoring,
params: { comment: 'test comment', type: CommentType.user, owner: 'observability' },
});
await cases.api.setStatus(caseIdMonitoring, caseVersionMonitoring, 'in-progress');
});
after(async () => {
await cases.api.deleteAllCases();
});
it('cases list screenshot', async () => {
await cases.navigation.navigateToApp('observability/cases', 'cases-all-title');
await commonScreenshots.takeScreenshot('cases', screenshotDirectories, 1400, 1024);
});
});
}

View file

@ -0,0 +1,44 @@
/*
* 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 }: FtrProviderContext) {
const cases = getService('cases');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'stack_cases'];
let CASE_ID: string;
describe('deatils view', function () {
before(async () => {
const { id: caseId } = await cases.api.createCase({
title: 'Web transactions',
tags: ['e-commerce'],
description: 'Investigate e-commerce sample data.',
});
CASE_ID = caseId;
});
after(async () => {
await cases.api.deleteAllCases();
});
it('cases visualization screenshot', async () => {
await cases.navigation.navigateToApp();
await cases.navigation.navigateToSingleCase('cases', CASE_ID);
await cases.singleCase.addVisualization('Transactions per day');
await cases.singleCase.openVisualizationButtonTooltip();
await commonScreenshots.takeScreenshot(
'cases-visualization',
screenshotDirectories,
1400,
1024
);
});
});
}

View file

@ -0,0 +1,15 @@
/*
* 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('stack cases', function () {
loadTestFile(require.resolve('./list_view'));
loadTestFile(require.resolve('./details_view'));
});
}

View file

@ -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 { CommentType } from '@kbn/cases-plugin/common/api';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const cases = getService('cases');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'stack_cases'];
describe('list view', function () {
before(async () => {
const { id: caseId } = await cases.api.createCase({
title: 'Web transactions',
tags: ['e-commerce'],
description: 'Investigate e-commerce sample data.',
});
await cases.api.createAttachment({
caseId,
params: { comment: 'test comment', type: CommentType.user, owner: 'cases' },
});
});
after(async () => {
await cases.api.deleteAllCases();
});
it('cases list screenshot', async () => {
await cases.navigation.navigateToApp();
await commonScreenshots.takeScreenshot('cases', screenshotDirectories, 1400, 1024);
});
});
}

View file

@ -5,6 +5,8 @@
* 2.0.
*/
import Fs from 'fs';
import { CA_CERT_PATH } from '@kbn/dev-utils';
import { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
@ -13,14 +15,37 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('../functional/config.base.js')
);
const servers = {
...xpackFunctionalConfig.get('servers'),
elasticsearch: {
...xpackFunctionalConfig.get('servers.elasticsearch'),
protocol: 'https',
certificateAuthorities: [Fs.readFileSync(CA_CERT_PATH)],
},
};
return {
// default to the xpack functional config
...xpackFunctionalConfig.getAll(),
servers,
services,
testFiles: [require.resolve('./apps')],
junit: {
...xpackFunctionalConfig.get('junit'),
reportName: 'Chrome X-Pack UI Screenshot Creation',
},
esTestCluster: {
...xpackFunctionalConfig.get('esTestCluster'),
ssl: true,
},
kbnTestServer: {
...xpackFunctionalConfig.get('kbnTestServer'),
serverArgs: [
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'),
`--elasticsearch.hosts=https://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`,
`--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`,
`--xpack.alerting.rules.minimumScheduleInterval.value="2s"`,
],
},
};
}

View file

@ -7,10 +7,10 @@
import { FtrProviderContext } from '../ftr_provider_context';
export function MachineLearningScreenshotsProvider({ getService }: FtrProviderContext) {
export function CommonScreenshotsProvider({ getService }: FtrProviderContext) {
const browser = getService('browser');
const ml = getService('ml');
const screenshot = getService('screenshots');
const testSubjects = getService('testSubjects');
const DEFAULT_WIDTH = 1920;
const DEFAULT_HEIGHT = 1080;
@ -18,14 +18,29 @@ export function MachineLearningScreenshotsProvider({ getService }: FtrProviderCo
return {
async takeScreenshot(name: string, subDirectories: string[], width?: number, height?: number) {
await browser.setWindowSize(width ?? DEFAULT_WIDTH, height ?? DEFAULT_HEIGHT);
await new Promise((resolve) => setTimeout(resolve, 1000)); // give components time to resize
await screenshot.take(`${name}_new`, undefined, subDirectories);
await browser.setWindowSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
},
async openKibanaNav() {
if (!(await testSubjects.exists('collapsibleNav'))) {
await testSubjects.click('toggleNavButton');
}
await testSubjects.existOrFail('collapsibleNav');
},
async closeKibanaNav() {
if (await testSubjects.exists('collapsibleNav')) {
await testSubjects.click('toggleNavButton');
}
await testSubjects.missingOrFail('collapsibleNav');
},
async removeFocusFromElement() {
// open and close the Kibana nav to un-focus the last used element
await ml.navigation.openKibanaNav();
await ml.navigation.closeKibanaNav();
await this.openKibanaNav();
await this.closeKibanaNav();
},
};
}

View file

@ -7,10 +7,10 @@
import { services as kibanaFunctionalServices } from '../../functional/services';
import { MachineLearningScreenshotsProvider } from './ml_screenshots';
import { CommonScreenshotsProvider } from './common_screenshots';
export const services = {
...kibanaFunctionalServices,
mlScreenshots: MachineLearningScreenshotsProvider,
commonScreenshots: CommonScreenshotsProvider,
};