From 64a57f66e5b2085d3c3acd9542f70add0354a098 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 11 Jan 2016 11:12:15 +0100 Subject: [PATCH] UITester: fix infinite loop in chat --- TestsUI/ChatTester.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/TestsUI/ChatTester.m b/TestsUI/ChatTester.m index 908ecddbb..a90be60bf 100644 --- a/TestsUI/ChatTester.m +++ b/TestsUI/ChatTester.m @@ -285,6 +285,7 @@ [self uploadImageWithQuality:@"Minimum"]; [self uploadImageWithQuality:@"Minimum"]; UITableView *tv = [self findTableView:@"ChatRoom list"]; + int timeout = 3; // wait for ALL uploads to terminate... for (int i = 0; i < 90; i++) { [tester waitForTimeInterval:1.f]; @@ -296,17 +297,20 @@ [tester scrollViewWithAccessibilityIdentifier:@"ChatRoom list" byFractionOfSizeHorizontal:0.f vertical:1.f]; for (int i = 0; i < 2; i++) { // messages order is not known: if upload bitrate is huge, first image can be uploaded before last started - while (![tester tryFindingTappableViewWithAccessibilityLabel:@"Download" error:nil]) { + while (![tester tryFindingTappableViewWithAccessibilityLabel:@"Download" error:nil] && timeout) { [tester scrollViewWithAccessibilityIdentifier:@"ChatRoom list" byFractionOfSizeHorizontal:0.f vertical:-.1f]; + timeout--; } [tester waitForViewWithAccessibilityLabel:@"Download"]; [tester tapViewWithAccessibilityLabel:@"Download"]; [tester waitForTimeInterval:.2f]; // just wait a few secs to start download } - while ([LinphoneManager instance].fileTransferDelegates.count > 0) { + timeout = 30; + while ([LinphoneManager instance].fileTransferDelegates.count > 0 && timeout) { [tester waitForTimeInterval:.5]; + timeout--; } [self goBackFromChat]; }