Skip to content

Commit

Permalink
chore: clear the console in storybook a little (#17430)
Browse files Browse the repository at this point in the history
* chore: clear the console in storybook a little

* Update .storybook/preview.tsx

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* maybe this?

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* maybe this

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
pauldambra and github-actions[bot] authored Sep 14, 2023
1 parent 49fc588 commit 65de847
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ const setupMsw = () => {
// Make sure the msw worker is started
worker.start({
quiet: true,
onUnhandledRequest(request, print) {
// MSW warns on all unhandled requests, but we don't necessarily care
const pathAllowList = ['/images/']

if (pathAllowList.some((path) => request.url.pathname.startsWith(path))) {
return
}

// Otherwise, default MSW warning behavior
print.warning()
},
})
;(window as any).__mockServiceWorker = worker
;(window as any).POSTHOG_APP_CONTEXT = getStorybookAppContext()
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export const defaultMocks: Mocks = {
},
// We don't want to show the "new version available" banner in tests
'https://api.github.com/repos/posthog/posthog-js/tags': () => [200, []],
'https://www.gravatar.com/avatar/:gravatar_id': () => [404, ''],
'https://app.posthog.com/api/early_access_features': {
earlyAccessFeatures: [],
},
},
post: {
'https://app.posthog.com/e/': (): MockSignature => [200, 'ok'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const meta: Meta = {
layout: 'fullscreen',
viewMode: 'story',
mockDate: '2023-02-01',
waitForSelector: '.PlayerFrameOverlay__content[aria-busy="false"]',
waitForSelector: '.PlayerFrame__content .replayer-wrapper iframe',
},
decorators: [
mswDecorator({
Expand Down Expand Up @@ -81,14 +81,20 @@ const meta: Meta = {
},
]
},
'/api/projects/:team_id/session_recording_playlists/:playlist_id/recordings?limit=100': (req) => {
'/api/projects/:team_id/session_recording_playlists/:playlist_id/recordings': (req) => {
const playlistId = req.params.playlist_id
const response = playlistId === '1234567' ? recordings : []
return [200, { has_next: false, results: response, version: 1 }]
},
// without the session-recording-blob-replay feature flag, we only load via ClickHouse
'/api/projects/:team/session_recordings/:id/snapshots': recordingSnapshotsJson,
'/api/projects/:team/session_recordings/:id': recordingMetaJson,
'api/projects/:team/notebooks': {
count: 0,
next: null,
previous: null,
results: [],
},
},
post: {
'/api/projects/:team/query': recordingEventsJson,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 65de847

Please sign in to comment.