From c86c615044a5b56f0a6291550526aad7be85fed7 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 9 Jul 2015 11:12:55 +0200 Subject: [PATCH] LinphoneUITester: try to robustify tests by going to dialer before starting tests --- Classes/LinphoneManager.m | 1 - KifTests/ChatTester.m | 2 ++ KifTests/LinphoneTestCase.m | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index e557cd3b0..193ea3550 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2050,7 +2050,6 @@ static void audioRouteChangeListenerCallback ( if( linphone_core_payload_type_is_vbr(theLinphoneCore, pt) ) { linphone_core_set_payload_type_bitrate(theLinphoneCore, pt, bitrate); } - codec = codec->next; } } diff --git a/KifTests/ChatTester.m b/KifTests/ChatTester.m index ee49465a5..95a81c1cc 100644 --- a/KifTests/ChatTester.m +++ b/KifTests/ChatTester.m @@ -229,6 +229,8 @@ - (void)testRemoveAllChats { NSArray *uuids = [self getUUIDArrayOfSize:5]; + [self removeAllRooms]; + for (NSString *uuid in uuids) { [self startChatWith:uuid]; [self sendMessage:@"Test"]; diff --git a/KifTests/LinphoneTestCase.m b/KifTests/LinphoneTestCase.m index 094d99fb9..52d91569b 100644 --- a/KifTests/LinphoneTestCase.m +++ b/KifTests/LinphoneTestCase.m @@ -26,6 +26,20 @@ linphone_core_set_log_level(ORTP_WARNING); } +- (void)beforeAll { + [super beforeAll]; +#if TARGET_IPHONE_SIMULATOR + [tester acknowledgeSystemAlert]; // Contact access alert + [tester acknowledgeSystemAlert]; // Local notification / badge alert +#endif + // go to dialer + for (NSString *button in @[ @"Cancel", @"Back", @"Dialer" ]) { + if ([tester tryFindingTappableViewWithAccessibilityLabel:button error:nil]) { + [tester tapViewWithAccessibilityLabel:button traits:UIAccessibilityTraitButton]; + } + } +} + - (NSString *)me { return @"testios"; } @@ -46,15 +60,6 @@ return array; } -- (void)beforeAll{ -#if TARGET_IPHONE_SIMULATOR - [tester acknowledgeSystemAlert]; // Contact access alert - [tester acknowledgeSystemAlert]; // Local notification / badge alert -#endif - [super beforeAll]; -} - - static bool invalidAccount = true; - (void)setInvalidAccountSet:(BOOL)invalidAccountSet {