Skip to content

Let 'waitForCellAtIndexPath' actually wait for a cell at a given index p...#414

Merged
phatmann merged 1 commit into
kif-framework:masterfrom
danydev:waitForCellImproved
Jun 23, 2014
Merged

Let 'waitForCellAtIndexPath' actually wait for a cell at a given index p...#414
phatmann merged 1 commit into
kif-framework:masterfrom
danydev:waitForCellImproved

Conversation

@danydev
Copy link
Copy Markdown
Contributor

@danydev danydev commented Jun 21, 2014

...ath

This pull request gives more flexibility when dealing with tableviews and collectionviews.
In our application we usually show an empty tableview, where the content is updated through a web request.
Currently on KIF the method waits only the tableview, assuming that if we have the table view, we should have also the cell, that's not always true, indeed in our application it always result on "cell not found" error.
I expanded the method to actually wait for an existent cell at a given index path.

@phatmann
Copy link
Copy Markdown
Contributor

If I understand your change correctly, you are waiting for reloadData to be called and for it to complete. That is different than what the title of the pull request says, but nevertheless this is a good change. If you squash the commits I can merge it in.

@danydev
Copy link
Copy Markdown
Contributor Author

danydev commented Jun 23, 2014

Rebased and forced push.

Well, yes, basically with this pull request KIF, will wait the cell to be visible before failing.

Let's say you have a View Controller where a tableview displays a list of products obtained through a http request.
Without the pull request, you would have a fail just after
[tester tapRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] inTableViewWithAccessibilityIdentifier:@"YourTableViewLabel];
Because the tableview is found but the cell is not there, with this change, the method will actually wait the cell to appear.
In our example we'll have something like
0- Our test uses tapRowAtIndexPath:inTableViewWithAccessibilityIdentifier
1- viewWillAppear shows empty tableView
2- viewWillAppear starts request
3- receive response, parse data
4- update dataSource
5- reloadData (or beginUpdates\endUpdates)
6- the cell appears and can be tapped.

Without the pull request we have a fail just after 1, with the pull request the test will succeed.

phatmann added a commit that referenced this pull request Jun 23, 2014
Let 'waitForCellAtIndexPath' actually wait for a cell at a given index p...
@phatmann phatmann merged commit d71c257 into kif-framework:master Jun 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants