Example tests for KIF
See if a view is displayed.
it(@"should be able to load a table view controller", ^{ [tester waitForViewWithAccessibilityLabel:@"Locations Table"]; }
Tap a cell in a table view controller.
it(@"should be able to tap a cell in a table view controller", ^{ NSIndexPath *thirdLocation = [NSIndexPath indexPathForRow:2 inSection:0]; [tester tapRowAtIndexPath:thirdLocation inTableViewWithAccessibilityIdentifier:@"Locations Table"]; }
Tap a view (such as a button)
it(@"should be able to tap a cell in a table view controller", ^{ [tester tapRowAtIndexPath:thirdLocation inTableViewWithAccessibilityIdentifier:@"Locations Table"]; }
Check text of a cell
it(@"should have the correct third element in the table view", ^{ NSIndexPath *thirdLocation = [NSIndexPath indexPathForRow:2 inSection:0]; UITableViewCell *cell = (UITableViewCell*)[tester waitForCellAtIndexPath:thirdLocation inTableViewWithAccessibilityIdentifier:@"Locations Table"]; expect(cell.textLabel.text).to.equal(@"Statue Of Liberty"); expect(cell.detailTextLabel.text).to.equal(@"1"); });
Accessibility Label
KIF is relying on the accessibility label to find the views on the app. The accessibility label is on the identity inspector or it can be set programmatically.

Programmatically (in viewDidLoad of a table view controller for example):
self.tableView.accessibilityIdentifier = @"Trivia Table";