mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 06:38:08 +00:00
Migrate category into inherited LinphoneTestCase
This commit is contained in:
parent
9c53b4edb8
commit
b587fb7592
7 changed files with 84 additions and 80 deletions
|
|
@ -7,7 +7,6 @@
|
|||
//
|
||||
|
||||
#import "ChatTester.h"
|
||||
#import "KIFTestCase+LinphoneExtras.h"
|
||||
|
||||
@implementation ChatTester
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
//
|
||||
// KIFTestCase+LinphoneExtras.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume on 17/01/2015.
|
||||
//
|
||||
//
|
||||
|
||||
#import <KIF/KIF.h>
|
||||
|
||||
@interface KIFTestCase (LinphoneExtras)
|
||||
|
||||
@property BOOL invalidAccountSet;
|
||||
|
||||
- (void)switchToValidAccountIfNeeded;
|
||||
- (NSString*)accountUsername;
|
||||
|
||||
@end
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
//
|
||||
// KIFTestCase+LinphoneExtras.m
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume on 17/01/2015.
|
||||
//
|
||||
//
|
||||
|
||||
#import "KIFTestCase+LinphoneExtras.h"
|
||||
|
||||
@implementation KIFTestCase (LinphoneExtras)
|
||||
|
||||
static bool invalidAccount = true;
|
||||
|
||||
- (void)setInvalidAccountSet:(BOOL)invalidAccountSet {
|
||||
invalidAccount = invalidAccountSet;
|
||||
}
|
||||
|
||||
- (BOOL)invalidAccountSet {
|
||||
return invalidAccount;
|
||||
}
|
||||
|
||||
- (NSString *)accountUsername {
|
||||
return @"testios";
|
||||
}
|
||||
|
||||
- (void)switchToValidAccountIfNeeded {
|
||||
[UIView setAnimationsEnabled:false];
|
||||
|
||||
if( invalidAccount ){
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Settings"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Run assistant"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
if( [tester tryFindingViewWithAccessibilityLabel:@"Launch Wizard" error:nil]){
|
||||
[tester tapViewWithAccessibilityLabel:@"Launch Wizard"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
}
|
||||
|
||||
NSLog(@"Switching to a valid account");
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Start"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in linphone.org account"];
|
||||
|
||||
[tester enterText:@"testios" intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:@"testtest" intoViewWithAccessibilityLabel:@"Password"];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in"];
|
||||
|
||||
invalidAccount = false;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -9,5 +9,11 @@
|
|||
#import <KIF/KIF.h>
|
||||
|
||||
@interface LinphoneTestCase : KIFTestCase
|
||||
@property BOOL invalidAccountSet;
|
||||
|
||||
- (void)switchToValidAccountIfNeeded;
|
||||
- (NSString*)accountUsername;
|
||||
- (NSString*)accountDomain;
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -8,11 +8,89 @@
|
|||
|
||||
#import "LinphoneTestCase.h"
|
||||
|
||||
#import "LinphoneManager.h"
|
||||
|
||||
@implementation LinphoneTestCase
|
||||
|
||||
|
||||
|
||||
- (NSString *)accountUsername {
|
||||
return @"testios";
|
||||
}
|
||||
|
||||
- (NSString *)accountDomain {
|
||||
return @"sip.linphone.org";
|
||||
}
|
||||
- (void)beforeAll{
|
||||
[tester acknowledgeSystemAlert];
|
||||
[super beforeAll];
|
||||
}
|
||||
|
||||
|
||||
static bool invalidAccount = true;
|
||||
|
||||
- (void)setInvalidAccountSet:(BOOL)invalidAccountSet {
|
||||
invalidAccount = invalidAccountSet;
|
||||
}
|
||||
|
||||
- (BOOL)invalidAccountSet {
|
||||
return invalidAccount;
|
||||
}
|
||||
|
||||
- (BOOL)hasValidProxyConfig {
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
const MSList* proxies = linphone_core_get_proxy_config_list(lc);
|
||||
BOOL isOK = false;
|
||||
while(proxies){
|
||||
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*)proxies->data;
|
||||
const char* domain = linphone_proxy_config_get_domain(cfg);
|
||||
const char* identity = linphone_proxy_config_get_identity(cfg);
|
||||
LinphoneAddress* addr = linphone_core_interpret_url(lc, identity);
|
||||
const char* username = linphone_address_get_username(addr);
|
||||
|
||||
if( addr
|
||||
&& ( username && strcmp(username, [[self accountUsername] UTF8String]) == 0)
|
||||
&& ( domain && strcmp(domain, [[self accountDomain] UTF8String]) == 0 )
|
||||
&& linphone_proxy_config_get_state(cfg) == LinphoneRegistrationOk )
|
||||
{
|
||||
isOK = true;
|
||||
linphone_address_destroy(addr);
|
||||
break;
|
||||
} else if( addr ) {
|
||||
linphone_address_destroy(addr);
|
||||
}
|
||||
|
||||
proxies=proxies->next;
|
||||
}
|
||||
return isOK;
|
||||
}
|
||||
|
||||
- (void)switchToValidAccountIfNeeded {
|
||||
[UIView setAnimationsEnabled:false];
|
||||
|
||||
if( invalidAccount && ! [self hasValidProxyConfig] ){
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Settings"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Run assistant"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
if( [tester tryFindingViewWithAccessibilityLabel:@"Launch Wizard" error:nil]){
|
||||
[tester tapViewWithAccessibilityLabel:@"Launch Wizard"];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
}
|
||||
|
||||
NSLog(@"Switching to a valid account");
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Start"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in linphone.org account"];
|
||||
|
||||
[tester enterText:@"testios" intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:@"testtest" intoViewWithAccessibilityLabel:@"Password"];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in"];
|
||||
|
||||
invalidAccount = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#import "WizardTester.h"
|
||||
#import <KIF/KIF.h>
|
||||
#import "KIFTestCase+LinphoneExtras.h"
|
||||
|
||||
@implementation WizardTester
|
||||
|
||||
|
|
|
|||
|
|
@ -698,7 +698,6 @@
|
|||
F08F11A019C0A6CB007D70C2 /* DTObjectBlockExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = F08F119F19C0A6CB007D70C2 /* DTObjectBlockExecutor.m */; };
|
||||
F0938159188E629800A55DFA /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = F0938158188E629800A55DFA /* iTunesArtwork */; };
|
||||
F0A1CE081A6B056E001CA2BE /* ChatTester.m in Sources */ = {isa = PBXBuildFile; fileRef = F0A1CE071A6B056E001CA2BE /* ChatTester.m */; };
|
||||
F0A1CE0C1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = F0A1CE0B1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m */; };
|
||||
F0B4FB5D1A65550B00637027 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0B4FB5C1A65550B00637027 /* Images.xcassets */; };
|
||||
F0B89C2218DC89E30050B60E /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0B89C2118DC89E30050B60E /* MediaPlayer.framework */; };
|
||||
F0B89C2818DC973E0050B60E /* wizard_external_sip.rc in Resources */ = {isa = PBXBuildFile; fileRef = F0B89C2418DC973E0050B60E /* wizard_external_sip.rc */; };
|
||||
|
|
@ -1703,8 +1702,6 @@
|
|||
F0A1CE061A6B056E001CA2BE /* ChatTester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatTester.h; sourceTree = "<group>"; };
|
||||
F0A1CE071A6B056E001CA2BE /* ChatTester.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatTester.m; sourceTree = "<group>"; };
|
||||
F0A1CE091A6B05A4001CA2BE /* WizardTester.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WizardTester.h; sourceTree = "<group>"; };
|
||||
F0A1CE0A1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KIFTestCase+LinphoneExtras.h"; sourceTree = "<group>"; };
|
||||
F0A1CE0B1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KIFTestCase+LinphoneExtras.m"; sourceTree = "<group>"; };
|
||||
F0AF06F01A24BA760086C9C1 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/AboutViewController.strings; sourceTree = "<group>"; };
|
||||
F0AF06F11A24BA760086C9C1 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/ChatRoomViewController.strings; sourceTree = "<group>"; };
|
||||
F0AF06F21A24BA760086C9C1 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/ChatViewController.strings; sourceTree = "<group>"; };
|
||||
|
|
@ -3023,8 +3020,6 @@
|
|||
F0A1CE091A6B05A4001CA2BE /* WizardTester.h */,
|
||||
F0A1CE061A6B056E001CA2BE /* ChatTester.h */,
|
||||
F0A1CE071A6B056E001CA2BE /* ChatTester.m */,
|
||||
F0A1CE0A1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.h */,
|
||||
F0A1CE0B1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m */,
|
||||
F85554461A6DA2F400A9F915 /* LinphoneTestCase.h */,
|
||||
F85554471A6DA2F400A9F915 /* LinphoneTestCase.m */,
|
||||
);
|
||||
|
|
@ -3999,7 +3994,6 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F0A1CE081A6B056E001CA2BE /* ChatTester.m in Sources */,
|
||||
F0A1CE0C1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m in Sources */,
|
||||
F85554481A6DA2F400A9F915 /* LinphoneTestCase.m in Sources */,
|
||||
F0F952121A6AECD300254160 /* WizardTester.m in Sources */,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue