I need to write a method which will get text with the help of index number from popup and then i need to compare with the expected text i.e i need to verify expected plan name is displayed at the bottom of the popup box
Asked
Active
Viewed 98 times
1 Answers
0
Setting the correct id for the query (which you can get by doing on calabash console the command query("*", :id)
) on code below should do the trick. If you can't use id try to get another component property (like Android component by using query("*")
) and set the query inside theget_text
calls.
def get_text(query)
query(plan_query, :text).first
end
def text_equals(text, expected_text)
unless text == expected_text
fail "#{text} not equal to #{expected_text}"
end
end
def verify_plan(index, expected_text)
plan_text = get_text("* id:'PLAN_TEXTS_ID' index:#{index}") # Can change 'id:...'' by Android class if plan does not have id
expected_text = get_text("* id:'BOTTOM_PLAN_ID'") # Same as above
text_equals(plan_text, expected_text)
end

CMassa
- 91
- 4