Skip to content

Commit

Permalink
[Uptime] fix alerts flyout flaky tests (#106925) (#106943)
Browse files Browse the repository at this point in the history
* focus uptime tests

* update timeout time for alert confirm button

* await async requests

* check for alert name input before attempting to set value

* remove focused tests

* ensure that the alertNameInput exists after opening flyout

Co-authored-by: Dominique Clarke <doclarke71@gmail.com>
  • Loading branch information
kibanamachine and dominiqueclarke authored Jul 28, 2021
1 parent 16c11a7 commit 9b7b838
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
42 changes: 22 additions & 20 deletions x-pack/test/functional/services/uptime/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@ export function UptimeAlertsProvider({ getService }: FtrProviderContext) {

return {
async openFlyout(alertType: 'monitorStatus' | 'tls') {
await testSubjects.click('xpack.uptime.alertsPopover.toggleButton', 5000);
await testSubjects.click('xpack.uptime.openAlertContextPanel', 5000);
await testSubjects.click('xpack.uptime.alertsPopover.toggleButton');
await testSubjects.click('xpack.uptime.openAlertContextPanel');
if (alertType === 'monitorStatus') {
await testSubjects.click('xpack.uptime.toggleAlertFlyout', 5000);
await testSubjects.click('xpack.uptime.toggleAlertFlyout');
} else if (alertType === 'tls') {
await testSubjects.click('xpack.uptime.toggleTlsAlertFlyout');
}
// ensure the flyout has opened
await testSubjects.exists('alertNameInput');
},
async openMonitorStatusAlertType(alertType: string) {
return testSubjects.click(`xpack.uptime.alerts.${alertType}-SelectOption`, 5000);
await testSubjects.click(`xpack.uptime.alerts.${alertType}-SelectOption`);
},
async setAlertTags(tags: string[]) {
for (let i = 0; i < tags.length; i += 1) {
await testSubjects.click('comboBoxSearchInput', 5000);
await testSubjects.click('comboBoxSearchInput');
await testSubjects.setValue('comboBoxInput', tags[i]);
await browser.pressKeys(browser.keys.ENTER);
}
},
async setAlertName(name: string) {
return testSubjects.setValue('alertNameInput', name);
await testSubjects.setValue('alertNameInput', name);
},
async setAlertInterval(value: string) {
return testSubjects.setValue('intervalInput', value);
await testSubjects.setValue('intervalInput', value);
},
async setAlertThrottleInterval(value: string) {
await testSubjects.click('notifyWhenSelect');
await testSubjects.click('onThrottleInterval');
return testSubjects.setValue('throttleInput', value);
await testSubjects.setValue('throttleInput', value);
},
async setAlertExpressionValue(
expressionAttribute: string,
Expand All @@ -50,17 +52,17 @@ export function UptimeAlertsProvider({ getService }: FtrProviderContext) {
) {
await testSubjects.click(expressionAttribute);
await testSubjects.setValue(fieldAttribute, value);
return await testSubjects.click(expressionAttribute);
await testSubjects.click(expressionAttribute);
},
async setAlertStatusNumTimes(value: string) {
return this.setAlertExpressionValue(
await this.setAlertExpressionValue(
'xpack.uptime.alerts.monitorStatus.numTimesExpression',
'xpack.uptime.alerts.monitorStatus.numTimesField',
value
);
},
async setAlertTimerangeSelection(value: string) {
return this.setAlertExpressionValue(
await this.setAlertExpressionValue(
'xpack.uptime.alerts.monitorStatus.timerangeValueExpression',
'xpack.uptime.alerts.monitorStatus.timerangeValueField',
value
Expand All @@ -71,15 +73,15 @@ export function UptimeAlertsProvider({ getService }: FtrProviderContext) {
selectableAttribute: string,
optionAttributes: string[]
) {
await testSubjects.click(expressionAttribute, 5000);
await testSubjects.click(selectableAttribute, 5000);
await testSubjects.click(expressionAttribute);
await testSubjects.click(selectableAttribute);
for (let i = 0; i < optionAttributes.length; i += 1) {
await testSubjects.click(optionAttributes[i], 5000);
await testSubjects.click(optionAttributes[i]);
}
return testSubjects.click(expressionAttribute, 5000);
await testSubjects.click(expressionAttribute);
},
async setMonitorStatusSelectableToHours() {
return this.setAlertExpressionSelectable(
await this.setAlertExpressionSelectable(
'xpack.uptime.alerts.monitorStatus.timerangeUnitExpression',
'xpack.uptime.alerts.monitorStatus.timerangeUnitSelectable',
['xpack.uptime.alerts.monitorStatus.timerangeUnitSelectable.hoursOption']
Expand Down Expand Up @@ -108,18 +110,18 @@ export function UptimeAlertsProvider({ getService }: FtrProviderContext) {
async clickPortExpression(filter: string) {
await testSubjects.click('uptimeCreateStatusAlert.filter_port');
await testSubjects.click(`filter-popover-item_${filter}`);
return find.clickByCssSelector('body');
await find.clickByCssSelector('body');
},
async clickTypeExpression(filter: string) {
await testSubjects.click('uptimeCreateStatusAlert.filter_scheme');
await testSubjects.click(`filter-popover-item_${filter}`);
return find.clickByCssSelector('body');
await find.clickByCssSelector('body');
},
async clickSaveAlertButton() {
return testSubjects.click('saveAlertButton');
await testSubjects.click('saveAlertButton');
},
async clickSaveAlertsConfirmButton() {
return testSubjects.click('confirmAlertSaveModal > confirmModalConfirmButton');
await testSubjects.click('confirmAlertSaveModal > confirmModalConfirmButton', 20000);
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { delay } from 'bluebird';
import { FtrProviderContext } from '../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
// FLAKY: https://github.com/elastic/kibana/issues/101984
describe.skip('uptime alerts', () => {
describe('uptime alerts', () => {
const pageObjects = getPageObjects(['common', 'uptime']);
const supertest = getService('supertest');
const retry = getService('retry');
Expand Down

0 comments on commit 9b7b838

Please sign in to comment.