-
Notifications
You must be signed in to change notification settings - Fork 702
OCPBUGS-85545: Fix guided tour modal flash on page reload #16462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -139,6 +139,21 @@ describe('guided-tour-context', () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(tour).toEqual(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(totalSteps).toEqual(undefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should not flash startTour when loaded transitions to true with completed tour', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useSelectorMock.mockReturnValue({ A: true, B: false }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useResolvedExtensionsMock.mockReturnValue(mockTourExtension); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Start with loaded: false (async ConfigMap fetch in progress) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useUserPreferenceMock.mockReturnValue([{ dev: { completed: false } }, () => null, false]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { result, rerender } = renderHook(() => useTourValuesForContext()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(result.current.tour).toEqual(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Simulate ConfigMap load completing with completed: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useUserPreferenceMock.mockReturnValue([{ dev: { completed: true } }, () => null, true]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rerender(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { tourState } = result.current; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(tourState?.startTour).not.toBe(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+143
to
+156
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Strengthen the test assertion to verify the tour context is returned. The test currently only checks
🧪 Strengthened test assertions // Simulate ConfigMap load completing with completed: true
useUserPreferenceMock.mockReturnValue([{ dev: { completed: true } }, () => null, true]);
rerender();
- const { tourState } = result.current;
- expect(tourState?.startTour).not.toBe(true);
+ const { tourState, tour } = result.current;
+ expect(tour).not.toBeNull();
+ expect(tourState?.startTour).toBe(false);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('useTourStatePerspective', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: