diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx
index 51585e227b56e..1306308f8ba4e 100644
--- a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx
+++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx
@@ -9,7 +9,7 @@ import React, { memo, useContext, useEffect } from 'react';
import useDebounce from 'react-use/lib/useDebounce';
import { PackagePolicyCreateExtensionComponentProps } from '../../../../fleet/public';
import { useTrackPageview } from '../../../../observability/public';
-import { Config, ConfigKeys } from './types';
+import { Config, ConfigKeys, DataStream } from './types';
import {
SimpleFieldsContext,
HTTPAdvancedFieldsContext,
@@ -63,6 +63,11 @@ export const SyntheticsPolicyCreateExtension = memo', () => {
});
});
- it('handles updating each field', async () => {
+ it('handles updating fields', async () => {
const { getByLabelText } = render();
const url = getByLabelText('URL') as HTMLInputElement;
const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement;
@@ -336,6 +336,54 @@ describe('', () => {
expect(apmServiceName.value).toEqual('APM Service');
expect(maxRedirects.value).toEqual('2');
expect(timeout.value).toEqual('3');
+
+ await waitFor(() => {
+ expect(onChange).toBeCalledWith({
+ isValid: true,
+ updatedPolicy: {
+ ...defaultNewPolicy,
+ inputs: [
+ {
+ ...defaultNewPolicy.inputs[0],
+ streams: [
+ {
+ ...defaultNewPolicy.inputs[0].streams[0],
+ vars: {
+ ...defaultNewPolicy.inputs[0].streams[0].vars,
+ urls: {
+ value: 'http://elastic.co',
+ type: 'text',
+ },
+ proxy_url: {
+ value: 'http://proxy.co',
+ type: 'text',
+ },
+ schedule: {
+ value: '"@every 1m"',
+ type: 'text',
+ },
+ 'service.name': {
+ value: 'APM Service',
+ type: 'text',
+ },
+ max_redirects: {
+ value: '2',
+ type: 'integer',
+ },
+ timeout: {
+ value: '3s',
+ type: 'text',
+ },
+ },
+ },
+ ],
+ },
+ defaultNewPolicy.inputs[1],
+ defaultNewPolicy.inputs[2],
+ ],
+ },
+ });
+ });
});
it('handles calling onChange', async () => {
diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx
index 386d99add87b6..e29a5c6a363ed 100644
--- a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx
+++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx
@@ -15,7 +15,7 @@ import {
TCPAdvancedFieldsContext,
TLSFieldsContext,
} from './contexts';
-import { Config, ConfigKeys } from './types';
+import { Config, ConfigKeys, DataStream } from './types';
import { CustomFields } from './custom_fields';
import { useUpdatePolicy } from './use_update_policy';
import { validate } from './validation';
@@ -48,6 +48,11 @@ export const SyntheticsPolicyEditExtension = memo', () => {
expect(queryByLabelText('Monitor type')).not.toBeInTheDocument();
});
- it('handles updating each field', async () => {
+ it('handles updating fields', async () => {
const { getByLabelText } = render();
const url = getByLabelText('URL') as HTMLInputElement;
const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement;
@@ -364,6 +364,54 @@ describe('', () => {
expect(apmServiceName.value).toEqual('APM Service');
expect(maxRedirects.value).toEqual('2');
expect(timeout.value).toEqual('3');
+
+ await waitFor(() => {
+ expect(onChange).toBeCalledWith({
+ isValid: true,
+ updatedPolicy: {
+ ...defaultNewPolicy,
+ inputs: [
+ {
+ ...defaultNewPolicy.inputs[0],
+ streams: [
+ {
+ ...defaultNewPolicy.inputs[0].streams[0],
+ vars: {
+ ...defaultNewPolicy.inputs[0].streams[0].vars,
+ urls: {
+ value: 'http://elastic.co',
+ type: 'text',
+ },
+ proxy_url: {
+ value: 'http://proxy.co',
+ type: 'text',
+ },
+ schedule: {
+ value: '"@every 1m"',
+ type: 'text',
+ },
+ 'service.name': {
+ value: 'APM Service',
+ type: 'text',
+ },
+ max_redirects: {
+ value: '2',
+ type: 'integer',
+ },
+ timeout: {
+ value: '3s',
+ type: 'text',
+ },
+ },
+ },
+ ],
+ },
+ defaultNewPolicy.inputs[1],
+ defaultNewPolicy.inputs[2],
+ ],
+ },
+ });
+ });
});
it('handles calling onChange', async () => {