66 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
77 */
88
9- import { Page , Locator , expect } from '@playwright/test' ;
9+ import { Locator , expect } from '@playwright/test' ;
1010import { BasePage } from './BasePage' ;
1111
1212/**
@@ -49,9 +49,9 @@ export class ClientPage extends BasePage {
4949 return this . page . locator ( 'table.bordered-table tbody tr' ) ;
5050 }
5151
52- // Get the first client name cell (carries the routerLink).
52+ // Get the first client name cell (the displayName column carries the routerLink).
5353 get firstClientNameCell ( ) : Locator {
54- return this . page . locator ( 'table.bordered-table tbody tr td' ) . first ( ) ;
54+ return this . page . locator ( 'table.bordered-table tbody tr td.mat-column-displayName ' ) . first ( ) ;
5555 }
5656
5757 // Get the "No client was found" alert message.
@@ -134,6 +134,8 @@ export class ClientPage extends BasePage {
134134 } catch ( e ) {
135135 console . log ( 'Network idle timeout on clients page - proceeding anyway' ) ;
136136 }
137+ // Verify the UI is ready by checking for the search input
138+ await this . searchInput . waitFor ( { state : 'visible' , timeout : 15000 } ) ;
137139 }
138140
139141 /**
@@ -149,6 +151,11 @@ export class ClientPage extends BasePage {
149151 } catch ( e ) {
150152 console . log ( 'Network idle timeout after search - proceeding anyway' ) ;
151153 }
154+ // Wait for observable results: either rows appear or "no client found" message
155+ await Promise . race ( [
156+ this . clientRows . first ( ) . waitFor ( { state : 'visible' , timeout : 15000 } ) ,
157+ this . noClientFoundMessage . waitFor ( { state : 'visible' , timeout : 15000 } )
158+ ] ) ;
152159 }
153160
154161 /**
0 commit comments