Fix Bazza UI Filter Tests - Comprehensive Test Improvements#75
Conversation
- Add navigation role and aria-label to DataTablePagination component - Enable pagination prop on both server-side and client-side DataTable components - Fix pageCount calculation for client-side filtering - Add proper aria-labels to pagination buttons for better accessibility This fixes the failing tests that were looking for pagination controls with role='navigation'.
… approaches - Import screen from @storybook/test for portal content - Increase wait time for filter value controller to render - Try multiple approaches to find Todo option (text, role, content matcher) - Fix pagination and sorting handlers to use setSearchParams - Add better error handling for filter option selection Still investigating why filter dropdown options are not being found in tests.
|
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
There was a problem hiding this comment.
I think adding the following decorator to SimpleFilterTest will help it render
decorators: [
withReactRouterStubDecorator({
routes: [
{
path: '/',
Component: SimpleDataTableFilterTest,
},
],
}),
],
I'll review adding the decorator to SimpleFilterTest! 🔍
- Added withReactRouterStubDecorator to SimpleFilterTest story to fix useLocation() error - Defined testSimpleFilter function that was missing - Added proper routing configuration for SimpleDataTableFilterTest component This should resolve the 'useLocation() may be used only in the context of a <Router> component' error and the 'testSimpleFilter is not defined' error.
|
Perfect suggestion! 🎯 I've added the React Router decorator to the SimpleFilterTest story as you recommended. This should fix the "useLocation() may be used only in the context of a component" error. Changes made:
The decorator setup you suggested: decorators: [
withReactRouterStubDecorator({
routes: [
{
path: '/',
Component: SimpleDataTableFilterTest,
},
],
}),
],This should resolve the Router context issue and allow the SimpleFilterTest to run properly. The changes have been pushed to the existing PR #75. 🔄 Updated PR #75 with your suggested fix! 💻 View my work • React 👍 or 👎 |
Overview
This PR addresses test failures in the Bazza UI filter tests by implementing comprehensive fixes and improvements based on cursor rules and best practices.
Changes Made
✅ Fixed Issues
setSearchParamsconsistently🔧 Test Improvements
screenimport from@storybook/testto handle portal-rendered content📋 Current Status
🔍 Remaining Investigation
The filter dropdown tests are still failing because the "Todo" option cannot be found. This appears to be related to:
🎯 Next Steps
Testing
References
.cursor/rules/storybook-testing.mdcdropdown-menu-select.stories.tsx💻 View my work • About Codegen