Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export const AlertsList: React.FunctionComponent = () => {
addFlyoutVisible={alertFlyoutVisible}
setAddFlyoutVisibility={setAlertFlyoutVisibility}
/>
{editedAlertItem ? (
{editFlyoutVisible && editedAlertItem ? (
<AlertEdit
key={editedAlertItem.id}
initialAlert={editedAlertItem}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,45 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
]);
});

it('should reset alert when canceling an edit', async () => {
const createdAlert = await createAlert({
alertTypeId: '.index-threshold',
name: generateUniqueKey(),
params: {
aggType: 'count',
termSize: 5,
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
groupBy: 'all',
threshold: [1000, 5000],
index: ['.kibana_1'],
timeField: 'alert',
},
});
await pageObjects.common.navigateToApp('triggersActions');
await pageObjects.triggersActionsUI.searchAlerts(createdAlert.name);

const editLink = await testSubjects.findAll('alertsTableCell-editLink');
await editLink[0].click();

const updatedAlertName = 'Changed Alert Name';
const nameInputToUpdate = await testSubjects.find('alertNameInput');
await nameInputToUpdate.click();
await nameInputToUpdate.clearValue();
await nameInputToUpdate.type(updatedAlertName);

await testSubjects.click('cancelSaveEditedAlertButton');
await find.waitForDeletedByCssSelector('[data-test-subj="cancelSaveEditedAlertButton"]');

const editLinkPostCancel = await testSubjects.findAll('alertsTableCell-editLink');
await editLinkPostCancel[0].click();

const nameInputAfterCancel = await testSubjects.find('alertNameInput');
const textAfterCancel = await nameInputAfterCancel.getAttribute('value');
expect(textAfterCancel).to.eql(createdAlert.name);
});

it('should search for tags', async () => {
const createdAlert = await createAlert();
await pageObjects.common.navigateToApp('triggersActions');
Expand Down