Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky test fix for Actions and Triggers app alerts should delete all selection #86175

Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await deleteAlerts([createdAlert.id]);
});

it.skip('should delete all selection', async () => {
it('should delete all selection', async () => {
const namePrefix = generateUniqueKey();
let count = 0;
const createdAlertsFirstPage = await Promise.all(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're only creating one alert, we can cleanup some of the looping logic at the same time.

Suggested change
const createdAlertsFirstPage = await Promise.all(
const createdAlert = await createAlert({ name: `${namePrefix}-1` });

times(2, () => createAlert({ name: `${namePrefix}-0${count++}` }))
times(1, () => createAlert({ name: `${namePrefix}-0${count++}` }))
);
await refreshAlertsList();
await pageObjects.triggersActionsUI.searchAlerts(namePrefix);
Expand All @@ -371,7 +371,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

await retry.tryForTime(30000, async () => {
const toastTitle = await pageObjects.common.closeToast();
expect(toastTitle).to.eql('Deleted 2 alerts');
expect(toastTitle).to.eql('Deleted 1 alert');
});

await pageObjects.triggersActionsUI.searchAlerts(namePrefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

const headingText = await pageObjects.alertDetailsUI.getHeadingText();
expect(headingText).to.be(updatedAlertName);
await alerting.alerts.deleteAlert(alert.id);
});

it('should reset alert when canceling an edit', async () => {
Expand Down Expand Up @@ -255,6 +256,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const nameInputAfterCancel = await testSubjects.find('alertNameInput');
const textAfterCancel = await nameInputAfterCancel.getAttribute('value');
expect(textAfterCancel).to.eql(alert.name);
await alerting.alerts.deleteAlert(alert.id);
});
});

Expand Down Expand Up @@ -284,6 +286,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.alertDetailsUI.clickViewInApp();

expect(await pageObjects.alertDetailsUI.getNoOpAppTitle()).to.be(`View Alert ${alert.id}`);
await alerting.alerts.deleteAlert(alert.id);
});

it('renders a disabled alert details view in app button', async () => {
Expand All @@ -304,6 +307,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(alert.name);

expect(await pageObjects.alertDetailsUI.isViewInAppDisabled()).to.be(true);
await alerting.alerts.deleteAlert(alert.id);
});
});

Expand Down Expand Up @@ -369,6 +373,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

after(async () => await alerting.alerts.deleteAlert(alert.id));

it('renders the active alert instances', async () => {
// refresh to ensure Api call and UI are looking at freshest output
await browser.refresh();
Expand Down Expand Up @@ -606,6 +612,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(alert.name);
});

after(async () => await alerting.alerts.deleteAlert(alert.id));

const PAGE_SIZE = 10;
it('renders the first page', async () => {
// Verify content
Expand Down