Wizard: display "Incorrect username or password" instead of "Forbidden" when failing to register

This commit is contained in:
Gautier Pelloux-Prayer 2015-09-04 14:39:13 +02:00
parent 04551d7f67
commit 9395ea63c5
3 changed files with 81 additions and 77 deletions

View file

@ -545,6 +545,9 @@ static UICompositeViewDescription *compositeDescription = nil;
}
case LinphoneRegistrationFailed: {
[waitView setHidden:true];
if ([message isEqualToString:@"Forbidden"]) {
message = NSLocalizedString(@"Incorrect username or password.", nil);
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure", nil)
message:message
delegate:nil

View file

@ -101,73 +101,11 @@
[tester waitForViewWithAccessibilityLabel:@"Download"];
[tester tapViewWithAccessibilityLabel:@"Download"];
[tester waitForTimeInterval:.5f]; // just wait a few secs to start download
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 1);
ASSERT_EQ(LinphoneManager.instance.fileTransferDelegates.count, 1);
}
#pragma mark - tests
- (void)test3DownloadsSimultanously {
[self startChatWith:[self me]];
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
if ([tv numberOfRowsInSection:0] == 6)
break;
}
[tester waitForTimeInterval:.5f];
ASSERT_EQ([[LinphoneManager instance] fileTransferDelegates].count, 0);
[tester scrollViewWithAccessibilityIdentifier:@"Chat list" byFractionOfSizeHorizontal:0.f vertical:1.f];
for (int i = 0; i < 3; i++) {
// messages order is not known: if upload bitrate is huge, first image can be uploaded before last started
while (![tester tryFindingTappableViewWithAccessibilityLabel:@"Download" error:nil]) {
[tester scrollViewWithAccessibilityIdentifier:@"Chat list" byFractionOfSizeHorizontal:0.f vertical:-.1f];
}
[tester waitForViewWithAccessibilityLabel:@"Download"];
[tester tapViewWithAccessibilityLabel:@"Download"];
[tester waitForTimeInterval:.2f]; // just wait a few secs to start download
}
while ([LinphoneManager instance].fileTransferDelegates.count > 0) {
[tester waitForTimeInterval:.5];
}
[self goBackFromChat];
}
- (void)test3UploadsSimultanously {
[self startChatWith:[self me]];
// use Maximum quality to be sure that first transfer is not terminated when the third begins
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
if ([tv numberOfRowsInSection:0] == 6)
break;
}
[tester waitForTimeInterval:.5f];
ASSERT_EQ([[LinphoneManager instance] fileTransferDelegates].count, 0);
ASSERT_EQ([tv numberOfRowsInSection:0], 6);
[self goBackFromChat];
}
- (void)testCancelDownloadImage {
[self downloadImage];
[tester tapViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
}
- (void)testCancelUploadImage {
[self startChatWith:[self me]];
[self uploadImageWithQuality:@"Minimum"];
[tester tapViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
}
- (void)testChatFromContactPhoneNumber {
[tester tapViewWithAccessibilityLabel:@"New Discussion"];
[tester tapViewWithAccessibilityLabel:@"Anna Haro"];
@ -180,10 +118,12 @@
traits:UIAccessibilityTraitStaticText];
}
- (void)testDownloadImage {
[self downloadImage];
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
- (void)testInvalidSIPAddress {
[self startChatWith:@"sip://toto"];
[tester waitForViewWithAccessibilityLabel:@"Invalid address" traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Cancel"];
}
- (void)testMessageRemoval {
@ -214,14 +154,6 @@
[self goBackFromChat];
}
- (void)testInvalidSIPAddress {
[self startChatWith:@"sip://toto"];
[tester waitForViewWithAccessibilityLabel:@"Invalid address" traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Cancel"];
}
- (void)testPerformanceHugeChatList {
[tester tapViewWithAccessibilityLabel:@"Dialer"];
@ -317,7 +249,75 @@
[self goBackFromChat];
}
- (void)testUploadImage {
- (void)testTransfer3DownloadsSimultanously {
[self startChatWith:[self me]];
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
if ([tv numberOfRowsInSection:0] == 6)
break;
}
[tester waitForTimeInterval:.5f];
ASSERT_EQ([[LinphoneManager instance] fileTransferDelegates].count, 0);
[tester scrollViewWithAccessibilityIdentifier:@"Chat list" byFractionOfSizeHorizontal:0.f vertical:1.f];
for (int i = 0; i < 3; i++) {
// messages order is not known: if upload bitrate is huge, first image can be uploaded before last started
while (![tester tryFindingTappableViewWithAccessibilityLabel:@"Download" error:nil]) {
[tester scrollViewWithAccessibilityIdentifier:@"Chat list" byFractionOfSizeHorizontal:0.f vertical:-.1f];
}
[tester waitForViewWithAccessibilityLabel:@"Download"];
[tester tapViewWithAccessibilityLabel:@"Download"];
[tester waitForTimeInterval:.2f]; // just wait a few secs to start download
}
while ([LinphoneManager instance].fileTransferDelegates.count > 0) {
[tester waitForTimeInterval:.5];
}
[self goBackFromChat];
}
- (void)testTransfer3UploadsSimultanously {
[self startChatWith:[self me]];
// use Maximum quality to be sure that first transfer is not terminated when the third begins
[self uploadImageWithQuality:@"Maximum"];
[self uploadImageWithQuality:@"Average"];
[self uploadImageWithQuality:@"Minimum"];
UITableView *tv = [self findTableView:@"Chat list"];
// wait for ALL uploads to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
if ([tv numberOfRowsInSection:0] == 6)
break;
}
[tester waitForTimeInterval:.5f];
ASSERT_EQ([[LinphoneManager instance] fileTransferDelegates].count, 0);
ASSERT_EQ([tv numberOfRowsInSection:0], 6);
[self goBackFromChat];
}
- (void)testTransferCancelDownloadImage {
[self downloadImage];
[tester tapViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
}
- (void)testTransferCancelUploadImage {
[self startChatWith:[self me]];
[self uploadImageWithQuality:@"Minimum"];
[tester tapViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
}
- (void)testTransferDownloadImage {
[self downloadImage];
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Cancel transfer"];
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
}
- (void)testTransferUploadImage {
[self startChatWith:[self me]];
ASSERT_EQ([[LinphoneManager instance] fileTransferDelegates].count, 0);

View file

@ -116,7 +116,8 @@
UIView *alertViewText =
[tester waitForViewWithAccessibilityLabel:@"Registration failure" traits:UIAccessibilityTraitStaticText];
if (alertViewText) {
UIView *reason = [tester waitForViewWithAccessibilityLabel:@"Forbidden" traits:UIAccessibilityTraitStaticText];
UIView *reason = [tester waitForViewWithAccessibilityLabel:@"Incorrect username or password."
traits:UIAccessibilityTraitStaticText];
if (reason == nil) {
[tester fail];
} else {