mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-28 22:26:21 +00:00
LinphoneUITester: fix last failing test on travis by manually clicking Delete button in contact edit
This commit is contained in:
parent
ea99ba5b3d
commit
422570433d
1 changed files with 24 additions and 9 deletions
|
|
@ -79,10 +79,7 @@
|
||||||
traits:UIAccessibilityTraitStaticText];
|
traits:UIAccessibilityTraitStaticText];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tapEditButtonForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section {
|
- (void)tapCellForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section atX:(CGFloat)x {
|
||||||
// tap the "+" to add a new item (or "-" to delete it).... WOW, this code is ugly!
|
|
||||||
// the thing is: we don't handle the "+" button ourself (system stuff)
|
|
||||||
// so it is not present in the tableview cell... so we tap on a fixed position of screen :)
|
|
||||||
UITableView *tv = [self findTableView:@"Contact numbers table"];
|
UITableView *tv = [self findTableView:@"Contact numbers table"];
|
||||||
NSIndexPath *path = [NSIndexPath indexPathForRow:idx inSection:section];
|
NSIndexPath *path = [NSIndexPath indexPathForRow:idx inSection:section];
|
||||||
UITableViewCell *last =
|
UITableViewCell *last =
|
||||||
|
|
@ -90,10 +87,21 @@
|
||||||
XCTAssertNotNil(last);
|
XCTAssertNotNil(last);
|
||||||
|
|
||||||
CGRect cellFrame = [last.contentView convertRect:last.contentView.frame toView:tv];
|
CGRect cellFrame = [last.contentView convertRect:last.contentView.frame toView:tv];
|
||||||
[tv tapAtPoint:CGPointMake(10, cellFrame.origin.y + cellFrame.size.height / 2.)];
|
[tv tapAtPoint:CGPointMake(x > 0 ? x : cellFrame.size.width + x, cellFrame.origin.y + cellFrame.size.height / 2.)];
|
||||||
[tester waitForAnimationsToFinish];
|
[tester waitForAnimationsToFinish];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)tapRemoveButtonForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section {
|
||||||
|
[self tapCellForRowAtIndexPath:idx inSection:section atX:-10];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tapEditButtonForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section {
|
||||||
|
// tap the "+" to add a new item (or "-" to delete it).... WOW, this code is ugly!
|
||||||
|
// the thing is: we don't handle the "+" button ourself (system stuff)
|
||||||
|
// so it is not present in the tableview cell... so we tap on a fixed position of screen :)
|
||||||
|
[self tapCellForRowAtIndexPath:idx inSection:section atX:10];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)addEntries:(NSArray *)numbers inSection:(NSInteger)section {
|
- (void)addEntries:(NSArray *)numbers inSection:(NSInteger)section {
|
||||||
[tester tapViewWithAccessibilityLabel:@"Edit"];
|
[tester tapViewWithAccessibilityLabel:@"Edit"];
|
||||||
[self setText:[numbers objectAtIndex:0] forContactNumbersIndex:0 inSection:section];
|
[self setText:[numbers objectAtIndex:0] forContactNumbersIndex:0 inSection:section];
|
||||||
|
|
@ -109,6 +117,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)deleteContactEntryForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section {
|
||||||
|
if ([tester tryFindingViewWithAccessibilityLabel:@"Delete" error:nil]) {
|
||||||
|
[tester tapViewWithAccessibilityLabel:@"Delete"];
|
||||||
|
} else {
|
||||||
|
// hack: Travis seems to be unable to click on delete for what ever reason
|
||||||
|
[self tapRemoveButtonForRowAtIndexPath:idx inSection:section];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)testEditContact {
|
- (void)testEditContact {
|
||||||
NSString* contactName = [self getUUID];
|
NSString* contactName = [self getUUID];
|
||||||
NSString* fullName = [contactName stringByAppendingString:@" dummy"];
|
NSString* fullName = [contactName stringByAppendingString:@" dummy"];
|
||||||
|
|
@ -126,14 +143,12 @@
|
||||||
// remove all numbers
|
// remove all numbers
|
||||||
for (NSInteger i = 0; i < phones.count; i++) {
|
for (NSInteger i = 0; i < phones.count; i++) {
|
||||||
[self tapEditButtonForRowAtIndexPath:0 inSection:ContactSections_Number];
|
[self tapEditButtonForRowAtIndexPath:0 inSection:ContactSections_Number];
|
||||||
[tester waitForTappableViewWithAccessibilityLabel:@"Delete"];
|
[self deleteContactEntryForRowAtIndexPath:0 inSection:ContactSections_Number];
|
||||||
[tester tapViewWithAccessibilityLabel:@"Delete"];
|
|
||||||
}
|
}
|
||||||
// remove all SIPs
|
// remove all SIPs
|
||||||
for (NSInteger i = 0; i < SIPs.count; i++) {
|
for (NSInteger i = 0; i < SIPs.count; i++) {
|
||||||
[self tapEditButtonForRowAtIndexPath:0 inSection:ContactSections_Sip];
|
[self tapEditButtonForRowAtIndexPath:0 inSection:ContactSections_Sip];
|
||||||
[tester waitForTappableViewWithAccessibilityLabel:@"Delete"];
|
[self deleteContactEntryForRowAtIndexPath:0 inSection:ContactSections_Sip];
|
||||||
[tester tapViewWithAccessibilityLabel:@"Delete"];
|
|
||||||
}
|
}
|
||||||
[tester tapViewWithAccessibilityLabel:@"Edit"];
|
[tester tapViewWithAccessibilityLabel:@"Edit"];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue