From 50e20f9f098e7817a51d8f676d2805555f7cd22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cintia=20S=C3=A1nchez=20Garc=C3=ADa?= Date: Tue, 10 May 2022 09:41:12 +0200 Subject: [PATCH] Fix frontend unit test (#1958) Signed-off-by: Cintia Sanchez Garcia --- .../settings/orgSettings/authorization/index.test.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/src/layout/controlPanel/settings/orgSettings/authorization/index.test.tsx b/web/src/layout/controlPanel/settings/orgSettings/authorization/index.test.tsx index b40d39cf9..717cefc39 100644 --- a/web/src/layout/controlPanel/settings/orgSettings/authorization/index.test.tsx +++ b/web/src/layout/controlPanel/settings/orgSettings/authorization/index.test.tsx @@ -460,11 +460,9 @@ describe('Authorization settings index', () => { expect(API.getAllOrganizationMembers).toHaveBeenCalledWith('orgTest'); }); - const switchBtn = await screen.findByText('Fine-grained access control'); - await userEvent.click(switchBtn); + await userEvent.click(await screen.findByText('Fine-grained access control')); - const btn = await screen.findByRole('button', { name: 'Update authorization policy' }); - await userEvent.click(btn); + await userEvent.click(await screen.findByRole('button', { name: 'Update authorization policy' })); rerender(component); @@ -482,9 +480,7 @@ describe('Authorization settings index', () => { await screen.findByText('You do not have permissions to update the policy from the organization.') ).toBeInTheDocument(); - waitFor(() => { - expect(switchBtn).toBeDisabled(); - }); + expect(await screen.findByRole('switch')).toBeDisabled(); }); it('Custom error', async () => {