diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap b/x-pack/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap index 5431102accee4..d36d1c2b6a5c8 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap +++ b/x-pack/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap @@ -9,6 +9,7 @@ exports[`RuleEditorFlyout renders the flyout after adding a condition to a rule { + it('should open job selection flyout', async () => { await PageObjects.dashboard.clickNewDashboard(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); await ml.dashboardEmbeddables.openAnomalyJobSelectionFlyout( @@ -66,12 +66,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); }); - it('can select jobs', async () => { + it('should select jobs', async () => { await ml.alerting.selectJobs([testData.jobConfig.job_id]); await ml.alerting.assertJobSelection([testData.jobConfig.job_id]); }); - it('can configure single metric viewer panel', async () => { + it('should configure single metric viewer panel', async () => { await ml.singleMetricViewer.assertDetectorInputExist(); await ml.singleMetricViewer.assertDetectorInputValue( testData.expected.detectorInputValue @@ -83,14 +83,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); }); - it('create new single metric viewer panel', async () => { + it('should create new single metric viewer panel', async () => { await ml.dashboardEmbeddables.clickSingleMetricViewerInitializerConfirmButtonEnabled(); await PageObjects.timePicker.pauseAutoRefresh(); await ml.dashboardEmbeddables.assertDashboardPanelExists(testData.panelTitle); await ml.singleMetricViewer.assertChartExist(); - await ml.singleMetricViewer.assertAnomalyMarkerExist(); await PageObjects.dashboard.saveDashboard(testData.dashboardTitle); }); + + it('should have anomaly click action menu', async () => { + await ml.dashboardEmbeddables.assertDashboardPanelExists(testData.panelTitle); + await ml.singleMetricViewer.assertAnomalyMarkerExist(); + await ml.singleMetricViewer.openAnomalyMarkerActionsPopover(); + await ml.singleMetricViewer.assertAnomalyActionDiscoverButtonExists(); + await ml.singleMetricViewer.assertAnomalyActionJobRulesButtonExists(); + await ml.singleMetricViewer.ensureAnomalyActionJobRulesButtonClicked(); + await ml.singleMetricViewer.openAnomalyMarkerActionsPopover(); + await ml.singleMetricViewer.ensureAnomalyActionDiscoverButtonClicked(); + }); }); } }); diff --git a/x-pack/test/functional/services/ml/single_metric_viewer.ts b/x-pack/test/functional/services/ml/single_metric_viewer.ts index 05ae2bd20cab7..1f902348880ee 100644 --- a/x-pack/test/functional/services/ml/single_metric_viewer.ts +++ b/x-pack/test/functional/services/ml/single_metric_viewer.ts @@ -16,6 +16,7 @@ export function MachineLearningSingleMetricViewerProvider( ) { const comboBox = getService('comboBox'); const testSubjects = getService('testSubjects'); + const retry = getService('retry'); return { async assertSingleMetricViewerEmptyListMessageExsist() { @@ -82,6 +83,30 @@ export function MachineLearningSingleMetricViewerProvider( await testSubjects.existOrFail('mlAnomaliesListRowActionsMenu'); }, + async assertAnomalyActionDiscoverButtonExists() { + await testSubjects.existOrFail('mlAnomaliesListRowAction_viewInDiscoverButton'); + }, + + async assertAnomalyActionJobRulesButtonExists() { + await testSubjects.existOrFail('mlAnomaliesListRowActionConfigureRulesButton'); + }, + + async ensureAnomalyActionDiscoverButtonClicked() { + await retry.tryForTime(3 * 1000, async () => { + await testSubjects.click('mlAnomaliesListRowAction_viewInDiscoverButton'); + await testSubjects.existOrFail('discoverLayoutResizableContainer'); + }); + }, + + async ensureAnomalyActionJobRulesButtonClicked() { + await retry.tryForTime(3 * 1000, async () => { + await testSubjects.click('mlAnomaliesListRowActionConfigureRulesButton'); + await testSubjects.existOrFail('mlRuleEditorFlyout'); + await testSubjects.click('euiFlyoutCloseButton'); + await testSubjects.missingOrFail('mlRuleEditorFlyout'); + }); + }, + async assertAnnotationsExists(state: string) { await testSubjects.existOrFail(`mlAnomalyExplorerAnnotations ${state}`, { timeout: 30 * 1000,