![](/img/trans.png)
[英]Compare two text files and print content of one with index of second with ruby
[英]get text with index number and then compare with the expected text
在下面的代碼上設置正確的查詢ID(可以通過在calabash控制台上執行命令query("*", :id)
)應該可以解決問題。 如果無法使用id,請嘗試獲取另一個組件屬性(例如,通過使用query("*")
來獲取Android組件),然后在get_text
調用中設置查詢。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.