Testing Titanium iphone builds using uispec
Hi,
I'm currently testing Titanium iphone builds using uispec.
It's fast and easy and may be an awesome way to test Titanium applications, even in TDD. It requires to access to the main.m to insert UISpec initialization, which is unfortunately available only in the 0.8.1 release and not in the 1.2.1 one.
Anyway, in order to check the content of tables, I need to know how to access to the text of the cells.
i.e. : my view is composed by a TableView containing 2 sections. To access to a row within a section through uispec API, I do the following :
UITableView *tableView = app.tableView;
UITableViewCell *cell = [[tableView dataSource] tableView:table cellForRowAtIndexPath:indexPath];
Then, I'm seeking a way to check the content of this cell, but if fails :
[expectThat(cell.textLabel.text) should:be(@"taxation")];
Which returns expected: taxation, got: nil, whereas taxation is displayed in the view.
The question is : how to access to the text of a UITableViewCell in a Titanium iphone builds ?
1 Answer
-
Finally, I succeeded to fix this issue with the following (release 0.8.1) :
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:1]; ComplexTableViewCell *cell = [[mainMenuView dataSource] tableView:mainMenuView cellForRowAtIndexPath:indexPath]; TitaniumCellWrapper *data = cell.dataWrapper; [expectThat(data.title) should:be(@"Navigation")];
Is this solution acceptable from the Titanium team point of view ?