module AppPrism::Sections::SectionFinders

Public Instance Methods

screen_section(name, section_class, identifiers) click to toggle source
# File lib/app_prism/sections/section_finders.rb, line 8
def screen_section(name, section_class, identifiers)
  define_method(name) do
    if android?
      new_identifiers = identifiers[:android].clone
    elsif ios?
      new_identifiers = identifiers[:ios].clone
    else
      raise '' + 'OS is not specified. Please run tests with ANDROID=true or IOS=true' + ''
    end
    section_class.new(new_identifiers, @platform.driver)
  end

  define_method("#{name}_element") do
    get_element_for(identifiers)
  end

  define_method("#{name}?") do
    get_element_for(identifiers).visible?
  end

end
screen_sections(name, section_class, identifiers) click to toggle source
# File lib/app_prism/sections/section_finders.rb, line 30
def screen_sections(name, section_class, identifiers)
  define_method(name) do
    sections_ary = AppPrism::Elements::ElementsCollection.new(identifiers, platform).map do |elt|
      section_class.new(elt.element, platform)
    end
    AppPrism::Sections::SectionsCollection[*sections_ary]
  end
end