class Applitools::Calabash::CalabashElement
Attributes
element_query[R]
original_element[R]
Public Class Methods
new(element, element_query)
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 10 def initialize(element, element_query) raise Applitools::EyesIllegalArgument, "Invalid element passed! (#{element})" unless valid_element?(element) @original_element = element @element_query = element_query end
Public Instance Methods
height()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 32 def height self['rect']['height'] end
left()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 16 def left self['rect']['x'] end
Also aliased as: x
location()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 36 def location Applitools::Location.from_struct(self) end
region()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 44 def region Applitools::Region.from_location_size(location, size) end
size()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 40 def size Applitools::RectangleSize.from_struct(self) end
to_s()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 48 def to_s @original_element end
top()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 22 def top self['rect']['y'] end
Also aliased as: y
width()
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 28 def width self['rect']['width'] end
Private Instance Methods
valid_element?(element)
click to toggle source
# File lib/applitools/calabash/calabash_element.rb, line 54 def valid_element?(element) result = true result &&= element.is_a?(Hash) result &&= element.key?('rect') result &&= (rect = element['rect']).is_a?(Hash) result &&= (%w(height width y x center_x center_y) - rect.keys).empty? result end