用 calabash-android 触摸每个自定义 ListView 项
Touch each custom ListView item with calabash-android
所以我尝试触摸自定义 ListView 项目以查看下一个视图,然后我想返回,但现在我无法查询我的任何列表项目。
我的小黄瓜代码是:
Then I choose category:
| Artystyczne |
| Językowe |
| Komputery i robotyka |
| Korepetycje |
| Medyczne |
| Praktyczno-techniczne |
| Rozrywkowe |
| Rozwijające |
| Sportowe |
| Taneczne |
| Pozostałe |
在我的步骤中看起来像:
Then(/^I choose category:$/) do |table|
# table is a Cucumber::Ast::Table
data = table.raw
data.each do |i|
#tap_mark i
#tap_when_element_exists("* {text CONTAINS[c] '#{i}'}")
touch(i)
#TODO move back one View
end
end
当我 运行 测试错误时说:
Then I choose category: # features/step_definitions/calabash_steps.rb:25
| Artystyczne |
| JÄtzykowe |
| Komputery i robotyka |
| Korepetycje |
| Medyczne |
| Praktyczno-techniczne |
| Rozrywkowe |
| RozwijajÄce |
| Sportowe |
| Taneczne |
| PozostaĹ'e |
Failed to perform gesture. java.util.ArrayList cannot be cast to java.lang.String (RuntimeError)
./features/step_definitions/calabash_steps.rb:31:in `block (2 levels) in <top (required)>'
./features/step_definitions/calabash_steps.rb:28:in `each'
./features/step_definitions/calabash_steps.rb:28:in `/^I choose category:$/'
features\my_first.feature:11:in `Then I choose category:'
我尝试在 calabash-android console
中进行一些调试,有趣的是 tap_mark "Artystyczne"
运行良好。所以我假设我的 Data Tables
有问题但无法确定(或 google)是什么。如果有任何帮助,我将不胜感激:)
祝你有愉快的一天:)
您表示您已经尝试过
tap_mark "Artystyczne"
无论你发布的是什么,你的步骤是
Then(/^I choose category:$/) do |table|
# table is a Cucumber::Ast::Table
data = table.raw
data.each do |i|
touch(i)
end
end
您正在使用触摸,无法使用简单的文本来识别要触摸的项目。需要查询。
的风格
touch "ListView marked:'#{i}'"
Then(/^I choose category:$/) do |table|
data = table.raw
data.each do |identifiers|
identifiers.each do |identifier|
tap_when_element_exists("* {text CONTAINS[c] '#{identifier}'}")
sleep(1)
end
end
这里有关联数组,每个循环需要 2 个 ;)
所以我尝试触摸自定义 ListView 项目以查看下一个视图,然后我想返回,但现在我无法查询我的任何列表项目。
我的小黄瓜代码是:
Then I choose category:
| Artystyczne |
| Językowe |
| Komputery i robotyka |
| Korepetycje |
| Medyczne |
| Praktyczno-techniczne |
| Rozrywkowe |
| Rozwijające |
| Sportowe |
| Taneczne |
| Pozostałe |
在我的步骤中看起来像:
Then(/^I choose category:$/) do |table|
# table is a Cucumber::Ast::Table
data = table.raw
data.each do |i|
#tap_mark i
#tap_when_element_exists("* {text CONTAINS[c] '#{i}'}")
touch(i)
#TODO move back one View
end
end
当我 运行 测试错误时说:
Then I choose category: # features/step_definitions/calabash_steps.rb:25
| Artystyczne |
| JÄtzykowe |
| Komputery i robotyka |
| Korepetycje |
| Medyczne |
| Praktyczno-techniczne |
| Rozrywkowe |
| RozwijajÄce |
| Sportowe |
| Taneczne |
| PozostaĹ'e |
Failed to perform gesture. java.util.ArrayList cannot be cast to java.lang.String (RuntimeError)
./features/step_definitions/calabash_steps.rb:31:in `block (2 levels) in <top (required)>'
./features/step_definitions/calabash_steps.rb:28:in `each'
./features/step_definitions/calabash_steps.rb:28:in `/^I choose category:$/'
features\my_first.feature:11:in `Then I choose category:'
我尝试在 calabash-android console
中进行一些调试,有趣的是 tap_mark "Artystyczne"
运行良好。所以我假设我的 Data Tables
有问题但无法确定(或 google)是什么。如果有任何帮助,我将不胜感激:)
祝你有愉快的一天:)
您表示您已经尝试过
tap_mark "Artystyczne"
无论你发布的是什么,你的步骤是
Then(/^I choose category:$/) do |table|
# table is a Cucumber::Ast::Table
data = table.raw
data.each do |i|
touch(i)
end
end
您正在使用触摸,无法使用简单的文本来识别要触摸的项目。需要查询。
的风格touch "ListView marked:'#{i}'"
Then(/^I choose category:$/) do |table|
data = table.raw
data.each do |identifiers|
identifiers.each do |identifier|
tap_when_element_exists("* {text CONTAINS[c] '#{identifier}'}")
sleep(1)
end
end
这里有关联数组,每个循环需要 2 个 ;)