fix(tests): resolve issue in languageselector component for frontend tests

This commit is contained in:
perf3ct 2025-07-18 20:39:41 +00:00
parent 0f5f2fdd6e
commit 65404a7cf9
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 20 additions and 15 deletions

View File

@ -81,11 +81,8 @@ describe('LanguageSelector Component', () => {
// Open dropdown
await user.click(screen.getByText('Select OCR languages...'));
// Select English from the dropdown
const englishButton = screen.getByText('English').closest('button');
if (englishButton) {
await user.click(englishButton);
}
// Select English from the dropdown - click on the language text directly
await user.click(screen.getByText('English'));
expect(mockOnChange).toHaveBeenCalledWith(['eng'], 'eng');
});
@ -216,10 +213,7 @@ describe('LanguageSelector Component', () => {
// Open dropdown and select English
await user.click(screen.getByText('Select OCR languages...'));
const englishButton = screen.getByText('English').closest('button');
if (englishButton) {
await user.click(englishButton);
}
await user.click(screen.getByText('English'));
expect(mockOnChange).toHaveBeenCalledWith(['eng'], 'eng');
});

View File

@ -459,7 +459,9 @@ startxref
error_msg.contains("extraction") ||
error_msg.contains("InputFileError") ||
error_msg.contains("Failed to extract") ||
error_msg.contains("All PDF extraction strategies failed")
error_msg.contains("All PDF extraction strategies failed") ||
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available")
);
}
}
@ -528,7 +530,9 @@ startxref
error_msg.contains("extract") ||
error_msg.contains("PDF") ||
error_msg.contains("Failed to extract") ||
error_msg.contains("All PDF extraction strategies failed")
error_msg.contains("All PDF extraction strategies failed") ||
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available")
);
}
}
@ -557,7 +561,9 @@ startxref
error_msg.contains("font") ||
error_msg.contains("encoding") ||
error_msg.contains("extract") ||
error_msg.contains("All PDF extraction strategies failed")
error_msg.contains("All PDF extraction strategies failed") ||
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available")
);
}
}
@ -594,7 +600,9 @@ This tests the error handling for files that aren't actually PDFs.";
error_msg.contains("PDF") ||
error_msg.contains("format") ||
error_msg.contains("Failed to extract") ||
error_msg.contains("All PDF extraction strategies failed")
error_msg.contains("All PDF extraction strategies failed") ||
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available")
);
}
}
@ -621,7 +629,9 @@ This tests the error handling for files that aren't actually PDFs.";
error_msg.contains("ocrmypdf") ||
error_msg.contains("extraction") ||
error_msg.contains("strategies") ||
error_msg.contains("Failed to extract")
error_msg.contains("Failed to extract") ||
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available")
);
}
}
@ -724,7 +734,8 @@ This tests the error handling for files that aren't actually PDFs.";
error_msg.contains("corrupted") ||
error_msg.contains("encoding") ||
error_msg.contains("All PDF extraction strategies failed") ||
error_msg.contains("No such file or directory"),
error_msg.contains("No such file or directory") ||
error_msg.contains("ocrmypdf is not available"),
"Error message should be descriptive for {}: {}", test_file_owned, error_msg
);
}