mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
New tests
This commit is contained in:
parent
5149a6d890
commit
b1df56ffdd
7 changed files with 223 additions and 15 deletions
13
KifTests/ChatTester.h
Normal file
13
KifTests/ChatTester.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// ChatTester.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume on 17/01/2015.
|
||||
//
|
||||
//
|
||||
|
||||
#import <KIF/KIF.h>
|
||||
|
||||
@interface ChatTester : KIFTestCase
|
||||
|
||||
@end
|
||||
36
KifTests/ChatTester.m
Normal file
36
KifTests/ChatTester.m
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// ChatTester.m
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume on 17/01/2015.
|
||||
//
|
||||
//
|
||||
|
||||
#import "ChatTester.h"
|
||||
#import "KIFTestCase+LinphoneExtras.h"
|
||||
|
||||
@implementation ChatTester
|
||||
|
||||
|
||||
- (void)beforeAll {
|
||||
[self switchToValidAccountIfNeeded];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Chat"];
|
||||
}
|
||||
|
||||
- (void)testSendMessageToMyself {
|
||||
[tester enterText:[self accountUsername] intoViewWithAccessibilityLabel:@"Enter a address"];
|
||||
[tester tapViewWithAccessibilityLabel:@"New Discussion"];
|
||||
|
||||
[tester enterText:@"Hello" intoViewWithAccessibilityLabel:@"Message field"];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Send"];
|
||||
|
||||
[tester waitForViewWithAccessibilityLabel:@"Outgoing message" value:@"Hello" traits:UIAccessibilityTraitStaticText];
|
||||
[tester waitForViewWithAccessibilityLabel:@"Incoming message" value:@"Hello" traits:UIAccessibilityTraitStaticText];
|
||||
|
||||
[tester waitForViewWithAccessibilityLabel:@"Message status" value:@"delivered" traits:UIAccessibilityTraitImage];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
18
KifTests/KIFTestCase+LinphoneExtras.h
Normal file
18
KifTests/KIFTestCase+LinphoneExtras.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// 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
|
||||
54
KifTests/KIFTestCase+LinphoneExtras.m
Normal file
54
KifTests/KIFTestCase+LinphoneExtras.m
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
//
|
||||
// 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
|
||||
13
KifTests/WizardTester.h
Normal file
13
KifTests/WizardTester.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// WizardTester.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume on 17/01/2015.
|
||||
//
|
||||
//
|
||||
|
||||
#import <KIF/Kif.h>
|
||||
|
||||
@interface WizardTester : KIFTestCase
|
||||
|
||||
@end
|
||||
|
|
@ -6,13 +6,10 @@
|
|||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import "WizardTester.h"
|
||||
#import <KIF/KIF.h>
|
||||
|
||||
@interface WizardTester : KIFTestCase
|
||||
|
||||
@end
|
||||
#import "KIFTestCase+LinphoneExtras.h"
|
||||
|
||||
@implementation WizardTester
|
||||
|
||||
|
|
@ -21,30 +18,60 @@
|
|||
|
||||
[tester tapViewWithAccessibilityLabel:@"Settings"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Run assistant"];
|
||||
[tester waitForTimeInterval:2];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
if( [tester tryFindingViewWithAccessibilityLabel:@"Launch Wizard" error:nil]){
|
||||
[tester tapViewWithAccessibilityLabel:@"Launch Wizard"];
|
||||
[tester waitForTimeInterval:1];
|
||||
[tester waitForTimeInterval:0.5];
|
||||
}
|
||||
|
||||
|
||||
// TODO: goto Wizard
|
||||
}
|
||||
|
||||
- (void)afterEach{
|
||||
// TODO: goto Dialer
|
||||
[tester tapViewWithAccessibilityLabel:@"Dialer"];
|
||||
}
|
||||
|
||||
- (void)testLinphoneLogin {
|
||||
#pragma mark - State
|
||||
|
||||
+ (void)switchToValidAccountWithTester:(KIFTestCase*)testCase {
|
||||
}
|
||||
|
||||
#pragma mark - Utilities
|
||||
|
||||
- (void)_linphoneLogin:(NSString*)username withPW:(NSString*)pw {
|
||||
[tester tapViewWithAccessibilityLabel:@"Start"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in linphone.org account"];
|
||||
|
||||
[tester enterText:@"testios" intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:@"testtest" intoViewWithAccessibilityLabel:@"Password"];
|
||||
[tester enterText:username intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:pw intoViewWithAccessibilityLabel:@"Password"];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)_externalLoginWithProtocol:(NSString*)protocol {
|
||||
|
||||
[self setInvalidAccountSet:true];
|
||||
[tester tapViewWithAccessibilityLabel:@"Start"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in SIP account"];
|
||||
|
||||
[tester enterText:@"testios" intoViewWithAccessibilityLabel:@"Username"];
|
||||
[tester enterText:@"testtest" intoViewWithAccessibilityLabel:@"Password"];
|
||||
[tester enterText:@"sip.linphone.org" intoViewWithAccessibilityLabel:@"Domain"];
|
||||
[tester tapViewWithAccessibilityLabel:protocol];
|
||||
|
||||
[tester tapViewWithAccessibilityLabel:@"Sign in"];
|
||||
|
||||
// check the registration state
|
||||
UIView* regState = [tester waitForViewWithAccessibilityLabel:@"Registration state"];
|
||||
[tester waitForTimeInterval:1];
|
||||
[tester expectView:regState toContainText:@"Registered"];
|
||||
}
|
||||
|
||||
#pragma mark - Tests
|
||||
|
||||
- (void)testLinphoneLogin {
|
||||
|
||||
[self _linphoneLogin:@"testios" withPW:@"testtest"];
|
||||
|
||||
// check the registration state
|
||||
UIView* regState = [tester waitForViewWithAccessibilityLabel:@"Registration state"];
|
||||
|
|
@ -53,5 +80,38 @@
|
|||
|
||||
}
|
||||
|
||||
- (void)testLinphoneLoginWithBadPassword {
|
||||
[self _linphoneLogin:@"testios" withPW:@"badPass"];
|
||||
|
||||
[self setInvalidAccountSet:true];
|
||||
|
||||
UIView* alertViewText = [tester waitForViewWithAccessibilityLabel:@"Registration failure" traits:UIAccessibilityTraitStaticText];
|
||||
if( alertViewText ){
|
||||
UIView *reason = [tester waitForViewWithAccessibilityLabel:@"Forbidden" traits:UIAccessibilityTraitStaticText];
|
||||
if( reason == nil ){ [tester fail];
|
||||
} else {
|
||||
[tester tapViewWithAccessibilityLabel:@"OK"]; // alertview
|
||||
[tester tapViewWithAccessibilityLabel:@"Cancel"]; // cancel wizard
|
||||
}
|
||||
} else {
|
||||
[tester fail];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testExternalLoginWithUDP {
|
||||
[self _externalLoginWithProtocol:@"UDP"];
|
||||
}
|
||||
|
||||
- (void)testExternalLoginWithTCP {
|
||||
[self _externalLoginWithProtocol:@"TCP"];
|
||||
}
|
||||
|
||||
- (void)testExternalLoginWithTLS {
|
||||
[self _externalLoginWithProtocol:@"TLS"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -697,6 +697,8 @@
|
|||
F08F119D19C0A65B007D70C2 /* NSObject+DTRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = F08F119C19C0A65B007D70C2 /* NSObject+DTRuntime.m */; };
|
||||
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 */; };
|
||||
|
|
@ -1697,6 +1699,11 @@
|
|||
F095485C1883F68800E8A69B /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = "ru.lproj/WizardViewController~ipad.strings"; sourceTree = "<group>"; };
|
||||
F095485D1883F6E700E8A69B /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/WizardViews.strings; sourceTree = "<group>"; };
|
||||
F095485E1883F6EA00E8A69B /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/WizardViews.strings; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
|
|
@ -3010,6 +3017,11 @@
|
|||
children = (
|
||||
F0F952021A6AEB1000254160 /* Supporting Files */,
|
||||
F0F952111A6AECD300254160 /* WizardTester.m */,
|
||||
F0A1CE091A6B05A4001CA2BE /* WizardTester.h */,
|
||||
F0A1CE061A6B056E001CA2BE /* ChatTester.h */,
|
||||
F0A1CE071A6B056E001CA2BE /* ChatTester.m */,
|
||||
F0A1CE0A1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.h */,
|
||||
F0A1CE0B1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m */,
|
||||
);
|
||||
path = KifTests;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -3981,6 +3993,8 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F0A1CE081A6B056E001CA2BE /* ChatTester.m in Sources */,
|
||||
F0A1CE0C1A6B08FA001CA2BE /* KIFTestCase+LinphoneExtras.m in Sources */,
|
||||
F0F952121A6AECD300254160 /* WizardTester.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue