diff --git a/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx b/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx index 323322d06c3..4925613526d 100644 --- a/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx +++ b/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx @@ -152,7 +152,7 @@ describe('RuleEditor cloud', () => { await user.type(getLabelInput(ui.inputs.labelValue(0).get()), 'warn{enter}'); // save and check what was sent to backend - await user.click(ui.buttons.save.get()); + await user.click(ui.buttons.saveAndExit.get()); await waitFor(() => expect(mocks.api.setRulerRuleGroup).toHaveBeenCalled()); expect(mocks.api.setRulerRuleGroup).toHaveBeenCalledWith( { dataSourceName: 'Prom', apiVersion: 'config' }, diff --git a/public/app/features/alerting/unified/RuleEditorGrafanaRules.test.tsx b/public/app/features/alerting/unified/RuleEditorGrafanaRules.test.tsx index 3d07778998d..f14e44b7bbd 100644 --- a/public/app/features/alerting/unified/RuleEditorGrafanaRules.test.tsx +++ b/public/app/features/alerting/unified/RuleEditorGrafanaRules.test.tsx @@ -145,7 +145,7 @@ describe('RuleEditor grafana managed rules', () => { //8 segons // save and check what was sent to backend - await userEvent.click(ui.buttons.save.get()); + await userEvent.click(ui.buttons.saveAndExit.get()); // 9seg await waitFor(() => expect(mocks.api.setRulerRuleGroup).toHaveBeenCalled()); // 9seg diff --git a/public/app/features/alerting/unified/RuleEditorRecordingRule.test.tsx b/public/app/features/alerting/unified/RuleEditorRecordingRule.test.tsx index 07be64d8515..8e189c291a5 100644 --- a/public/app/features/alerting/unified/RuleEditorRecordingRule.test.tsx +++ b/public/app/features/alerting/unified/RuleEditorRecordingRule.test.tsx @@ -1,4 +1,4 @@ -import { waitFor, screen, within, waitForElementToBeRemoved } from '@testing-library/react'; +import { screen, waitFor, waitForElementToBeRemoved, within } from '@testing-library/react'; import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event'; import React from 'react'; import { renderRuleEditor, ui } from 'test/helpers/alertingRuleEditor'; @@ -151,7 +151,7 @@ describe('RuleEditor recording rules', () => { await userEvent.type(getLabelInput(ui.inputs.labelValue(1).get()), 'the a-team{enter}'); // try to save, find out that recording rule name is invalid - await userEvent.click(ui.buttons.save.get()); + await userEvent.click(ui.buttons.saveAndExit.get()); await waitFor(() => expect( byText( @@ -166,7 +166,7 @@ describe('RuleEditor recording rules', () => { await userEvent.type(await ui.inputs.name.find(), 'my:great:new:recording:rule'); // save and check what was sent to backend - await userEvent.click(ui.buttons.save.get()); + await userEvent.click(ui.buttons.saveAndExit.get()); await waitFor(() => expect(mocks.api.setRulerRuleGroup).toHaveBeenCalled()); expect(mocks.api.setRulerRuleGroup).toHaveBeenCalledWith( { dataSourceName: 'Prom', apiVersion: 'legacy' }, diff --git a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx index ea1bcc5f6a4..31d4d91df2f 100644 --- a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx @@ -166,16 +166,18 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => { const actionButtons = ( - + {existing && ( + + )}