Skip to content

Commit

Permalink
Merge pull request venmo#46 from brockboland/testfix
Browse files Browse the repository at this point in the history
Improve collapse test, and reset view state after basic flow test
  • Loading branch information
ayanonagon committed Jan 21, 2015
2 parents 211f4ca + 9b71c7d commit abf667d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions VENTokenFieldSampleTests/VENTokenFieldSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ - (void)testBasicFlow
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Octocat,"];

// Clear remaining names to reset state for next test
[tester tapViewWithAccessibilityLabel:@"To"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
}

- (void)testResignFirstResponder
Expand All @@ -49,9 +58,41 @@ - (void)testResignFirstResponderAndCollapse
{
[tester tapViewWithAccessibilityLabel:@"To"];
[tester tapViewWithAccessibilityLabel:@"Resign First Responder"];
[tester waitForAbsenceOfKeyboard];
[tester tapViewWithAccessibilityLabel:@"Collapse token field"];

// Confirm the collapse lable
[tester waitForViewWithAccessibilityLabel:@"0 people"];

// Tap on the field and enter names. Lable isn't tappable, so tap the point.
UIView *tokenField = [tester waitForViewWithAccessibilityLabel:@"0 people"];
[tester tapScreenAtPoint:tokenField.center];

[tester enterTextIntoCurrentFirstResponder:@"Ayaka\n"];
[tester waitForViewWithAccessibilityLabel:@"Ayaka,"];

[tester enterTextIntoCurrentFirstResponder:@"Mark\n"];
[tester waitForViewWithAccessibilityLabel:@"Mark,"];

[tester enterTextIntoCurrentFirstResponder:@"Neeraj\n"];
[tester waitForViewWithAccessibilityLabel:@"Neeraj,"];

[tester enterTextIntoCurrentFirstResponder:@"Octocat\n"];
[tester waitForViewWithAccessibilityLabel:@"Octocat,"];

[tester tapViewWithAccessibilityLabel:@"Resign First Responder"];
[tester waitForAbsenceOfKeyboard];
[tester tapViewWithAccessibilityLabel:@"Collapse token field"];

// Confirm the collapse label
[tester waitForViewWithAccessibilityLabel:@"4 people"];

// Remove one name and check again
[tester tapScreenAtPoint:tokenField.center];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester enterTextIntoCurrentFirstResponder:@"\b"];
[tester tapViewWithAccessibilityLabel:@"Resign First Responder"];
[tester waitForAbsenceOfKeyboard];
[tester tapViewWithAccessibilityLabel:@"Collapse token field"];
[tester waitForViewWithAccessibilityLabel:@"3 people"];
}
Expand Down

0 comments on commit abf667d

Please sign in to comment.