From d2849b456fac2be0b3a575878c2fa2ed103a52b8 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Fri, 16 Apr 2021 19:31:53 +0200 Subject: [PATCH] update test --- .../overview/synthetics_callout.tsx | 1 + .../apps/uptime/simple_down_alert.ts | 45 +++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx b/x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx index 2772631363794..fa28e42d7d0c1 100644 --- a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx +++ b/x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx @@ -58,6 +58,7 @@ export const SyntheticsCallout = () => { { if (shouldShow) { hideSyntheticsCallout(); diff --git a/x-pack/test/functional_with_es_ssl/apps/uptime/simple_down_alert.ts b/x-pack/test/functional_with_es_ssl/apps/uptime/simple_down_alert.ts index b15ce33148fdd..52e602989afd3 100644 --- a/x-pack/test/functional_with_es_ssl/apps/uptime/simple_down_alert.ts +++ b/x-pack/test/functional_with_es_ssl/apps/uptime/simple_down_alert.ts @@ -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'); @@ -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'); @@ -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'); @@ -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 () => {