MonkeyTalk:验证自定义的UITableViewCell标签的文本,而不选择单元格 [英] MonkeyTalk : Verify custom UITableViewCell Label text without select the cell

查看:247
本文介绍了MonkeyTalk:验证自定义的UITableViewCell标签的文本,而不选择单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,有一个搜索框和UITableView的自定义UITableViewCells一个iPhone应用程序。此表用户后的搜索结果加载输入一个搜索词,点击搜索。
我需要测试与MonkeyTalk搜索结果中。 (使用MonkeyTalk脚本或它的JavaScript版本)。我想检索/验证第二标签的第一CustomUITableViewCell包含搜索文本而不选择单元格。

I have an iPhone application that has a search box and UITableView with custom UITableViewCells. This Table Loaded with search results after user enter a search word and tap search. I need to test the search results with MonkeyTalk. (using MonkeyTalk script or JavaScript version of it). I want to retrieve/verify that 2nd Label of first CustomUITableViewCell contains the search text without selecting the cell.

到目前为止,我能够得到使用的每个表款的项目数

So far I'm able to get number of items of the each table section using

var count = app.table().get("count", "size(sectionNo)"); //java script version

和我能够检索成功默认UITableViewCells标题或文字的细​​节与

and I'm able to retrieve title or detail text of default UITableViewCells successfully with

var data = app.table().get("data","item(CellNo)"); //java script version

Table * Verify "searchTerm" item(CellNo)   #monkey script version

我想知道我怎么做自定义的UITableViewCell一样吗?

I want to Know How I do the same with custom UITableViewCell ?

MonkeyTalk表的属性<一个href=\"http://www.gorillalogic.com/monkeytalk-documentation/monkeytalk-language-reference/command-reference#Table\"相对=nofollow>参考:

MonkeyTalk Table properties reference:

推荐答案

我找到了一种方法来做到这一点。

I found a way to do it.

首先打开X code项目源$ C ​​$ C,在一边的UITableViewDelegate法的cellForRowAtIndexPath(这是我们配置的每个细胞)配置财产accessibilityLabel为您想验证通过自动化测试/访问的标签。

First open the xcode project source code, in side UITableviewDelegate method "cellForRowAtIndexPath" (where we configure each cell) configure property "accessibilityLabel" for the Label you want to verify/access through automated test.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
........
........
cell.searchItemTitle.text = item.title;
cell.searchItemDescription.text = item.description;
cell.searchItemTitle.accessibilityLabel = @"cellTitleLabel";
........
........
return cell;
}

清洁与测试目标建设。
monkeytalk脚本中可以使用访问属性accessibilityLabel名称

clean and build with test target. inside monkeytalk Script you can access the property using accessibilityLabel name

Label "cellTitleLabel" Verify "apple" ".text" #monkeytalk script

app.label("cellTitleLabel").verify("apple", ".text"); //java script version

注:没有必要去想表或部分的信息。它会认同monkeyIdcellTitleLabel一个标签,如果你想访问你可以使用monkeyId同一个表的第二个单元格的titleLabelcellTitleLabel(2)和第三个单元格monkeyIdcellTitleLabel(3)之类的..

Note: no need to think about table or section information. it will identify a Label with monkeyId "cellTitleLabel" and if you want to access the titleLabel of the second cell of the same table you can use monkeyId "cellTitleLabel(2)" and for the third cell monkeyId "cellTitleLabel(3)" like that..

如果你们有更好的解决方案,请添加在这里
谢谢..
Chathura

if you guys have better solutions please add it here Thanks.. Chathura

这篇关于MonkeyTalk:验证自定义的UITableViewCell标签的文本,而不选择单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆