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 @@ -5,17 +5,14 @@
* 2.0.
*/

import { journey, step, before, after, expect } from '@elastic/synthetics';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { journey, step, before, after } from '@elastic/synthetics';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics_app';
import { SyntheticsServices } from '../services/synthetics_services';

journey(`CustomStatusAlert`, async ({ page, params }) => {
const syntheticsApp = syntheticsAppPageProvider({ page, kibanaUrl: params.kibanaUrl, params });

const services = new SyntheticsServices(params);
const getService = params.getService;
const retry: RetryService = getService('retry');

const firstCheckTime = new Date(Date.now()).toISOString();

Expand Down Expand Up @@ -60,19 +57,7 @@ journey(`CustomStatusAlert`, async ({ page, params }) => {
});

step('verify rule creation', async () => {
await retry.try(async () => {
const rules = await services.getRules();
expect(rules.length).toBe(3);
expect(rules[2].params).toStrictEqual({
condition: {
downThreshold: 3,
locationsThreshold: 1,
groupBy: 'locationId',
window: {
numberOfChecks: 5,
},
},
});
});
await syntheticsApp.goToRulesPage();
await page.waitForSelector(`text='Synthetics status rule'`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,6 @@ export class SyntheticsServices {
}
}

async getRules() {
const response = await axios.get(this.kibanaUrl + '/internal/alerting/rules/_find', {
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
});
return response.data.data;
}

async setupTestConnector() {
const indexConnector = {
name: 'test index',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,5 +393,10 @@ export function syntheticsAppPageProvider({
const isDisabled = await addMonitorBtn.isDisabled();
return !isDisabled;
},

async goToRulesPage() {
const rulesPage = '/app/observability/alerts/rules';
await page.goto(basePath + rulesPage);
},
};
}