[8.5] [ML] Adds new screenshot to the generate anomaly alerts test suite (#146885) (#146894)

# Backport

This will backport the following commits from `main` to `8.5`:
- [[ML] Adds new screenshot to the generate anomaly alerts test suite
(#146885)](https://github.com/elastic/kibana/pull/146885)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"István Zoltán
Szabó","email":"szabosteve@gmail.com"},"sourceCommit":{"committedDate":"2022-12-02T15:00:15Z","message":"[ML]
Adds new screenshot to the generate anomaly alerts test suite
(#146885)\n\n## Summary\r\n\r\nThis PR adds the necessary code to take
the `ml-health-check-config`\r\nscreenshot in the generate anomaly
alerts test
suite.","sha":"8f076ffe73798b9f3ee6771f797948be354e9b6e","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","v8.6.0","v8.7.0","v8.5.3"],"number":146885,"url":"https://github.com/elastic/kibana/pull/146885","mergeCommit":{"message":"[ML]
Adds new screenshot to the generate anomaly alerts test suite
(#146885)\n\n## Summary\r\n\r\nThis PR adds the necessary code to take
the `ml-health-check-config`\r\nscreenshot in the generate anomaly
alerts test
suite.","sha":"8f076ffe73798b9f3ee6771f797948be354e9b6e"}},"sourceBranch":"main","suggestedTargetBranches":["8.6","8.5"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146885","number":146885,"mergeCommit":{"message":"[ML]
Adds new screenshot to the generate anomaly alerts test suite
(#146885)\n\n## Summary\r\n\r\nThis PR adds the necessary code to take
the `ml-health-check-config`\r\nscreenshot in the generate anomaly
alerts test
suite.","sha":"8f076ffe73798b9f3ee6771f797948be354e9b6e"}},{"branch":"8.5","label":"v8.5.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
This commit is contained in:
Kibana Machine 2022-12-02 10:53:43 -05:00 committed by GitHub
parent 36b9290cb1
commit 18e3e57066
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 1 deletions

View file

@ -32,6 +32,13 @@ export function MachineLearningAlertingProvider(
});
},
async selectAnomalyDetectionJobHealthAlertType() {
await retry.tryForTime(5000, async () => {
await testSubjects.click('xpack.ml.anomaly_detection_jobs_health-SelectOption');
await testSubjects.existOrFail(`mlJobsHealthAlertingRuleForm`, { timeout: 1000 });
});
},
async selectJobs(jobIds: string[]) {
for (const jobId of jobIds) {
await comboBox.set('mlAnomalyAlertJobSelection > comboBoxInput', jobId);
@ -219,6 +226,14 @@ export function MachineLearningAlertingProvider(
});
},
async clickCancelSaveRuleButton() {
await retry.tryForTime(5000, async () => {
await testSubjects.click('cancelSaveRuleButton');
await testSubjects.existOrFail('confirmModalTitleText', { timeout: 1000 });
await testSubjects.click('confirmModalConfirmButton');
});
},
async openAddRuleVariable() {
await retry.tryForTime(5000, async () => {
await testSubjects.click('messageAddVariableButton');

View file

@ -101,7 +101,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
describe('overview page alert flyout controls', () => {
it('alert flyout screenshot', async () => {
it('alert flyout screenshots', async () => {
await ml.navigation.navigateToAlertsAndAction();
await pageObjects.triggersActionsUI.clickCreateAlertButton();
await ml.alerting.setRuleName('test-ecommerce');
@ -112,6 +112,19 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// close popover
await browser.pressKeys(browser.keys.ESCAPE);
await ml.alerting.selectAnomalyDetectionJobHealthAlertType();
await ml.alerting.selectJobs([testJobId]);
await ml.testExecution.logTestStep('take screenshot');
await commonScreenshots.takeScreenshot(
'ml-health-check-config',
screenshotDirectories,
1920,
1400
);
await ml.alerting.clickCancelSaveRuleButton();
await pageObjects.triggersActionsUI.clickCreateAlertButton();
await ml.alerting.setRuleName('test-ecommerce');
await ml.alerting.selectAnomalyDetectionAlertType();
await ml.testExecution.logTestStep('should have correct default values');
await ml.alerting.assertSeverity(75);