From 37d40d7343510a6eb5457ad123b700882f46f627 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Mon, 23 May 2022 04:56:34 -0400 Subject: [PATCH] [Synthetics] fix browser type as default in monitor management (#132572) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../synthetics/e2e/journeys/monitor_details.journey.ts | 4 ++-- .../synthetics/e2e/journeys/monitor_name.journey.ts | 8 ++++---- .../synthetics/e2e/page_objects/monitor_management.tsx | 1 + .../fleet_package/contexts/policy_config_context.tsx | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts index 192fcf06c3095..3ddf0cebd0cf3 100644 --- a/x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts +++ b/x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts @@ -40,12 +40,12 @@ journey('MonitorDetails', async ({ page, params }: { page: Page; params: any }) step('create basic monitor', async () => { await uptime.enableMonitorManagement(); await uptime.clickAddMonitor(); - await uptime.createBasicMonitorDetails({ + await uptime.createBasicHTTPMonitorDetails({ name, locations: ['US Central'], apmServiceName: 'synthetics', + url: 'https://www.google.com', }); - await uptime.fillByTestSubj('syntheticsUrlField', 'https://www.google.com'); await uptime.confirmAndSave(); }); diff --git a/x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts index a21627548aeb1..a9dd2c4633402 100644 --- a/x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts +++ b/x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts @@ -21,12 +21,12 @@ journey(`MonitorName`, async ({ page, params }: { page: Page; params: any }) => const uptime = monitorManagementPageProvider({ page, kibanaUrl: params.kibanaUrl }); const createBasicMonitor = async () => { - await uptime.createBasicMonitorDetails({ + await uptime.createBasicHTTPMonitorDetails({ name, locations: ['US Central'], apmServiceName: 'synthetics', + url: 'https://www.google.com', }); - await uptime.fillByTestSubj('syntheticsUrlField', 'https://www.google.com'); }; before(async () => { @@ -52,12 +52,12 @@ journey(`MonitorName`, async ({ page, params }: { page: Page; params: any }) => step(`shows error if name already exists`, async () => { await uptime.navigateToAddMonitor(); - await uptime.createBasicMonitorDetails({ + await uptime.createBasicHTTPMonitorDetails({ name, locations: ['US Central'], apmServiceName: 'synthetics', + url: 'https://www.google.com', }); - await uptime.fillByTestSubj('syntheticsUrlField', 'https://www.google.com'); await uptime.assertText({ text: 'Monitor name already exists.' }); diff --git a/x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx b/x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx index eb13c3678f47e..91d8151c29701 100644 --- a/x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx +++ b/x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx @@ -189,6 +189,7 @@ export function monitorManagementPageProvider({ apmServiceName: string; locations: string[]; }) { + await this.selectMonitorType('http'); await this.createBasicMonitorDetails({ name, apmServiceName, locations }); await this.fillByTestSubj('syntheticsUrlField', url); }, diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx index a9cdc2c78d86d..99419e2ca9145 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx @@ -121,10 +121,10 @@ export function PolicyConfigContextProvider({ const isAddMonitorRoute = useRouteMatch(MONITOR_ADD_ROUTE); useEffect(() => { - if (isAddMonitorRoute) { + if (isAddMonitorRoute?.isExact) { setMonitorType(DataStream.BROWSER); } - }, [isAddMonitorRoute]); + }, [isAddMonitorRoute?.isExact]); const value = useMemo(() => { return {