From 76166919393a0062677844659c87aa3281caa8a2 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Mon, 18 Aug 2025 15:47:58 +0000 Subject: [PATCH] fix(tests): resolve issues with webdav scan failure testing --- .../Labels/__tests__/LabelCreateDialog.test.tsx | 8 +++++--- .../SourceErrors/__tests__/FailureDetailsPanel.test.tsx | 2 +- .../__tests__/FailureDetailsPanel.test.tsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Labels/__tests__/LabelCreateDialog.test.tsx b/frontend/src/components/Labels/__tests__/LabelCreateDialog.test.tsx index 9c9bd11..84ceee1 100644 --- a/frontend/src/components/Labels/__tests__/LabelCreateDialog.test.tsx +++ b/frontend/src/components/Labels/__tests__/LabelCreateDialog.test.tsx @@ -436,9 +436,11 @@ describe('LabelCreateDialog Component', () => { const createButton = screen.getByText('Create'); await user.click(createButton); - // Try to close during loading - should be disabled due to pointer-events: none - const cancelButton = screen.getByText('Cancel'); - expect(cancelButton).toBeDisabled(); + // Wait for loading state to be set and check Cancel button is disabled + await waitFor(() => { + const cancelButton = screen.getByText('Cancel'); + expect(cancelButton).toBeDisabled(); + }); expect(onClose).not.toHaveBeenCalled(); diff --git a/frontend/src/components/SourceErrors/__tests__/FailureDetailsPanel.test.tsx b/frontend/src/components/SourceErrors/__tests__/FailureDetailsPanel.test.tsx index 67809f3..fa6ba09 100644 --- a/frontend/src/components/SourceErrors/__tests__/FailureDetailsPanel.test.tsx +++ b/frontend/src/components/SourceErrors/__tests__/FailureDetailsPanel.test.tsx @@ -241,7 +241,7 @@ describe('FailureDetailsPanel', () => { const notesInput = screen.getByLabelText('Notes (optional)'); await userEvent.type(notesInput, 'Path too long to fix easily'); - const permanentSwitch = screen.getByRole('checkbox'); + const permanentSwitch = screen.getByLabelText('Permanently exclude (recommended)'); await userEvent.click(permanentSwitch); // Toggle off await userEvent.click(permanentSwitch); // Toggle back on diff --git a/frontend/src/components/WebDAVScanFailures/__tests__/FailureDetailsPanel.test.tsx b/frontend/src/components/WebDAVScanFailures/__tests__/FailureDetailsPanel.test.tsx index 3033b73..1fcce7f 100644 --- a/frontend/src/components/WebDAVScanFailures/__tests__/FailureDetailsPanel.test.tsx +++ b/frontend/src/components/WebDAVScanFailures/__tests__/FailureDetailsPanel.test.tsx @@ -236,7 +236,7 @@ describe('FailureDetailsPanel', () => { const notesInput = screen.getByLabelText('Notes (optional)'); await userEvent.type(notesInput, 'Path too long to fix easily'); - const permanentSwitch = screen.getByRole('checkbox'); + const permanentSwitch = screen.getByLabelText('Permanently exclude (recommended)'); await userEvent.click(permanentSwitch); // Toggle off await userEvent.click(permanentSwitch); // Toggle back on