LinphoneUITester: activate local notifications on testing

This commit is contained in:
Gautier Pelloux-Prayer 2015-07-08 14:09:29 +02:00
parent 422570433d
commit e0c3f2419f
8 changed files with 46 additions and 40 deletions

@ -1 +1 @@
Subproject commit 976aafa2e211dd095411bfef09da6c0919d70476
Subproject commit 1fe66431b824990a58f1ae063bf0e2151079e90e

View file

@ -174,30 +174,33 @@
BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"];
BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"];
if ([app respondsToSelector:@selector(registerUserNotificationSettings:)]) {
/* iOS8 notifications can be actioned! Awesome: */
UIUserNotificationType notifTypes =
UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
if( !instance.isTesting ){
if( [app respondsToSelector:@selector(registerUserNotificationSettings:)] ){
/* iOS8 notifications can be actioned! Awesome: */
UIUserNotificationType notifTypes = UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert;
NSSet *categories =
[NSSet setWithObjects:[self getCallNotificationCategory], [self getMessageNotificationCategory], nil];
UIUserNotificationSettings *userSettings =
[UIUserNotificationSettings settingsForTypes:notifTypes categories:categories];
[app registerUserNotificationSettings:userSettings];
NSSet* categories = [NSSet setWithObjects:[self getCallNotificationCategory], [self getMessageNotificationCategory], nil];
UIUserNotificationSettings* userSettings = [UIUserNotificationSettings settingsForTypes:notifTypes categories:categories];
[app registerUserNotificationSettings:userSettings];
[app registerForRemoteNotifications];
} else {
NSUInteger notifTypes = UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeNewsstandContentAvailability;
[app registerForRemoteNotificationTypes:notifTypes];
}
} else {
NSLog(@"No remote push for testing");
}
if (!instance.isTesting) {
[app registerForRemoteNotifications];
}
} else {
if (!instance.isTesting) {
NSUInteger notifTypes = UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeNewsstandContentAvailability;
[app registerForRemoteNotificationTypes:notifTypes];
}
}
if (state == UIApplicationStateBackground)
{
// we've been woken up directly to background;
if( !start_at_boot || !background_mode ) {
// autoboot disabled or no background, and no push: do nothing and wait for a real launch
if (state == UIApplicationStateBackground) {
// we've been woken up directly to background;
if (!start_at_boot || !background_mode) {
// autoboot disabled or no background, and no push: do nothing and wait for a real launch
/*output a log with NSLog, because the ortp logging system isn't activated yet at this time*/
NSLog(@"Linphone launch doing nothing because start_at_boot or background_mode are not activated.", NULL);
return YES;

View file

@ -28,6 +28,7 @@
}
- (void)afterAll {
[super afterAll];
// at the end of tests, go back to chat rooms to display main bar
if ([tester tryFindingTappableViewWithAccessibilityLabel:@"Back" error:nil]) {
[self goBackFromChat];

View file

@ -15,7 +15,8 @@
#pragma mark - Setup
- (void)beforeAll {
[tester tapViewWithAccessibilityLabel:@"Contacts"];
[super beforeAll];
[tester tapViewWithAccessibilityLabel:@"Contacts"];
}
#pragma mark - Utils

View file

@ -48,7 +48,8 @@
- (void)beforeAll{
#if TARGET_IPHONE_SIMULATOR
[tester acknowledgeSystemAlert];
[tester acknowledgeSystemAlert]; // Contact access alert
[tester acknowledgeSystemAlert]; // Local notification / badge alert
#endif
[super beforeAll];
}

View file

@ -13,19 +13,21 @@
@implementation WizardTester
- (void)beforeEach {
[UIView setAnimationsEnabled:false];
[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];
}
[super beforeEach];
[UIView setAnimationsEnabled:false];
[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];
}
}
- (void)afterEach{
[tester tapViewWithAccessibilityLabel:@"Dialer"];
[super afterEach];
[tester tapViewWithAccessibilityLabel:@"Dialer"];
}
#pragma mark - State
@ -68,10 +70,6 @@
#pragma mark - Tests
- (void)testExternalLoginWithUDP {
[self _externalLoginWithProtocol:@"UDP"];
}
- (void)testExternalLoginWithTCP {
[self _externalLoginWithProtocol:@"TCP"];
}
@ -80,6 +78,10 @@
[self _externalLoginWithProtocol:@"TLS"];
}
- (void)testExternalLoginWithUDP {
[self _externalLoginWithProtocol:@"UDP"];
}
- (void)testLinphoneLogin {
[self _linphoneLogin:[self me] withPW:@"testtest"];

View file

@ -7,7 +7,6 @@ edge_bw=10
[sip]
contact="Linphone iPhone" <sip:linphone.iphone@unknown-host>
keepalive_period=30000
default_proxy=0
sip_port=-1
sip_tcp_port=-1
use_ipv6=0

View file

@ -7,7 +7,6 @@ edge_bw=10
[sip]
contact="Linphone iPhone" <sip:linphone.iphone@unknown-host>
keepalive_period=30000
default_proxy=0
sip_port=-1
sip_tcp_port=-1
use_ipv6=0