-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Storybook snapshots for Web Analytics and Web Vitals
These are way overdue, so here we have some snapshots for UI regressions on Web Analytics
- Loading branch information
1 parent
67e03d8
commit 487cecc
Showing
17 changed files
with
14,353 additions
and
18 deletions.
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
frontend/src/queries/nodes/WebVitals/WebVitals.stories.tsx
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,46 @@ | ||
import { Meta, StoryFn, StoryObj } from '@storybook/react' | ||
|
||
import { mswDecorator } from '~/mocks/browser' | ||
import { examples } from '~/queries/examples' | ||
import { Query } from '~/queries/Query/Query' | ||
|
||
import webVitals from './__mocks__/WebVitals.json' | ||
import webVitalsTrends from './__mocks__/WebVitalsTrends.json' | ||
|
||
type Story = StoryObj<typeof Query> | ||
const meta: Meta<typeof Query> = { | ||
title: 'Queries/WebVitals', | ||
component: Query, | ||
parameters: { | ||
layout: 'fullscreen', | ||
viewMode: 'story', | ||
}, | ||
decorators: [ | ||
mswDecorator({ | ||
post: { | ||
'/api/environments/:team_id/query/': (req) => { | ||
if ((req.body as any).query.kind === 'WebVitalsQuery') { | ||
return [200, webVitals] | ||
} else if ((req.body as any).query.kind === 'TrendsQuery') { | ||
return [200, webVitalsTrends] | ||
} | ||
}, | ||
}, | ||
}), | ||
], | ||
} | ||
export default meta | ||
|
||
// NOTE: See InsightCard.scss to see why we need this wrapper | ||
const QueryTemplate: StoryFn<typeof Query> = (args) => { | ||
return ( | ||
<div className="WebAnalyticsDashboard"> | ||
<div className="InsightVizDisplay"> | ||
<Query {...args} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export const WebVitals: Story = QueryTemplate.bind({}) | ||
WebVitals.args = { query: examples['WebVitals'] } |
34 changes: 34 additions & 0 deletions
34
frontend/src/queries/nodes/WebVitals/WebVitalsPathBreakdown.stories.tsx
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,34 @@ | ||
import { Meta, StoryFn, StoryObj } from '@storybook/react' | ||
|
||
import { mswDecorator } from '~/mocks/browser' | ||
import { examples } from '~/queries/examples' | ||
import { Query } from '~/queries/Query/Query' | ||
|
||
import webVitalsPathBreakdown from './__mocks__/WebVitalsPathBreakdown.json' | ||
|
||
type Story = StoryObj<typeof Query> | ||
const meta: Meta<typeof Query> = { | ||
title: 'Queries/WebVitalsPathBreakdown', | ||
component: Query, | ||
parameters: { | ||
layout: 'fullscreen', | ||
viewMode: 'story', | ||
}, | ||
decorators: [ | ||
mswDecorator({ | ||
post: { | ||
'/api/environments/:team_id/query/': (req) => { | ||
if ((req.body as any).query.kind === 'WebVitalsPathBreakdownQuery') { | ||
return [200, webVitalsPathBreakdown] | ||
} | ||
}, | ||
}, | ||
}), | ||
], | ||
} | ||
export default meta | ||
|
||
const QueryTemplate: StoryFn<typeof Query> = (args) => <Query {...args} /> | ||
|
||
export const WebVitalsPathBreakdown: Story = QueryTemplate.bind({}) | ||
WebVitalsPathBreakdown.args = { query: examples['WebVitalsPathBreakdown'] } |
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
Oops, something went wrong.