TestsUI: fix push notification test

This commit is contained in:
Gautier Pelloux-Prayer 2016-03-21 11:23:54 +01:00
parent bb2b0d2035
commit ccffb7d5a9
4 changed files with 21 additions and 12 deletions

View file

@ -34,16 +34,6 @@
#pragma mark - tools
- (void)removeAllRooms {
if (![tester tryFindingTappableViewWithAccessibilityLabel:@"Edit" error:nil])
return;
[tester tapViewWithAccessibilityLabel:@"Edit" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"Select all" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"Delete all" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"DELETE" traits:UIAccessibilityTraitButton];
}
- (void)dismissKeyboard {
[tester tapScreenAtPoint:CGPointMake(0, 0)]; // dismiss keyboard, if any
}

View file

@ -26,6 +26,8 @@
- (void)waitForRegistration;
- (void)removeAllRooms;
@end
#define ASSERT_EQ(actual, expected) \

View file

@ -180,4 +180,14 @@
traits:UIAccessibilityTraitButton];
}
- (void)removeAllRooms {
if (![tester tryFindingTappableViewWithAccessibilityLabel:@"Edit" error:nil])
return;
[tester tapViewWithAccessibilityLabel:@"Edit" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"Select all" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"Delete all" traits:UIAccessibilityTraitButton];
[tester tapViewWithAccessibilityLabel:@"DELETE" traits:UIAccessibilityTraitButton];
}
@end

View file

@ -17,13 +17,20 @@
[self switchToValidAccountIfNeeded];
}
- (void)testCallNotificationInBackground {
- (void)testChatRemoteNotification {
[tester tapViewWithAccessibilityLabel:@"Chat"];
[self removeAllRooms];
const LinphoneAddress *addr =
linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(LC));
LinphoneChatMessage *msg = linphone_chat_room_create_message(linphone_core_get_chat_room(LC, addr), "hello my own");
linphone_chat_room_send_chat_message(linphone_core_get_chat_room(LC, addr), msg);
linphone_core_set_network_reachable(LC, NO);
[tester waitForViewWithAccessibilityLabel:@"hello my own"];
[tester tapViewWithAccessibilityLabel:@"Chat"];
[tester waitForViewWithAccessibilityLabel:@"Contact name, Message"
value:[NSString stringWithFormat:@"%@, hello my own (1)", self.me]
traits:UIAccessibilityTraitStaticText];
}
#endif