From 9c55702661f62e4e21a112aa89061af9a24bd1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milorad=20FIlipovi=C4=87?= Date: Fri, 3 Nov 2023 09:56:19 +0100 Subject: [PATCH] fix(editor): Fix flaky ResourceMapper unit tests (no-changelog) (#7593) Github issue / Community forum post (link here to close automatically): --- .../src/components/__tests__/ResourceMapper.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/editor-ui/src/components/__tests__/ResourceMapper.test.ts b/packages/editor-ui/src/components/__tests__/ResourceMapper.test.ts index 340de546fd..762f333bba 100644 --- a/packages/editor-ui/src/components/__tests__/ResourceMapper.test.ts +++ b/packages/editor-ui/src/components/__tests__/ResourceMapper.test.ts @@ -109,6 +109,7 @@ describe('ResourceMapper.vue', () => { }); it('renders field on top of the list when they are selected for matching', async () => { + const user = userEvent.setup(); const { container, getByTestId } = renderComponent( { props: { @@ -130,14 +131,15 @@ describe('ResourceMapper.vue', () => { // Id should be the first field in the list expect(container.querySelector('.parameter-item')).toContainHTML('id (using to match)'); // Select Last Name as matching column - await userEvent.click(getByTestId('matching-column-option-Last name')); + await user.click(getByTestId('matching-column-option-Last name')); // Now, last name should be the first field in the list - expect(container.querySelector('.parameter-item div.title')).toHaveTextContent( + expect(container.querySelector('.parameter-item div.title')).toHaveTextContent( 'Last name (using to match)', ); - }); + }, 10000); it('renders selected matching columns properly when multiple key matching is enabled', async () => { + const user = userEvent.setup(); const { getByTestId, getAllByText, queryByText } = renderComponent( { props: { @@ -156,7 +158,7 @@ describe('ResourceMapper.vue', () => { ); await waitAllPromises(); expect(getByTestId('resource-mapper-container')).toBeInTheDocument(); - await userEvent.click(getByTestId('matching-column-option-Username')); + await user.click(getByTestId('matching-column-option-Username')); // Both matching columns (id and Username) should be rendered in the dropdown expect(