@@ -38,7 +38,6 @@ const errorMessageValidation = {
3838 lastPolicyCannotBeRemoved : 'At least one policy is required in a role' ,
3939} ;
4040
41-
4241// use the admin user to login
4342test . use ( { storageState : 'playwright/.auth/admin.json' } ) ;
4443
@@ -80,18 +79,18 @@ test('Roles page should work properly', async ({ page }) => {
8079 await expect ( descriptionField ) . toBeVisible ( ) ;
8180 await descriptionField . fill ( description ) ;
8281
83- // Select the policies - wait for dropdown to open
82+ // Select the policies - search and select from dropdown
8483 const policiesDropdown = page . locator ( '[data-testid="policies"]' ) ;
8584 await expect ( policiesDropdown ) . toBeVisible ( ) ;
8685 await policiesDropdown . click ( ) ;
87-
88- // Wait for dropdown options to be visible before clicking
86+ await policiesDropdown . locator ( 'input' ) . fill ( 'Data' ) ;
8987 const dataConsumerOption = page
9088 . locator ( '.ant-select-dropdown:visible' )
9189 . locator ( '[title="Data Consumer Policy"]' ) ;
9290 await expect ( dataConsumerOption ) . toBeVisible ( ) ;
9391 await dataConsumerOption . click ( ) ;
9492
93+ await policiesDropdown . locator ( 'input' ) . fill ( 'Data' ) ;
9594 const dataStewardOption = page
9695 . locator ( '.ant-select-dropdown:visible' )
9796 . locator ( '[title="Data Steward Policy"]' ) ;
@@ -171,17 +170,13 @@ test('Roles page should work properly', async ({ page }) => {
171170 await expect ( page . locator ( '[data-testid="loader"]' ) ) . not . toBeVisible ( ) ;
172171 await expect ( page . getByRole ( 'cell' , { name : 'No data' } ) ) . toBeVisible ( ) ;
173172
174- // Navigating to roles tab to verify the added role
175- const breadcrumbLink = page
176- . locator ( '[data-testid="breadcrumb-link"]' )
177- . first ( ) ;
178- await expect ( breadcrumbLink ) . toBeVisible ( ) ;
179- await breadcrumbLink . click ( ) ;
180-
181- // Wait for roles list to load
173+ // Navigate to roles list page to verify the added role
174+ await settingClick ( page , GlobalSettingOptions . ROLES ) ;
182175 await expect ( page . locator ( '[data-testid="loader"]' ) ) . not . toBeVisible ( ) ;
183176
184- const roleLocator = page . getByRole ( 'link' , { name : roleName } ) ;
177+ const roleLocator = page . locator (
178+ `[data-testid="role-name"][href="/settings/access/roles/${ roleName } "]`
179+ ) ;
185180 await getElementWithPagination ( page , roleLocator , false ) ;
186181
187182 // Wait for plus-more-count button to be visible before clicking
@@ -249,7 +244,9 @@ test('Roles page should work properly', async ({ page }) => {
249244 await expect ( page . locator ( '[data-testid="loader"]' ) ) . not . toBeVisible ( ) ;
250245
251246 // Edit description
252- const roleLocator = page . getByRole ( 'link' , { name : roleName } ) ;
247+ const roleLocator = page . locator (
248+ `[data-testid="role-name"][href="/settings/access/roles/${ roleName } "]`
249+ ) ;
253250 await getElementWithPagination ( page , roleLocator ) ;
254251
255252 // Wait for role details page to load
@@ -531,7 +528,6 @@ test('Delete role action from manage button options', async ({ page }) => {
531528
532529 await page . reload ( ) ;
533530
534-
535531 await page . waitForSelector ( '[data-testid="loader"]' , {
536532 state : 'detached' ,
537533 } ) ;
0 commit comments