Add a tester for contact edition

This commit is contained in:
Guillaume BIENKOWSKI 2015-03-04 22:27:54 +01:00
parent 1264af51a0
commit 121b709d22

View file

@ -46,11 +46,13 @@
if( lastName )
[self setText:lastName forContactHeaderIndex:1];
if ( phone )
[self setText:phone forContactNumbersIndex:0 inSection:ContactSections_Number];
if ( phone ){
[self setText:phone forContactNumbersIndex:0 inSection:ContactSections_Number];
}
if (sip)
if ( sip ){
[self setText:sip forContactNumbersIndex:0 inSection:ContactSections_Sip];
}
[tester tapViewWithAccessibilityLabel:@"Edit"];
[tester tapViewWithAccessibilityLabel:@"Back"];
@ -65,7 +67,7 @@
NSString* fullName = [contactName stringByAppendingString:@" dummy"];
[tester tapViewWithAccessibilityLabel:@"Firstname, Lastname" value:fullName traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Edit"];
[tester scrollViewWithAccessibilityIdentifier:@"Contact numbers table" byFractionOfSizeHorizontal:0 vertical:-0.9];
@ -75,4 +77,53 @@
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Firstname, Lastname" value:fullName traits:UIAccessibilityTraitStaticText];
}
- (void)addNumbersToSection:(NSInteger)section numbers:(NSArray*)numbers {
[tester tapViewWithAccessibilityLabel:@"Edit"];
for(NSInteger i = 0; i<numbers.count;i++){
[self setText:[numbers objectAtIndex:i] forContactNumbersIndex:i inSection:section];
// now tap the "+" to add a new item. This is not optimal, since it will tap the first instance with that name.
// we should do something like "[tester tapViewWithAccessibilityLabel:@"Insert linphone" atRowIndex:i inSection:section]"
[tester tapViewWithAccessibilityLabel:@"Insert Linphone"];
}
[tester tapViewWithAccessibilityLabel:@"Edit"];
for(NSInteger i = 0; i<numbers.count;i++){
[tester waitForViewWithAccessibilityLabel:[@"Linphone, " stringByAppendingString:[numbers objectAtIndex:i]]
traits:UIAccessibilityTraitStaticText];
}
}
- (void)testEditContact {
NSString* contactName = [self getUUID];
NSString* fullName = [contactName stringByAppendingString:@" dummy"];
[self createContact:contactName lastName:@"dummy" phoneNumber:nil SIPAddress:nil];
[tester tapViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
/* Phone number */
NSArray* phones = @[@"01234", @"56789"];
NSLog(@"add phones");
[self addNumbersToSection:ContactSections_Number numbers:phones];
NSArray* SIPs = @[@"sip1", @"sip2"];
[self addNumbersToSection:ContactSections_Sip numbers:SIPs];
// remove all these numbers, doesn't quite work today...
[tester tapViewWithAccessibilityLabel:@"Edit"];
for(NSInteger i = 0; i< (phones.count+SIPs.count); i++){
[tester tapViewWithAccessibilityLabel:@"Delete Linphone"];
[tester tapViewWithAccessibilityLabel:@"Delete"];
}
[tester tapViewWithAccessibilityLabel:@"Edit"];
// then remove the contact
[tester tapViewWithAccessibilityLabel:@"Edit"];
[tester tapViewWithAccessibilityLabel:@"Remove"];
[tester waitForAbsenceOfViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
}
@end