[8.17] [ML] Enable change point detection functional tests (#201612) (#202186)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[ML] Enable change point detection functional tests
(#201612)](https://github.com/elastic/kibana/pull/201612)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dima
Arnautov","email":"dmitrii.arnautov@elastic.co"},"sourceCommit":{"committedDate":"2024-11-28T14:55:40Z","message":"[ML]
Enable change point detection functional tests (#201612)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/200091\r\nFixes
https://github.com/elastic/kibana/issues/200836\r\n\r\n- Splits change
point detection functional tests into separate groups\r\nfor dashboard
and cases integrations.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"04196063288f128d2a1691c85dfbd1b4afe4fd17","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","test_ui_functional","release_note:skip","v9.0.0","Team:ML","ci:cloud-deploy","Feature:ML/AIOps","backport:version","v8.17.0","v8.18.0"],"title":"[ML]
Enable change point detection functional tests
","number":201612,"url":"https://github.com/elastic/kibana/pull/201612","mergeCommit":{"message":"[ML]
Enable change point detection functional tests (#201612)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/200091\r\nFixes
https://github.com/elastic/kibana/issues/200836\r\n\r\n- Splits change
point detection functional tests into separate groups\r\nfor dashboard
and cases integrations.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"04196063288f128d2a1691c85dfbd1b4afe4fd17"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201612","number":201612,"mergeCommit":{"message":"[ML]
Enable change point detection functional tests (#201612)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/200091\r\nFixes
https://github.com/elastic/kibana/issues/200836\r\n\r\n- Splits change
point detection functional tests into separate groups\r\nfor dashboard
and cases integrations.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed","sha":"04196063288f128d2a1691c85dfbd1b4afe4fd17"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
This commit is contained in:
Kibana Machine 2024-11-29 04:02:42 +11:00 committed by GitHub
parent cf74292f98
commit b88ceaa1bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 113 additions and 36 deletions

View file

@ -7,19 +7,16 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { USER } from '../../services/ml/security_common';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const esArchiver = getService('esArchiver');
const aiops = getService('aiops');
const cases = getService('cases');
// aiops lives in the ML UI so we need some related services.
const ml = getService('ml');
// FLAKY: https://github.com/elastic/kibana/issues/200091
describe.skip('change point detection', function () {
describe('change point detection UI', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce');
await ml.testResources.createDataViewIfNeeded('ft_ecommerce', 'order_date');
@ -29,7 +26,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
after(async () => {
await ml.testResources.deleteDataViewByTitle('ft_ecommerce');
await cases.api.deleteAllCases();
});
it(`loads the change point detection page`, async () => {
@ -104,34 +100,5 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await aiops.changePointDetectionPage.addChangePointConfig();
await aiops.changePointDetectionPage.assertPanelExist(1);
});
it('attaches change point charts to a dashboard', async () => {
await aiops.changePointDetectionPage.assertPanelExist(0);
await aiops.changePointDetectionPage.attachChartsToDashboard(0, {
applyTimeRange: true,
maxSeries: 1,
});
});
it('attaches change point charts to a case', async () => {
await ml.navigation.navigateToMl();
await elasticChart.setNewChartUiDebugFlag(true);
await aiops.changePointDetectionPage.navigateToDataViewSelection();
await ml.jobSourceSelection.selectSourceForChangePointDetection('ft_ecommerce');
await aiops.changePointDetectionPage.assertChangePointDetectionPageExists();
await aiops.changePointDetectionPage.clickUseFullDataButton();
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
const caseParams = {
title: 'ML Change Point Detection case',
description: 'Case with a change point detection attachment',
tag: 'ml_change_point_detection',
reporter: USER.ML_POWERUSER,
};
await aiops.changePointDetectionPage.attachChartsToCases(0, caseParams);
await ml.cases.assertCaseWithChangePointDetectionChartsAttachment(caseParams);
});
});
}

View file

@ -0,0 +1,57 @@
/*
* 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';
import { USER } from '../../services/ml/security_common';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const esArchiver = getService('esArchiver');
const aiops = getService('aiops');
const cases = getService('cases');
// aiops lives in the ML UI so we need some related services.
const ml = getService('ml');
describe('change point detection in cases', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce');
await ml.testResources.createDataViewIfNeeded('ft_ecommerce', 'order_date');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser();
});
after(async () => {
await ml.testResources.deleteDataViewByTitle('ft_ecommerce');
await cases.api.deleteAllCases();
});
it('attaches change point charts to a case', async () => {
await ml.navigation.navigateToMl();
await elasticChart.setNewChartUiDebugFlag(true);
await aiops.changePointDetectionPage.navigateToDataViewSelection();
await ml.jobSourceSelection.selectSourceForChangePointDetection('ft_ecommerce');
await aiops.changePointDetectionPage.assertChangePointDetectionPageExists();
await aiops.changePointDetectionPage.clickUseFullDataButton();
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
const caseParams = {
title: 'ML Change Point Detection case',
description: 'Case with a change point detection attachment',
tag: 'ml_change_point_detection',
reporter: USER.ML_POWERUSER,
};
await ml.testExecution.logTestStep('attaches chart to a case');
await aiops.changePointDetectionPage.attachChartsToCases(0, caseParams);
await ml.testExecution.logTestStep('checks if attachment is present in the case');
await ml.cases.assertCaseWithChangePointDetectionChartsAttachment(caseParams);
});
});
}

View file

@ -0,0 +1,48 @@
/*
* 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 ({ getPageObjects, getService }: FtrProviderContext) {
const elasticChart = getService('elasticChart');
const esArchiver = getService('esArchiver');
const aiops = getService('aiops');
// aiops lives in the ML UI so we need some related services.
const ml = getService('ml');
describe('change point detection in dashboard', function () {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce');
await ml.testResources.createDataViewIfNeeded('ft_ecommerce', 'order_date');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser();
});
after(async () => {
await ml.testResources.deleteDataViewByTitle('ft_ecommerce');
});
it('attaches change point charts to a dashboard from the ML app', async () => {
await ml.navigation.navigateToMl();
await elasticChart.setNewChartUiDebugFlag(true);
await aiops.changePointDetectionPage.navigateToDataViewSelection();
await ml.jobSourceSelection.selectSourceForChangePointDetection('ft_ecommerce');
await aiops.changePointDetectionPage.assertChangePointDetectionPageExists();
await aiops.changePointDetectionPage.clickUseFullDataButton();
await aiops.changePointDetectionPage.selectMetricField(0, 'products.discount_amount');
await aiops.changePointDetectionPage.selectSplitField(0, 'geoip.city_name');
await aiops.changePointDetectionPage.assertPanelExist(0);
await aiops.changePointDetectionPage.attachChartsToDashboard(0, {
applyTimeRange: true,
maxSeries: 1,
});
});
});
}

View file

@ -33,6 +33,8 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./log_rate_analysis_anomaly_table'));
loadTestFile(require.resolve('./log_rate_analysis_dashboard_embeddable'));
loadTestFile(require.resolve('./change_point_detection'));
loadTestFile(require.resolve('./change_point_detection_dashboard'));
loadTestFile(require.resolve('./change_point_detection_cases'));
loadTestFile(require.resolve('./log_pattern_analysis'));
loadTestFile(require.resolve('./log_pattern_analysis_in_discover'));
});

View file

@ -129,9 +129,12 @@ export function CasesCreateViewServiceProvider(
async createCaseFromModal(params: CreateCaseParams) {
await casesCommon.assertCaseModalVisible(true);
await testSubjects.click('cases-table-add-case-filter-bar');
await casesCommon.assertCaseModalVisible(false);
await retry.tryForTime(5000, async () => {
await testSubjects.click('cases-table-add-case-filter-bar');
await casesCommon.assertCaseModalVisible(false);
});
await this.creteCaseFromFlyout(params);
},
};