diff --git a/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx b/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx
index 1fed1d90689b..990d44584cf0 100644
--- a/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx
+++ b/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx
@@ -47,6 +47,7 @@ describe('ConfigureCases', () => {
iconClass: 'logoSecurity',
});
});
+
beforeEach(() => {
useActionTypesMock.mockImplementation(() => useActionTypesResponse);
});
@@ -451,150 +452,149 @@ describe('ConfigureCases', () => {
).toBe('Update My Connector 2');
});
});
-});
-// Failing: See https://github.com/elastic/kibana/issues/115366
-describe.skip('closure options', () => {
- let wrapper: ReactWrapper;
- let persistCaseConfigure: jest.Mock;
+ describe('closure options', () => {
+ let wrapper: ReactWrapper;
+ let persistCaseConfigure: jest.Mock;
- beforeEach(() => {
- persistCaseConfigure = jest.fn();
- useCaseConfigureMock.mockImplementation(() => ({
- ...useCaseConfigureResponse,
- mapping: null,
- closureType: 'close-by-user',
- connector: {
- id: 'servicenow-1',
- name: 'My connector',
- type: ConnectorTypes.serviceNowITSM,
- fields: null,
- },
- currentConfiguration: {
- connector: {
- id: 'My connector',
- name: 'My connector',
- type: ConnectorTypes.jira,
- fields: null,
- },
+ beforeEach(() => {
+ persistCaseConfigure = jest.fn();
+ useCaseConfigureMock.mockImplementation(() => ({
+ ...useCaseConfigureResponse,
+ mapping: null,
closureType: 'close-by-user',
- },
- persistCaseConfigure,
- }));
- useConnectorsMock.mockImplementation(() => useConnectorsResponse);
- useGetUrlSearchMock.mockImplementation(() => searchURL);
-
- wrapper = mount(, {
- wrappingComponent: TestProviders,
- });
- });
-
- test('it submits the configuration correctly when changing closure type', () => {
- wrapper.find('input[id="close-by-pushing"]').simulate('change');
- wrapper.update();
-
- expect(persistCaseConfigure).toHaveBeenCalled();
- expect(persistCaseConfigure).toHaveBeenCalledWith({
- connector: {
- id: 'servicenow-1',
- name: 'My connector',
- type: ConnectorTypes.serviceNowITSM,
- fields: null,
- },
- closureType: 'close-by-pushing',
- });
- });
-});
-
-describe('user interactions', () => {
- beforeEach(() => {
- useCaseConfigureMock.mockImplementation(() => ({
- ...useCaseConfigureResponse,
- mapping: null,
- closureType: 'close-by-user',
- connector: {
- id: 'resilient-2',
- name: 'unchanged',
- type: ConnectorTypes.resilient,
- fields: null,
- },
- currentConfiguration: {
connector: {
- id: 'resilient-2',
- name: 'unchanged',
+ id: 'servicenow-1',
+ name: 'My connector',
type: ConnectorTypes.serviceNowITSM,
fields: null,
},
+ currentConfiguration: {
+ connector: {
+ id: 'My connector',
+ name: 'My connector',
+ type: ConnectorTypes.jira,
+ fields: null,
+ },
+ closureType: 'close-by-user',
+ },
+ persistCaseConfigure,
+ }));
+ useConnectorsMock.mockImplementation(() => useConnectorsResponse);
+ useGetUrlSearchMock.mockImplementation(() => searchURL);
+
+ wrapper = mount(, {
+ wrappingComponent: TestProviders,
+ });
+ });
+
+ test('it submits the configuration correctly when changing closure type', () => {
+ wrapper.find('input[id="close-by-pushing"]').simulate('change');
+ wrapper.update();
+
+ expect(persistCaseConfigure).toHaveBeenCalled();
+ expect(persistCaseConfigure).toHaveBeenCalledWith({
+ connector: {
+ id: 'servicenow-1',
+ name: 'My connector',
+ type: ConnectorTypes.serviceNowITSM,
+ fields: null,
+ },
+ closureType: 'close-by-pushing',
+ });
+ });
+ });
+
+ describe('user interactions', () => {
+ beforeEach(() => {
+ useCaseConfigureMock.mockImplementation(() => ({
+ ...useCaseConfigureResponse,
+ mapping: null,
closureType: 'close-by-user',
- },
- }));
- useConnectorsMock.mockImplementation(() => useConnectorsResponse);
- useGetUrlSearchMock.mockImplementation(() => searchURL);
- });
-
- test('it show the add flyout when pressing the add connector button', async () => {
- const wrapper = mount(, {
- wrappingComponent: TestProviders,
+ connector: {
+ id: 'resilient-2',
+ name: 'unchanged',
+ type: ConnectorTypes.resilient,
+ fields: null,
+ },
+ currentConfiguration: {
+ connector: {
+ id: 'resilient-2',
+ name: 'unchanged',
+ type: ConnectorTypes.serviceNowITSM,
+ fields: null,
+ },
+ closureType: 'close-by-user',
+ },
+ }));
+ useConnectorsMock.mockImplementation(() => useConnectorsResponse);
+ useGetUrlSearchMock.mockImplementation(() => searchURL);
});
- wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
- wrapper.find('button[data-test-subj="dropdown-connector-add-connector"]').simulate('click');
+ test('it show the add flyout when pressing the add connector button', async () => {
+ const wrapper = mount(, {
+ wrappingComponent: TestProviders,
+ });
- await waitFor(() => {
- wrapper.update();
- expect(wrapper.find('ConnectorAddFlyout').exists()).toBe(true);
- expect(wrapper.find('ConnectorAddFlyout').prop('actionTypes')).toEqual([
- expect.objectContaining({
- id: '.servicenow',
- }),
- expect.objectContaining({
- id: '.jira',
- }),
- expect.objectContaining({
- id: '.resilient',
- }),
- expect.objectContaining({
- id: '.servicenow-sir',
- }),
- ]);
- });
- });
+ wrapper.find('button[data-test-subj="dropdown-connectors"]').simulate('click');
+ wrapper.find('button[data-test-subj="dropdown-connector-add-connector"]').simulate('click');
- test('it show the edit flyout when pressing the update connector button', async () => {
- const actionType = actionTypeRegistryMock.createMockActionTypeModel({
- id: '.resilient',
- validateConnector: () => {
- return Promise.resolve({});
- },
- validateParams: () => {
- const validationResult = { errors: {} };
- return Promise.resolve(validationResult);
- },
- actionConnectorFields: null,
+ await waitFor(() => {
+ wrapper.update();
+ expect(wrapper.find('ConnectorAddFlyout').exists()).toBe(true);
+ expect(wrapper.find('ConnectorAddFlyout').prop('actionTypes')).toEqual([
+ expect.objectContaining({
+ id: '.servicenow',
+ }),
+ expect.objectContaining({
+ id: '.jira',
+ }),
+ expect.objectContaining({
+ id: '.resilient',
+ }),
+ expect.objectContaining({
+ id: '.servicenow-sir',
+ }),
+ ]);
+ });
});
- useKibanaMock().services.triggersActionsUi.actionTypeRegistry.get = jest
- .fn()
- .mockReturnValue(actionType);
- useKibanaMock().services.triggersActionsUi.actionTypeRegistry.has = jest
- .fn()
- .mockReturnValue(true);
+ test('it show the edit flyout when pressing the update connector button', async () => {
+ const actionType = actionTypeRegistryMock.createMockActionTypeModel({
+ id: '.resilient',
+ validateConnector: () => {
+ return Promise.resolve({});
+ },
+ validateParams: () => {
+ const validationResult = { errors: {} };
+ return Promise.resolve(validationResult);
+ },
+ actionConnectorFields: null,
+ });
- const wrapper = mount(, {
- wrappingComponent: TestProviders,
+ useKibanaMock().services.triggersActionsUi.actionTypeRegistry.get = jest
+ .fn()
+ .mockReturnValue(actionType);
+ useKibanaMock().services.triggersActionsUi.actionTypeRegistry.has = jest
+ .fn()
+ .mockReturnValue(true);
+
+ const wrapper = mount(, {
+ wrappingComponent: TestProviders,
+ });
+ wrapper
+ .find('button[data-test-subj="case-configure-update-selected-connector-button"]')
+ .simulate('click');
+
+ await waitFor(() => {
+ wrapper.update();
+ expect(wrapper.find('ConnectorEditFlyout').exists()).toBe(true);
+ expect(wrapper.find('ConnectorEditFlyout').prop('initialConnector')).toEqual(connectors[1]);
+ });
+
+ expect(
+ wrapper.find('[data-test-subj="case-configure-action-bottom-bar"]').exists()
+ ).toBeFalsy();
});
- wrapper
- .find('button[data-test-subj="case-configure-update-selected-connector-button"]')
- .simulate('click');
-
- await waitFor(() => {
- wrapper.update();
- expect(wrapper.find('ConnectorEditFlyout').exists()).toBe(true);
- expect(wrapper.find('ConnectorEditFlyout').prop('initialConnector')).toEqual(connectors[1]);
- });
-
- expect(
- wrapper.find('[data-test-subj="case-configure-action-bottom-bar"]').exists()
- ).toBeFalsy();
});
});