Question

In side my calabash test feature,in the middle of the flow I add four known numbers like

  • xxxx1111
  • xxxx2222
  • xxxx4444
  • xxxx3333

one after another and this order.(something like a user saved his credit card numbers) and in the final view I show them in a UITableView each row contains a number which is like xxxxxx1111. This table view shows the numbers sorted according to the Oldest to Newest I want to verify it . How should I do it using calabash ?

Was it helpful?

Solution

I Tried this and it works for me now. I declare a step definition in _steps.rb file

Then /^I see cell label "([^"]*)" row num (\d+) in section (\d+)$/ do |cellLabel, row, section|
###### diff cells with labels in table, vertically orderd ######
## E.g. Then I see cell label "abc" row num 1 in section 0

res = query("label marked:'#{cellLabel}' parent tableViewCell indexPath:#{row},#{section}").empty?

if (res)
screenshot_and_raise "There is no cell label with text #{cellLabel} in indexpath #{row},#{section}"
end

end

and use it in calabash feature file like

  • Then I see cell label "xxxx1111" row num 0 in section 0
  • Then I see cell label "xxxx2222" row num 1 in section 0
  • Then I see cell label "xxxx4444" row num 2 in section 0
  • Then I see cell label "xxxx3333" row num 3 in section 0

Hope this will be useful to someone :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top