From 83922f2d60009964ddc0e3ce8e1910f364892f69 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 18 Jan 2016 15:58:22 +0100 Subject: [PATCH] UITester: always select a different image --- Classes/KIF | 2 +- TestsUI/ChatTester.m | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/KIF b/Classes/KIF index 21a137bc8..c01c06361 160000 --- a/Classes/KIF +++ b/Classes/KIF @@ -1 +1 @@ -Subproject commit 21a137bc8068f9fb738f835c6e285d44fe2ce4dd +Subproject commit c01c063616dbdab05bea25eb94c7643a52f2b7dc diff --git a/TestsUI/ChatTester.m b/TestsUI/ChatTester.m index 788d07760..eb3c7b99f 100644 --- a/TestsUI/ChatTester.m +++ b/TestsUI/ChatTester.m @@ -68,9 +68,7 @@ } - (void)uploadImageWithQuality:(NSString *)quality { - UITableView *tv = [self findTableView:@"ChatRoom list"]; - - long messagesCount = [tv numberOfRowsInSection:0]; + static int ind = 0; [tester tapViewWithAccessibilityLabel:@"Send picture"]; [tester tapViewWithAccessibilityLabel:@"Photo library"]; // if popup "Linphone would access your photo" pops up, click OK. @@ -80,8 +78,11 @@ } #endif - // select random photo to avoid having the same multiple times - [tester choosePhotoInAlbum:@"Camera Roll" atRow:2 column:2 + (messagesCount % 2)]; + // select random photo to avoid having the same multiple times. + // There are 9 photos by default, so lets use just 8 (2 rows, 4 columns). + LOGI(@"Selecting photo at row %d, column %d", 1 + (ind / 4) % 2, 1 + ind % 4); + [tester choosePhotoInAlbum:@"Camera Roll" atRow:1 + (ind / 4) % 2 column:1 + ind % 4]; + ind++; // wait for the quality popup to show up UIAccessibilityElement *element = nil; @@ -104,7 +105,7 @@ // wait for the upload to terminate... for (int i = 0; i < 45; i++) { [tester waitForTimeInterval:1.f]; - if ([[[LinphoneManager instance] fileTransferDelegates] count] == 0) + if (LinphoneManager.instance.fileTransferDelegates.count == 0) break; } [tester waitForViewWithAccessibilityLabel:@"Download"];