@@ -12,7 +12,7 @@ const WIDGET_TIMEOUT = 30_000;
1212test . describe (
1313 'Dashboard Page' ,
1414 {
15- tag : [ '@regression' , '@dashboard' , '@functional' , '@smoke' , '@smoke-any ' ] ,
15+ tag : [ '@regression' , '@dashboard' , '@functional' , '@smoke' , '@smoke-admin ' ] ,
1616 } ,
1717 ( ) => {
1818 // -----------------------------------------------------------------------
@@ -60,79 +60,6 @@ test.describe(
6060 . first ( ) ,
6161 ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
6262 } ) ;
63-
64- test ( 'Regular user sees "My Sessions" title instead of "Active Sessions" on the session count widget' , async ( {
65- page,
66- request,
67- } ) => {
68- // 1. Login as regular user and navigate to /summary
69- await loginAsUser ( page , request ) ;
70- await navigateTo ( page , 'summary' ) ;
71-
72- // 2. Verify the widget title reads "My Sessions" (not "Active Sessions")
73- await expect (
74- page
75- . locator ( '.bai_grid_item' )
76- . filter ( { hasText : 'My Sessions' } )
77- . first ( ) ,
78- ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
79- await expect (
80- page
81- . locator ( '.bai_grid_item' )
82- . filter ( { hasText : 'Active Sessions' } )
83- . first ( ) ,
84- ) . not . toBeVisible ( ) ;
85- } ) ;
86-
87- test ( 'Regular user sees dashboard without admin-only widgets' , async ( {
88- page,
89- request,
90- } ) => {
91- // 1. Login as regular user and navigate to /summary
92- await loginAsUser ( page , request ) ;
93- await navigateTo ( page , 'summary' ) ;
94-
95- // 2. Verify the "My Sessions" widget is visible
96- await expect (
97- page
98- . locator ( '.bai_grid_item' )
99- . filter ( { hasText : 'My Sessions' } )
100- . first ( ) ,
101- ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
102-
103- // 3. Verify the "My Resources" widget is visible
104- await expect (
105- page
106- . locator ( '.bai_grid_item' )
107- . filter ( { hasText : 'My Total Resources Limit' } )
108- . first ( ) ,
109- ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
110-
111- // 4. Verify the "My Resources in Resource Group" widget is visible
112- // The widget title is "My Resources in" followed by a resource group selector
113- await expect (
114- page
115- . locator ( '.bai_grid_item' )
116- . filter ( { hasText : 'My Resources in' } )
117- . first ( ) ,
118- ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
119-
120- // 5. Verify the "Agent Stats" widget is NOT present (admin only)
121- await expect (
122- page
123- . locator ( '.bai_grid_item' )
124- . filter ( { hasText : 'Agent Statistics' } )
125- . first ( ) ,
126- ) . not . toBeVisible ( ) ;
127-
128- // 6. Verify the "Recently Created Sessions" table is visible
129- await expect (
130- page
131- . locator ( '.bai_grid_item' )
132- . filter ( { hasText : 'Recently Created Sessions' } )
133- . first ( ) ,
134- ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
135- } ) ;
13663 } ) ;
13764
13865 // -----------------------------------------------------------------------
@@ -404,6 +331,13 @@ test.describe(
404331 // -----------------------------------------------------------------------
405332 // 12. Board Layout (Resize and Move - smoke tests)
406333 // -----------------------------------------------------------------------
334+ // -----------------------------------------------------------------------
335+ // User-role dashboard tests
336+ //
337+ // Kept outside the @smoke / @smoke -admin describe because the smoke set
338+ // must use a single account; these tests log in as a regular user.
339+ // -----------------------------------------------------------------------
340+
407341 test . describe ( 'Board Layout' , ( ) => {
408342 test ( 'Admin can see resizable and movable widgets on the Dashboard' , async ( {
409343 page,
@@ -435,3 +369,86 @@ test.describe(
435369 } ) ;
436370 } ,
437371) ;
372+
373+ // Regular-user dashboard checks live in a separate describe so they are
374+ // excluded from `@smoke` / `@smoke-admin` runs (smoke runs use a single
375+ // logged-in account, here admin).
376+ test . describe (
377+ 'Dashboard Page (user role)' ,
378+ {
379+ tag : [ '@regression' , '@dashboard' , '@functional' ] ,
380+ } ,
381+ ( ) => {
382+ test ( 'Regular user sees "My Sessions" title instead of "Active Sessions" on the session count widget' , async ( {
383+ page,
384+ request,
385+ } ) => {
386+ // 1. Login as regular user and navigate to /summary
387+ await loginAsUser ( page , request ) ;
388+ await navigateTo ( page , 'summary' ) ;
389+
390+ // 2. Verify the widget title reads "My Sessions" (not "Active Sessions")
391+ await expect (
392+ page
393+ . locator ( '.bai_grid_item' )
394+ . filter ( { hasText : 'My Sessions' } )
395+ . first ( ) ,
396+ ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
397+ await expect (
398+ page
399+ . locator ( '.bai_grid_item' )
400+ . filter ( { hasText : 'Active Sessions' } )
401+ . first ( ) ,
402+ ) . not . toBeVisible ( ) ;
403+ } ) ;
404+
405+ test ( 'Regular user sees dashboard without admin-only widgets' , async ( {
406+ page,
407+ request,
408+ } ) => {
409+ // 1. Login as regular user and navigate to /summary
410+ await loginAsUser ( page , request ) ;
411+ await navigateTo ( page , 'summary' ) ;
412+
413+ // 2. Verify the "My Sessions" widget is visible
414+ await expect (
415+ page
416+ . locator ( '.bai_grid_item' )
417+ . filter ( { hasText : 'My Sessions' } )
418+ . first ( ) ,
419+ ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
420+
421+ // 3. Verify the "My Resources" widget is visible
422+ await expect (
423+ page
424+ . locator ( '.bai_grid_item' )
425+ . filter ( { hasText : 'My Total Resources Limit' } )
426+ . first ( ) ,
427+ ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
428+
429+ // 4. Verify the "My Resources in Resource Group" widget is visible
430+ await expect (
431+ page
432+ . locator ( '.bai_grid_item' )
433+ . filter ( { hasText : 'My Resources in' } )
434+ . first ( ) ,
435+ ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
436+
437+ // 5. Verify the "Agent Stats" widget is NOT present (admin only)
438+ await expect (
439+ page
440+ . locator ( '.bai_grid_item' )
441+ . filter ( { hasText : 'Agent Statistics' } )
442+ . first ( ) ,
443+ ) . not . toBeVisible ( ) ;
444+
445+ // 6. Verify the "Recently Created Sessions" table is visible
446+ await expect (
447+ page
448+ . locator ( '.bai_grid_item' )
449+ . filter ( { hasText : 'Recently Created Sessions' } )
450+ . first ( ) ,
451+ ) . toBeVisible ( { timeout : WIDGET_TIMEOUT } ) ;
452+ } ) ;
453+ } ,
454+ ) ;
0 commit comments