@@ -88,3 +88,35 @@ test('test that multiple tags can be created via API and displayed in the table'
8888 await expect ( page . getByTestId ( 'tag_table' ) ) . toContainText ( tagName1 ) ;
8989 await expect ( page . getByTestId ( 'tag_table' ) ) . toContainText ( tagName2 ) ;
9090} ) ;
91+
92+ // =============================================
93+ // Employee Permission Tests
94+ // =============================================
95+
96+ test . describe ( 'Employee Tags Restrictions' , ( ) => {
97+ test ( 'employee can view tags but cannot create' , async ( { ctx, employee } ) => {
98+ const tagName = 'EmpViewTag ' + Math . floor ( Math . random ( ) * 10000 ) ;
99+ await createTagViaApi ( ctx , { name : tagName } ) ;
100+
101+ await employee . page . goto ( PLAYWRIGHT_BASE_URL + '/tags' ) ;
102+ await expect ( employee . page . getByTestId ( 'tags_view' ) ) . toBeVisible ( { timeout : 10000 } ) ;
103+
104+ // Employee can see the tag (tags are visible to all members with tags:view)
105+ await expect ( employee . page . getByText ( tagName ) ) . toBeVisible ( { timeout : 10000 } ) ;
106+
107+ // Employee cannot see Create Tag button
108+ await expect ( employee . page . getByRole ( 'button' , { name : 'Create Tag' } ) ) . not . toBeVisible ( ) ;
109+ } ) ;
110+
111+ test ( 'employee cannot see edit/delete actions on tags' , async ( { ctx, employee } ) => {
112+ const tagName = 'EmpActionsTag ' + Math . floor ( Math . random ( ) * 10000 ) ;
113+ await createTagViaApi ( ctx , { name : tagName } ) ;
114+
115+ await employee . page . goto ( PLAYWRIGHT_BASE_URL + '/tags' ) ;
116+ await expect ( employee . page . getByText ( tagName ) ) . toBeVisible ( { timeout : 10000 } ) ;
117+
118+ // Actions button should not be visible for employee
119+ const actionsButton = employee . page . locator ( `[aria-label='Actions for Tag ${ tagName } ']` ) ;
120+ await expect ( actionsButton ) . not . toBeVisible ( ) ;
121+ } ) ;
122+ } ) ;
0 commit comments