if exists
list_of_elements= query("Textview","text")
compare_element_index=list_of_elements.index('16')
desired_element_index=list_of_elements.index('17')
if (compare_element+1).eql?
(desired_element)
puts "the element position is correct"
else
fail " the element order is incorrect"
end
# Layout:
#
# foo
# bar
# baz
queries = ["* text:'foo'", "* text:'bar'", "* text:'baz'"]
previous_query = nil
previous_result = nil
queries.each do |q|
result = query(q).first
unless previous_result.nil?
y = result['rect']['y']
previous_y = previous_result['rect']['y']
if y < previous_y
raise "#{q} should be below #{previous_query}"
end
end
previous_query = q
previous_result = result
end
def position_of_element(current_entry, previous_entry)Just want to make it more generic interms of passing Textview , entry and text to the query
list_of_elements= query("Textview marked:'Entry'","text")
puts "The events appear in the order #{list_of_elements}"
previous_element_index = list_of_elements.index("#{current_entry}")
next_element_index = previous_element_index + 1
element_to_find_index = list_of_elements.index("#{previous_entry}")
if next_element_index == element_to_find_index
puts "The event '#{current_entry}' occurs in correct order"
else
fail "The event '#{current_entry}' does not appear after '#{previous_entry}'"
end
end
--
You received this message because you are subscribed to a topic in the Google Groups "calabash-android" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/calabash-android/UG9iiPQv6Wc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.