Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughEnabled an additional Storybook feature flag and added extensive Help Panel search support: new SearchPanel stories, user-journey stories, OUIA attributes, and expanded MSW handlers to mock chrome service, quickstarts, favorites and bookmark endpoints. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/retest |
|
The failing e2e tests appear unrelated to these changes and also appear in an empty PR. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchPanel.stories.tsx (1)
15-16: Consider reusingdelayfromtestConstants.ts.The
testDelayhelper duplicates thedelayfunction already exported fromsrc/user-journeys/_shared/testConstants.ts. Reusing the existing utility would reduce duplication.♻️ Proposed refactor
+import { delay } from '../../user-journeys/_shared/testConstants'; -const testDelay = (ms: number): Promise<void> => - new Promise((resolve) => setTimeout(resolve, ms));Then replace
testDelaycalls withdelay.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchPanel.stories.tsx` around lines 15 - 16, The file defines a duplicate helper testDelay; remove testDelay and import the existing delay exported from testConstants (the symbol name is delay) instead, then replace all testDelay(...) calls with delay(...). Ensure you add the import for delay from src/user-journeys/_shared/testConstants.ts at the top of the module and remove the local testDelay declaration to avoid duplication.src/user-journeys/_shared/helpPanelJourneyHelpers.ts (1)
324-508: Consider extracting shared mock data to reduce duplication.The
searchPanelJourneyMswHandlersduplicates mock resource data that also exists inhelpPanelMswHandlers. While the MSW first-match ordering is correctly implemented, extracting common mock data into shared constants would reduce maintenance burden and ensure consistency.💡 Suggested approach
// Extract shared mock resources const baseLearningResources = [ { content: { metadata: { name: 'getting-started-insights', /* ... */ }, spec: { displayName: 'Getting started with Red Hat Insights', /* ... */ }, }, }, // ... other resources ]; // Then use in handlers: http.get('/api/quickstarts/v1/quickstarts', ({ request }) => { const url = new URL(request.url); const displayName = url.searchParams.get('display-name') || ''; if (displayName) { const query = displayName.toLowerCase(); const filtered = baseLearningResources.filter((r) => r.content.spec.displayName.toLowerCase().includes(query) ); return HttpResponse.json({ data: filtered }); } return HttpResponse.json({ data: baseLearningResources }); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/user-journeys/_shared/helpPanelJourneyHelpers.ts` around lines 324 - 508, The handlers in searchPanelJourneyMswHandlers duplicate the mock resource objects already present in helpPanelMswHandlers; extract the shared mock array into a single constant (e.g., baseLearningResources) and replace the inline arrays in searchPanelJourneyMswHandlers and helpPanelMswHandlers with references to that constant so both the quickstarts GET handler (inside searchPanelJourneyMswHandlers) and the handlers in helpPanelMswHandlers reuse the same data; ensure the filtering logic in the GET '/api/quickstarts/v1/quickstarts' handler continues to operate on baseLearningResources and return HttpResponse.json({ data: ... }) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchPanel.stories.tsx`:
- Around line 379-390: The ClearAllFilters story is querying for the services
filter option but the mockSearchPanelHandlers used in the story only provides
the product-families category; update the mockSearchPanelHandlers to include a
`services` filter category that matches the DOM attribute used in the test
(`data-ouia-component-id="help-panel-search-filter-option-services"`) so the
element rendered by SearchPanel.tsx appears; ensure the mock entry uses the same
id/label/checkbox structure as other categories so the waitFor and subsequent
click on the services checkbox succeed.
In `@src/user-journeys/HelpPanelSearchPanel.stories.tsx`:
- Around line 219-229: The test Step06_ClearAllFilters in
HelpPanelSearchPanel.stories.tsx fails because it queries a non-existent filter
option with data-ouia-component-id "help-panel-search-filter-option-services";
update the mock handlers in searchPanelJourneyMswHandlers (defined in
helpPanelJourneyHelpers.ts) to include a "services" filter option in the filter
endpoint response, or change the test to target an existing filter (e.g.,
"help-panel-search-filter-option-documentation") by replacing the selector and
checkbox click to that existing filter so the waitFor/query and userEvent.click
use a filter that exists in the MSW mock data.
---
Nitpick comments:
In `@src/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchPanel.stories.tsx`:
- Around line 15-16: The file defines a duplicate helper testDelay; remove
testDelay and import the existing delay exported from testConstants (the symbol
name is delay) instead, then replace all testDelay(...) calls with delay(...).
Ensure you add the import for delay from
src/user-journeys/_shared/testConstants.ts at the top of the module and remove
the local testDelay declaration to avoid duplication.
In `@src/user-journeys/_shared/helpPanelJourneyHelpers.ts`:
- Around line 324-508: The handlers in searchPanelJourneyMswHandlers duplicate
the mock resource objects already present in helpPanelMswHandlers; extract the
shared mock array into a single constant (e.g., baseLearningResources) and
replace the inline arrays in searchPanelJourneyMswHandlers and
helpPanelMswHandlers with references to that constant so both the quickstarts
GET handler (inside searchPanelJourneyMswHandlers) and the handlers in
helpPanelMswHandlers reuse the same data; ensure the filtering logic in the GET
'/api/quickstarts/v1/quickstarts' handler continues to operate on
baseLearningResources and return HttpResponse.json({ data: ... }) as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 52302ccc-ea41-4426-949e-7d89ac236ffa
📒 Files selected for processing (6)
.storybook/hooks/unleash.jssrc/components/HelpPanel/HelpPanelContent.stories.tsxsrc/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchForm.tsxsrc/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchPanel.stories.tsxsrc/user-journeys/HelpPanelSearchPanel.stories.tsxsrc/user-journeys/_shared/helpPanelJourneyHelpers.ts
Add Search Tab stories
Added the following User Journeys (RHCLOUD-45245):
Added the following Component Tests (RHCLOUD-45250):