LinphoneUITester: fix some tests

This commit is contained in:
Gautier Pelloux-Prayer 2015-09-14 17:26:29 +02:00
parent f8c1ae3c9a
commit 3a222410ea
8 changed files with 23 additions and 17 deletions

View file

@ -43,7 +43,7 @@
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tableView.accessibilityIdentifier = @"Chat list";
self.tableView.accessibilityIdentifier = @"ChatRoom list";
[self reloadData];
}

View file

@ -157,9 +157,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[messageBackgroundImage setImage:[TUNinePatchCache imageOfSize:[messageBackgroundImage bounds].size
forNinePatchNamed:@"chat_message_background"]];
BOOL fileSharingEnabled =
[[LinphoneManager instance] lpConfigStringForKey:@"sharing_server_preference"] != NULL &&
[[[LinphoneManager instance] lpConfigStringForKey:@"sharing_server_preference"] length] > 0;
BOOL fileSharingEnabled = [LinphoneManager.instance lpConfigStringForKey:@"sharing_server_preference"].length > 0;
[pictureButton setEnabled:fileSharingEnabled];
}

View file

@ -52,7 +52,7 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tableView.accessibilityIdentifier = @"ChatRoom list";
self.tableView.accessibilityIdentifier = @"Chat list";
[self loadData];
}

View file

@ -781,8 +781,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[lm lpConfigSetInt:[self integerForKey:@"advanced_account_preference"] forKey:@"advanced_account_preference"];
NSString *sharing_server = [self stringForKey:@"sharing_server_preference"];
[[LinphoneManager instance] lpConfigSetString:sharing_server forKey:@"sharing_server_preference"];
[[LinphoneManager instance] lpConfigSetString:[self stringForKey:@"sharing_server_preference"]
forKey:@"sharing_server_preference"];
}
changedDict = [[NSMutableDictionary alloc] init];

View file

@ -238,6 +238,7 @@ static UICompositeViewDescription *compositeDescription = nil;
LOGE(@"cannot set transport");
}
[LinphoneManager.instance lpConfigSetBool:TRUE forKey:@"file_transfer_migration_done"];
[[LinphoneManager instance] lpConfigSetString:@"" forKey:@"sharing_server_preference"];
[[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"ice_preference"];
[[LinphoneManager instance] lpConfigSetString:@"" forKey:@"stun_preference"];

View file

@ -63,7 +63,7 @@
}
- (void)uploadImageWithQuality:(NSString *)quality {
UITableView *tv = [self findTableView:@"Chat list"];
UITableView *tv = [self findTableView:@"ChatRoom list"];
long messagesCount = [tv numberOfRowsInSection:0];
[tester tapViewWithAccessibilityLabel:@"Send picture"];
@ -111,7 +111,7 @@
[tester tapViewWithAccessibilityLabel:@"Anna Haro"];
[tester tapViewWithAccessibilityLabel:@"home, 555-522-8243"];
[self goBackFromChat];
UITableView *tv = [self findTableView:@"ChatRoom list"];
UITableView *tv = [self findTableView:@"Chat list"];
ASSERT_EQ([tv numberOfRowsInSection:0], 1);
[tester waitForViewWithAccessibilityLabel:@"Contact name, Message"
value:@"Anna Haro (0)"
@ -167,7 +167,7 @@
[tester tapViewWithAccessibilityLabel:@"Chat"];
NSTimeInterval after = [[NSDate date] timeIntervalSince1970];
XCTAssertEqual([[self findTableView:@"ChatRoom list"] numberOfRowsInSection:0], 100);
XCTAssertEqual([[self findTableView:@"Chat list"] numberOfRowsInSection:0], 100);
// conversation loading MUST be less than 1 sec
XCTAssertLessThan(after - before, 1.);
}
@ -177,11 +177,18 @@
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(lc, [[self me] UTF8String]);
// generate lots of messages...
for (; count < 100; count++) {
for (; count < 50; count++) {
linphone_chat_room_send_message(room, [[NSString stringWithFormat:@"Message %d", count + 1] UTF8String]);
}
[tester waitForTimeInterval:5]; // wait for all messages to be delivered
// TODO: FIX below code: unread count is not always 100 messages while it should...
UITableView *tv = [self findTableView:@"ChatRoom list"];
for (int i = 0; i < 25; i++) {
[tester waitForTimeInterval:1.f];
if ([tv numberOfRowsInSection:0] == count) {
break;
}
}
[tester waitForViewWithAccessibilityLabel:@"Contact name, Message, Unread message number"
value:[NSString stringWithFormat:@"%@ - Message %d (%d)", self.me, count, count]
traits:UIAccessibilityTraitStaticText];
@ -251,7 +258,7 @@
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
UITableView *tv = [self findTableView:@"ChatRoom list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
@ -282,7 +289,7 @@
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
UITableView *tv = [self findTableView:@"ChatRoom list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];

View file

@ -121,7 +121,7 @@ static bool invalidAccount = true;
ms_free(server_addr);
LinphoneAuthInfo *testAuth = linphone_auth_info_new(linphone_address_get_username(testAddr), NULL,
linphone_address_get_password(testAddr), NULL, NULL,
linphone_address_get_username(testAddr), NULL, NULL,
linphone_address_get_domain(testAddr));
[[LinphoneManager instance] configurePushTokenForProxyConfig:testProxy];

@ -1 +1 @@
Subproject commit d671e139355e98a231704cf4bf50ad94208b037c
Subproject commit 654990ac5c221f87b1ea97e8bf2f3c7639d6d96b