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

[ML] Functional tests - stabilize alerting flyout test #102030

Merged
merged 1 commit into from
Jun 14, 2021
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
4 changes: 2 additions & 2 deletions x-pack/test/functional/services/ml/alerting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export function MachineLearningAlertingProvider(
await this.assertPreviewCalloutVisible();
},

async checkPreview(expectedMessage: string) {
async checkPreview(expectedMessagePattern: RegExp) {
await this.clickPreviewButton();
const previewMessage = await testSubjects.getVisibleText('mlAnomalyAlertPreviewMessage');
expect(previewMessage).to.eql(expectedMessage);
expect(previewMessage).to.match(expectedMessagePattern);
},

async assertPreviewCalloutVisible() {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/services/ml/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
},

async waitForDatafeedToNotExist(datafeedId: string) {
await retry.waitForWithTimeout(`'${datafeedId}' to exist`, 5 * 1000, async () => {
await retry.waitForWithTimeout(`'${datafeedId}' to not exist`, 5 * 1000, async () => {
if ((await this.datafeedExist(datafeedId)) === false) {
return true;
} else {
Expand Down
8 changes: 5 additions & 3 deletions x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

let testJobId = '';

// Failing: See https://github.com/elastic/kibana/issues/102012
describe.skip('anomaly detection alert', function () {
describe('anomaly detection alert', function () {
this.tags('ciGroup13');

before(async () => {
Expand All @@ -93,6 +92,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

after(async () => {
await ml.api.deleteAnomalyDetectionJobES(testJobId);
await ml.api.cleanMlIndices();
await ml.alerting.cleanAnomalyDetectionRules();
});
Expand Down Expand Up @@ -120,7 +120,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await ml.alerting.assertPreviewButtonState(false);
await ml.alerting.setTestInterval('2y');
await ml.alerting.assertPreviewButtonState(true);
await ml.alerting.checkPreview('Found 13 anomalies in the last 2y.');

// don't check the exact number provided by the backend, just make sure it's > 0
await ml.alerting.checkPreview(/Found [1-9]\d* anomalies in the last 2y/);

await ml.testExecution.logTestStep('should create an alert');
await pageObjects.triggersActionsUI.setAlertName('ml-test-alert');
Expand Down