calabash-ios touch / tap问题

时间:2016-05-25 11:13:47

标签: ios calabash-ios

我的应用程序有多个“UPVOTE”标签,一旦被按下就变成“UPVOTED”,尽管它们都有不同的“id”。 query command to find label in calabash-ios console

现在我想点击特定的“UPVOTE”按钮并想要检查其文本是否已更改为“UPVOTED”。 那么我的* .feature和* .rb步骤是什么? 我尝试了很多次不同的选择,但没有用。

这是我的sample.feture文件

的方式
Scenario: Sample Scenario
Given the app has launched
Then I touch “UPVOTE” text
Then I should see UPVOTED
Then I wait for 10 seconds

我的sample_feature.rb文件是

Then /^I touch "([^\"]*)" text$/ do |arg1|
element = “UILabel marked:’#{arg1}’”
touch(element)
end

目前正在运行此代码显示我 error image

并且在跟随之后我通过

更改了sample_feature.rb文件
Then /^I touch “UPVOTE” text$/ do
element = query(UILabel marked:’UPVOTE’)
touch(element)
end

它给了我错误

  Scenario: Sample Scenario    # features/sample.feature:3
  Given the app has launched # features/steps/sample_steps.rb:1
  Then I touch “UPVOTE” text # features/steps/sample_steps.rb:7
  undefined local variable or method `’UPVOTE’' for #       <Object:0x007fd514508b60> (NameError)
  ./features/steps/sample_steps.rb:23:in `/^I touch “UPVOTE” text$/'
  features/sample.feature:5:in `Then I touch “UPVOTE” text'
Then I should see UPVOTED  # features/steps/sample_steps.rb:34
Then I wait for 10 seconds # calabash-cucumber-0.19.1/features/step_definitions/calabash_steps.rb:202

  Failing Scenarios:
  cucumber features/sample.feature:3 # Scenario: Sample Scenario

  1 scenario (1 failed)
  4 steps (1 failed, 2 skipped, 1 passed)
  0m33.249s

我再次相应地更改了代码,依此类推。 好吧这些不是我做的唯一尝试,我已经通过github预定义的步骤材料和堆栈上的所有相关问题。 请帮忙。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

你的报价是一个不同的角色。 “和#34;不一样。