Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve collapse test, and reset view state after basic flow test #46

Merged
merged 1 commit into from
Jan 21, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve collapse test, and reset view state after basic flow test. Fixes
  • Loading branch information
brockboland committed Jan 20, 2015
commit 9b71c7de9ccc1b61c7f25b16dcefe0d08453a534
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