@@ -195,6 +195,27 @@ extension UserRobot {
195195 XCTAssertEqual ( text, actualText, file: file, line: line)
196196 return self
197197 }
198+
199+ @discardableResult
200+ func assertOldestLoadedMessage(
201+ isEqual: Bool ,
202+ to text: String ,
203+ file: StaticString = #filePath,
204+ line: UInt = #line
205+ ) -> Self {
206+ if let topMessageCell = cells. lastMatch {
207+ let message = attributes. text ( in: topMessageCell) . wait ( )
208+ let actualText = message. text
209+ if isEqual {
210+ XCTAssertEqual ( text, actualText, file: file, line: line)
211+ } else {
212+ XCTAssertNotEqual ( text, actualText, file: file, line: line)
213+ }
214+ } else {
215+ XCTFail ( " lastMessageCell cannot be found " )
216+ }
217+ return self
218+ }
198219
199220 @discardableResult
200221 func assertPushNotification(
@@ -466,7 +487,7 @@ extension UserRobot {
466487 if deliveryStatus == . failed || deliveryStatus == nil {
467488 XCTAssertFalse ( checkmark. exists, " Checkmark is visible " , file: file, line: line)
468489 } else {
469- XCTAssertTrue ( checkmark. wait ( timeout: 10 ) . exists, " Checkmark is not visible " , file: file, line: line)
490+ XCTAssertTrue ( checkmark. wait ( timeout: 15 ) . exists, " Checkmark is not visible " , file: file, line: line)
470491 }
471492
472493 return self
@@ -675,7 +696,7 @@ extension UserRobot {
675696 XCTAssertEqual ( quotedText, actualText)
676697 XCTAssertTrue ( message. exists, " Quoted message was not showed " )
677698 XCTAssertFalse ( message. isEnabled, " Quoted message should be disabled " )
678- XCTAssertTrue ( message. isHittable, " Quoted message is not visible " )
699+ XCTAssertTrue ( message. waitForHitPoint ( ) . isHittable, " Quoted message is not visible " )
679700
680701 if !replyText. isEmpty {
681702 let message = attributes. text ( replyText, in: messageCell) . wait ( )
@@ -795,13 +816,56 @@ extension UserRobot {
795816 at messageCellIndex: Int ? = nil ,
796817 file: StaticString = #filePath,
797818 line: UInt = #line
819+ ) -> Self {
820+ assertThreadReplyCountButton ( at: messageCellIndex, replies: 0 , file: file, line: line)
821+ }
822+
823+ @discardableResult
824+ func assertThreadReplyCountButton(
825+ at messageCellIndex: Int ? = nil ,
826+ replies: Int ,
827+ file: StaticString = #filePath,
828+ line: UInt = #line
798829 ) -> Self {
799830 let messageCell = messageCell ( withIndex: messageCellIndex, file: file, line: line)
800831 let threadReplyCountButton = attributes. threadReplyCountButton ( in: messageCell) . wait ( )
801832 XCTAssertTrue ( threadReplyCountButton. exists,
802833 " There is no thread reply count button " ,
803834 file: file,
804835 line: line)
836+ if replies > 0 {
837+ let expectedText = " \( replies) Thread Replies "
838+ XCTAssertEqual ( expectedText, threadReplyCountButton. waitForText ( expectedText) . text)
839+ }
840+ return self
841+ }
842+
843+ @discardableResult
844+ func assertThreadRepliesCountLabel(
845+ _ count: Int ,
846+ file: StaticString = #filePath,
847+ line: UInt = #line
848+ ) -> Self {
849+ let expectedLabel = " \( count) REPLIES "
850+ let repliesCountLabel = ThreadPage . repliesCountLabel. waitForText ( expectedLabel) . text
851+ XCTAssertEqual ( repliesCountLabel, repliesCountLabel, file: file, line: line)
852+ return self
853+ }
854+
855+ @discardableResult
856+ func assertParentMessageInThread(
857+ withText text: String ,
858+ isLoaded: Bool ,
859+ file: StaticString = #filePath,
860+ line: UInt = #line
861+ ) -> Self {
862+ if isLoaded {
863+ XCTAssertTrue ( ThreadPage . repliesCountLabel. wait ( ) . exists, file: file, line: line)
864+ assertOldestLoadedMessage ( isEqual: true , to: text)
865+ } else {
866+ XCTAssertFalse ( ThreadPage . repliesCountLabel. exists, file: file, line: line)
867+ assertOldestLoadedMessage ( isEqual: false , to: text)
868+ }
805869 return self
806870 }
807871}
0 commit comments