Skip to content

Commit

Permalink
[Alerting] Implemented ability to edit an alert from the alert detail…
Browse files Browse the repository at this point in the history
…s page (elastic#64273)

* Implemented ability to edit an alert from the alert details page

* Fixed refresh and tests

* fixed jest tests
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances_route.tsx
#	x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts
  • Loading branch information
YulNaumenko committed May 4, 2020
1 parent 90a4a5e commit faaec12
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,56 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

describe('Edit alert button', function() {
const testRunUuid = uuid.v4();

it('should open edit alert flyout', async () => {
await pageObjects.common.navigateToApp('triggersActions');
const params = {
aggType: 'count',
termSize: 5,
thresholdComparator: '>',
timeWindowSize: 5,
timeWindowUnit: 'm',
groupBy: 'all',
threshold: [1000, 5000],
index: ['.kibana_1'],
timeField: 'alert',
};
const alert = await alerting.alerts.createAlertWithActions(
testRunUuid,
'.index-threshold',
params
);
// refresh to see alert
await browser.refresh();

await pageObjects.header.waitUntilLoadingHasFinished();

// Verify content
await testSubjects.existOrFail('alertsList');

// click on first alert
await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(alert.name);

const editButton = await testSubjects.find('openEditAlertFlyoutButton');
await editButton.click();

const updatedAlertName = `Changed Alert Name ${uuid.v4()}`;
await testSubjects.setValue('alertNameInput', updatedAlertName, {
clearWithKeyboard: true,
});

await find.clickByCssSelector('[data-test-subj="saveEditedAlertButton"]:not(disabled)');

const toastTitle = await pageObjects.common.closeToast();
expect(toastTitle).to.eql(`Updated '${updatedAlertName}'`);

const headingText = await pageObjects.alertDetailsUI.getHeadingText();
expect(headingText).to.be(updatedAlertName);
});
});

describe('Edit alert button', function() {
const testRunUuid = uuid.v4();

Expand Down

0 comments on commit faaec12

Please sign in to comment.