diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.test.tsx
new file mode 100644
index 000000000000..1dda204c8d6b
--- /dev/null
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CreateEditCustomLinkFlyout/DeleteButton.test.tsx
@@ -0,0 +1,29 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+import { fireEvent, render } from '@testing-library/react';
+import React from 'react';
+import { act } from 'react-dom/test-utils';
+import { MockApmPluginContextWrapper } from '../../../../../../context/apm_plugin/mock_apm_plugin_context';
+import * as apmApi from '../../../../../../services/rest/createCallApmApi';
+import { DeleteButton } from './DeleteButton';
+
+describe('Delete custom link', () => {
+ beforeAll(() => {
+ jest.spyOn(apmApi, 'callApmApi').mockResolvedValue({});
+ });
+ it('deletes a custom link', async () => {
+ const onDeleteMock = jest.fn();
+ const { getByText } = render(
+
+
+
+ );
+ await act(async () => {
+ fireEvent.click(getByText('Delete'));
+ });
+ expect(onDeleteMock).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
index 63dd48654412..c476686595b3 100644
--- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
+++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx
@@ -4,12 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import {
- fireEvent,
- render,
- RenderResult,
- waitFor,
-} from '@testing-library/react';
+import { fireEvent, render, RenderResult } from '@testing-library/react';
import React from 'react';
import { act } from 'react-dom/test-utils';
import { CustomLinkOverview } from '.';
@@ -219,31 +214,6 @@ describe('CustomLink', () => {
expect(saveCustomLinkSpy).toHaveBeenCalledTimes(1);
});
- // FLAKY: https://github.com/elastic/kibana/issues/75106
- it.skip('deletes a custom link', async () => {
- const mockContext = getMockAPMContext({ canSave: true });
- const component = render(
-
-
-
-
-
- );
- expect(component.queryByText('Create link')).not.toBeInTheDocument();
- const editButtons = component.getAllByLabelText('Edit');
- expect(editButtons.length).toEqual(2);
- act(() => {
- fireEvent.click(editButtons[0]);
- });
- await waitFor(() =>
- expect(component.queryByText('Create link')).toBeInTheDocument()
- );
- await act(async () => {
- fireEvent.click(component.getByText('Delete'));
- });
- expect(refetch).toHaveBeenCalled();
- });
-
describe('Filters', () => {
const addFilterField = (component: RenderResult, amount: number) => {
for (let i = 1; i <= amount; i++) {