Skip to content

Commit 72bf345

Browse files
committed
Add more stories for deployment dropdown
1 parent 185f2c0 commit 72bf345

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

site/src/modules/dashboard/Navbar/NavbarView.stories.tsx

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2+
import { within, userEvent } from "@storybook/test";
23
import { chromaticWithTablet } from "testHelpers/chromatic";
34
import { MockUser, MockUser2 } from "testHelpers/entities";
45
import { withDashboardProvider } from "testHelpers/storybook";
@@ -10,26 +11,63 @@ const meta: Meta<typeof NavbarView> = {
1011
component: NavbarView,
1112
args: {
1213
user: MockUser,
14+
canViewAllUsers: true,
1315
canViewAuditLog: true,
1416
canViewDeployment: true,
15-
canViewAllUsers: true,
1617
canViewHealth: true,
18+
canViewOrganizations: true,
1719
},
1820
decorators: [withDashboardProvider],
1921
};
2022

2123
export default meta;
2224
type Story = StoryObj<typeof NavbarView>;
2325

24-
export const ForAdmin: Story = {};
26+
export const ForAdmin: Story = {
27+
play: async ({ canvasElement }) => {
28+
const canvas = within(canvasElement);
29+
await userEvent.click(canvas.getByText("Deployment"));
30+
},
31+
};
32+
33+
export const ForAuditor: Story = {
34+
args: {
35+
user: MockUser2,
36+
canViewAllUsers: false,
37+
canViewAuditLog: true,
38+
canViewDeployment: false,
39+
canViewHealth: false,
40+
canViewOrganizations: false,
41+
},
42+
play: async ({ canvasElement }) => {
43+
const canvas = within(canvasElement);
44+
await userEvent.click(canvas.getByText("Deployment"));
45+
},
46+
};
47+
48+
export const ForOrgAdmin: Story = {
49+
args: {
50+
user: MockUser2,
51+
canViewAllUsers: false,
52+
canViewAuditLog: true,
53+
canViewDeployment: false,
54+
canViewHealth: false,
55+
canViewOrganizations: true,
56+
},
57+
play: async ({ canvasElement }) => {
58+
const canvas = within(canvasElement);
59+
await userEvent.click(canvas.getByText("Deployment"));
60+
},
61+
};
2562

2663
export const ForMember: Story = {
2764
args: {
2865
user: MockUser2,
66+
canViewAllUsers: false,
2967
canViewAuditLog: false,
3068
canViewDeployment: false,
31-
canViewAllUsers: false,
3269
canViewHealth: false,
70+
canViewOrganizations: false,
3371
},
3472
};
3573

0 commit comments

Comments
 (0)