1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { within , userEvent } from "@storybook/test" ;
2
3
import { chromaticWithTablet } from "testHelpers/chromatic" ;
3
4
import { MockUser , MockUser2 } from "testHelpers/entities" ;
4
5
import { withDashboardProvider } from "testHelpers/storybook" ;
@@ -10,26 +11,63 @@ const meta: Meta<typeof NavbarView> = {
10
11
component :NavbarView ,
11
12
args :{
12
13
user :MockUser ,
14
+ canViewAllUsers :true ,
13
15
canViewAuditLog :true ,
14
16
canViewDeployment :true ,
15
- canViewAllUsers :true ,
16
17
canViewHealth :true ,
18
+ canViewOrganizations :true ,
17
19
} ,
18
20
decorators :[ withDashboardProvider ] ,
19
21
} ;
20
22
21
23
export default meta ;
22
24
type Story = StoryObj < typeof NavbarView > ;
23
25
24
- export const ForAdmin :Story = { } ;
26
+ export const ForAdmin :Story = {
27
+ play :async ( { canvasElement} ) => {
28
+ const canvas = within ( canvasElement ) ;
29
+ await userEvent . click ( canvas . getByRole ( "button" , { name :"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 . getByRole ( "button" , { name :"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 . getByRole ( "button" , { name :"Deployment" } ) ) ;
60
+ } ,
61
+ } ;
25
62
26
63
export const ForMember :Story = {
27
64
args :{
28
65
user :MockUser2 ,
66
+ canViewAllUsers :false ,
29
67
canViewAuditLog :false ,
30
68
canViewDeployment :false ,
31
- canViewAllUsers :false ,
32
69
canViewHealth :false ,
70
+ canViewOrganizations :false ,
33
71
} ,
34
72
} ;
35
73