Search code examples
ioscalabash-ios

calabash-ios touch/tap issue


My app having multiple "UPVOTE" labels which turns into "UPVOTED" once it is pressed though all are having different 'id'. query command to find label in calabash-ios console

now i want to click on particular "UPVOTE" button and wants to check its text is changed with "UPVOTED". so what can be my *.feature and *.rb steps ? I tried so many times with different different options but didn't work.

this is how my sample.feture file is

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

and my sample_feature.rb file is

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

currently this code running showing me error image

and after following it i changed by sample_feature.rb file by

Then /^I touch “UPVOTE” text$/ do
element = query(UILabel marked:’UPVOTE’)
touch(element)
end

and it gave me error

  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

again i changed the code accordingly and so on. well these are not the only try i did, i already gone through github predefined steps materials and all related issues on stack too. Please help. Thanks in advance.


Solution

  • Your quotes are a different character. “ is not the same as ".