From ccffb7d5a9198506d14db27e56f58d2300ce51d2 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 21 Mar 2016 11:23:54 +0100 Subject: [PATCH] TestsUI: fix push notification test --- TestsUI/ChatTester.m | 10 ---------- TestsUI/LinphoneTestCase.h | 2 ++ TestsUI/LinphoneTestCase.m | 10 ++++++++++ TestsUI/NotificationTester.m | 11 +++++++++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/TestsUI/ChatTester.m b/TestsUI/ChatTester.m index 2ce33ade4..49040d353 100644 --- a/TestsUI/ChatTester.m +++ b/TestsUI/ChatTester.m @@ -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 } diff --git a/TestsUI/LinphoneTestCase.h b/TestsUI/LinphoneTestCase.h index 0ac72f0ee..768604ef3 100644 --- a/TestsUI/LinphoneTestCase.h +++ b/TestsUI/LinphoneTestCase.h @@ -26,6 +26,8 @@ - (void)waitForRegistration; +- (void)removeAllRooms; + @end #define ASSERT_EQ(actual, expected) \ diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m index 97d8c387e..64ac658c9 100644 --- a/TestsUI/LinphoneTestCase.m +++ b/TestsUI/LinphoneTestCase.m @@ -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 diff --git a/TestsUI/NotificationTester.m b/TestsUI/NotificationTester.m index 677254587..e9b8699bb 100644 --- a/TestsUI/NotificationTester.m +++ b/TestsUI/NotificationTester.m @@ -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