@@ -47,11 +47,13 @@ export class MessagesPage {
4747 const results = await this . newMessageSearchResults
4848 . getByTestId ( 'search-results-username' )
4949 . all ( )
50-
51- for ( let i = 0 ; i < results . length ; i ++ ) {
52- const usernameResults = await results [ i ] . textContent ( )
53- if ( usernameResults ?. toLowerCase ( ) === username [ i ] . toLowerCase ( ) ) await results [ i ] . click ( )
54- break
50+ const targetUser = username [ i ] . toLowerCase ( )
51+ for ( let j = 0 ; j < results . length ; j ++ ) {
52+ const usernameResults = ( await results [ j ] . textContent ( ) ) ?. toLowerCase ( )
53+ if ( usernameResults === targetUser ) {
54+ await results [ j ] . click ( )
55+ break
56+ }
5557 }
5658 }
5759
@@ -64,10 +66,12 @@ export class MessagesPage {
6466 await this . messageInput . fill ( message )
6567 await expect ( this . messageSubmit ) . toBeVisible ( )
6668 await this . messageSubmit . click ( )
69+ await this . verifyMessage ( message )
6770 }
6871
6972 async findMessageConversation ( displayName : string ) {
7073 await expect ( this . messagesTable ) . toBeVisible ( )
74+ await this . page . waitForTimeout ( 1000 )
7175 const doMessagesExist = ( await this . messagesRow . count ( ) ) > 0
7276 if ( doMessagesExist ) {
7377 const messages = await this . messagesRow . getByTestId ( 'messages-username' ) . all ( )
@@ -84,6 +88,7 @@ export class MessagesPage {
8488
8589 async verifyMessage ( messageContent : string ) {
8690 await expect ( this . conversation ) . toBeVisible ( )
91+ await this . page . waitForTimeout ( 1000 )
8792 const messageCount = ( await this . conversationMessage . count ( ) ) > 0
8893 if ( messageCount ) {
8994 const messages = await this . conversationMessage . all ( )
0 commit comments