Sha256: 83bfc7b677502bbb3312fe77c709e4b9faa0e222fa7048fd8a419f84d4f5f8dd

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

require_relative '../../app_prism/elements/elements_collection'
require_relative 'sections_collection'

module AppPrism
  module Sections
    module SectionFinders

      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

      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
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
app_prism-0.1.2 lib/app_prism/sections/section_finders.rb
app_prism-0.1.1 lib/app_prism/sections/section_finders.rb
app_prism-0.1.0 lib/app_prism/sections/section_finders.rb
app_prism-0.0.12 lib/app_prism/sections/section_finders.rb
app_prism-0.0.11 lib/app_prism/sections/section_finders.rb
app_prism-0.0.10 lib/app_prism/sections/section_finders.rb
app_prism-0.0.9 lib/app_prism/sections/section_finders.rb
app_prism-0.0.8 lib/app_prism/sections/section_finders.rb
app_prism-0.0.7 lib/app_prism/sections/section_finders.rb
app_prism-0.0.6 lib/app_prism/sections/section_finders.rb
app_prism-0.0.5 lib/app_prism/sections/section_finders.rb
app_prism-0.0.4 lib/app_prism/sections/section_finders.rb
app_prism-0.0.3 lib/app_prism/sections/section_finders.rb
app_prism-0.0.2 lib/app_prism/sections/section_finders.rb