-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't show doctor events in everything mode (#24594)
- Loading branch information
1 parent
f685cec
commit 92a86ec
Showing
3 changed files
with
185 additions
and
161 deletions.
There are no files selected for viewing
182 changes: 182 additions & 0 deletions
182
frontend/src/scenes/session-recordings/player/inspector/inspectorListFiltering.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
import { filterInspectorListItems } from 'scenes/session-recordings/player/inspector/inspectorListFiltering' | ||
import { | ||
InspectorListBrowserVisibility, | ||
InspectorListItemDoctor, | ||
InspectorListItemEvent, | ||
InspectorListOfflineStatusChange, | ||
} from 'scenes/session-recordings/player/inspector/playerInspectorLogic' | ||
import { SharedListMiniFilter } from 'scenes/session-recordings/player/playerSettingsLogic' | ||
|
||
import { PerformanceEvent, SessionRecordingPlayerTab } from '~/types' | ||
|
||
describe('filtering inspector list items', () => { | ||
describe('the all tab', () => { | ||
it('includes browser visibility', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'browser-visibility', | ||
} as InspectorListBrowserVisibility, | ||
], | ||
tab: SessionRecordingPlayerTab.ALL, | ||
miniFiltersByKey: { 'all-everything': { enabled: true } as unknown as SharedListMiniFilter }, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(1) | ||
}) | ||
|
||
it('hides doctor items in everything mode', () => { | ||
const filteredItems = filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'browser-visibility', | ||
} as InspectorListBrowserVisibility, | ||
{ | ||
type: 'doctor', | ||
} as InspectorListItemDoctor, | ||
], | ||
tab: SessionRecordingPlayerTab.ALL, | ||
miniFiltersByKey: { 'all-everything': { enabled: true } as unknown as SharedListMiniFilter }, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
expect(filteredItems.map((item) => item.type)).toEqual(['browser-visibility']) | ||
}) | ||
}) | ||
|
||
describe('the events tab', () => { | ||
it('filters by window id', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: SessionRecordingPlayerTab.EVENTS, | ||
windowId: 'this window', | ||
data: { event: '$exception' } as unknown as PerformanceEvent, | ||
} as unknown as InspectorListItemEvent, | ||
{ | ||
type: SessionRecordingPlayerTab.EVENTS, | ||
windowId: 'a different window', | ||
data: { event: '$exception' } as unknown as PerformanceEvent, | ||
} as unknown as InspectorListItemEvent, | ||
], | ||
tab: SessionRecordingPlayerTab.EVENTS, | ||
miniFiltersByKey: { 'events-all': { enabled: true } as unknown as SharedListMiniFilter }, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: 'a different window', | ||
}) | ||
).toHaveLength(1) | ||
}) | ||
|
||
it('excludes browser visibility on console filter', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'browser-visibility', | ||
} as InspectorListBrowserVisibility, | ||
], | ||
tab: SessionRecordingPlayerTab.EVENTS, | ||
miniFiltersByKey: { 'all-everything': { enabled: false } as unknown as SharedListMiniFilter }, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(0) | ||
}) | ||
|
||
it('excludes browser visibility when show only matching', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'browser-visibility', | ||
} as InspectorListBrowserVisibility, | ||
], | ||
tab: SessionRecordingPlayerTab.EVENTS, | ||
miniFiltersByKey: { 'all-everything': { enabled: true } as unknown as SharedListMiniFilter }, | ||
showOnlyMatching: true, | ||
showMatchingEventsFilter: true, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(0) | ||
}) | ||
}) | ||
|
||
describe('the doctor tab', () => { | ||
it('ignores events that are not exceptions', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: SessionRecordingPlayerTab.EVENTS, | ||
data: { event: 'an event' } as unknown as PerformanceEvent, | ||
} as unknown as InspectorListItemEvent, | ||
], | ||
tab: SessionRecordingPlayerTab.DOCTOR, | ||
miniFiltersByKey: {}, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(0) | ||
}) | ||
|
||
it('includes events that are exceptions', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: SessionRecordingPlayerTab.EVENTS, | ||
data: { event: '$exception' } as unknown as PerformanceEvent, | ||
} as unknown as InspectorListItemEvent, | ||
], | ||
tab: SessionRecordingPlayerTab.DOCTOR, | ||
miniFiltersByKey: {}, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(1) | ||
}) | ||
|
||
it('includes browser offline status', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'offline-status', | ||
} as unknown as InspectorListOfflineStatusChange, | ||
], | ||
tab: SessionRecordingPlayerTab.DOCTOR, | ||
miniFiltersByKey: {}, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(1) | ||
}) | ||
|
||
it('includes browser visibility status', () => { | ||
expect( | ||
filterInspectorListItems({ | ||
allItems: [ | ||
{ | ||
type: 'browser-visibility', | ||
} as InspectorListBrowserVisibility, | ||
], | ||
tab: SessionRecordingPlayerTab.DOCTOR, | ||
miniFiltersByKey: {}, | ||
showOnlyMatching: false, | ||
showMatchingEventsFilter: false, | ||
windowIdFilter: null, | ||
}) | ||
).toHaveLength(1) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters