@@ -2,6 +2,7 @@ import type { Locator, Page } from '@playwright/test';
22
33import { Admin } from './admin' ;
44import { MenuMoreActions , UserInfoFlexTab , EditUserFlexTab } from './fragments' ;
5+ import { expect } from '../utils/test' ;
56
67type UserActions = 'Make Admin' | 'Remove Admin' | 'Activate' | 'Deactivate' ;
78
@@ -27,7 +28,7 @@ export class AdminUsers extends Admin {
2728 return this . page . getByRole ( 'button' , { name : 'Invite' , exact : true } ) ;
2829 }
2930
30- get inputSearchUsers ( ) : Locator {
31+ private get inputSearchUsers ( ) : Locator {
3132 return this . page . getByRole ( 'textbox' , { name : 'Search Users' } ) ;
3233 }
3334
@@ -36,7 +37,7 @@ export class AdminUsers extends Admin {
3637 }
3738
3839 getUserRowByUsername ( username : string ) : Locator {
39- return this . page . locator ( 'tr' , { hasText : username } ) ;
40+ return this . page . locator ( 'tr' , { hasText : username } ) . first ( ) ;
4041 }
4142
4243 getTabByName ( name : 'All' | 'Pending' | 'Active' | 'Deactivated' = 'All' ) : Locator {
@@ -53,9 +54,14 @@ export class AdminUsers extends Admin {
5354 }
5455
5556 async deleteUser ( username : string ) : Promise < void > {
56- await this . inputSearchUsers . fill ( username ) ;
57+ await this . searchUser ( username ) ;
5758 await this . getUserRowByUsername ( username ) . click ( ) ;
5859 await this . userInfo . btnMoreActions . click ( ) ;
5960 await this . userInfo . menuItemDeleteUser . click ( ) ;
6061 }
62+
63+ async searchUser ( username : string ) : Promise < void > {
64+ await this . inputSearchUsers . fill ( username ) ;
65+ await expect ( this . getUserRowByUsername ( username ) ) . toHaveCount ( 1 ) ;
66+ }
6167}
0 commit comments