Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Apr 16, 2021
1 parent b293c2e commit d2849b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const SyntheticsCallout = () => {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
data-test-subj="uptimeDismissSyntheticsCallout"
onClick={() => {
if (shouldShow) {
hideSyntheticsCallout();
Expand Down
45 changes: 27 additions & 18 deletions x-pack/test/functional_with_es_ssl/apps/uptime/simple_down_alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const uptimeService = getService('uptime');
const retry = getService('retry');
const supertest = getService('supertest');
const toasts = getService('toasts');

const testSubjects = getService('testSubjects');

Expand Down Expand Up @@ -46,6 +47,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

it('displays to define default connector', async () => {
await testSubjects.click('uptimeDismissSyntheticsCallout');
await hideErrorToast();
await testSubjects.click('uptimeDisplayDefineConnector');
await testSubjects.existOrFail('uptimeSettingsDefineConnector');
Expand All @@ -71,6 +73,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

it('displays relevant alert in list drawer', async () => {
await toasts.dismissAllToasts();

await testSubjects.click(`xpack.uptime.monitorList.${monitorId}.expandMonitorDetail`);
await pageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.existOrFail('uptimeMonitorListDrawerAlert0');
Expand All @@ -87,25 +91,30 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
alert = alertsFromThisTest[0];
});

const { actions, alertTypeId, consumer, id, tags } = alert ?? {};
try {
expect(actions).to.eql([
{
actionTypeId: '.slack',
group: 'xpack.uptime.alerts.actionGroups.monitorStatus',
id: 'my-slack1',
params: {
message:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} is {{state.statusMessage}} from {{state.observerLocation}}. The latest error message is {{{state.latestErrorMessage}}}',
},
const { actions, alertTypeId, consumer, tags } = alert ?? {};
expect(actions).to.eql([
{
actionTypeId: '.slack',
group: 'recovered',
params: {
message:
'Monitor 0000-intermittent with url http://localhost:5678/pattern?r=200x5,500x1 has recovered with status Up',
},
]);
expect(alertTypeId).to.eql('xpack.uptime.alerts.monitorStatus');
expect(consumer).to.eql('uptime');
expect(tags).to.eql(['UPTIME_AUTO']);
} catch (e) {
await supertest.delete(`/api/alerts/alert/${id}`).set('kbn-xsrf', 'true').expect(204);
}
id: 'my-slack1',
},
{
actionTypeId: '.slack',
group: 'xpack.uptime.alerts.actionGroups.monitorStatus',
params: {
message:
'Monitor {{state.monitorName}} with url {{{state.monitorUrl}}} is {{state.statusMessage}} from {{state.observerLocation}}. The latest error message is {{{state.latestErrorMessage}}}',
},
id: 'my-slack1',
},
]);
expect(alertTypeId).to.eql('xpack.uptime.alerts.monitorStatus');
expect(consumer).to.eql('uptime');
expect(tags).to.eql(['UPTIME_AUTO']);
});

it('disable simple status alert', async () => {
Expand Down

0 comments on commit d2849b4

Please sign in to comment.