Sha256: f6584b8c8d41e79a179e71f174afa4fcea0e1ff24d6732f4c6768796bac2a30d

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

# require_relative 'elements/elements_collection'
# require_relative 'sections/section_finders'
# require_relative 'sections/screen_section'
# require_relative 'sections/sections_collection'

module AppPrism
  module Finders

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

      define_method(name) do |&block|
        get_element_for(identifiers).click
      end

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

      define_method("#{name}=") do |value|
        get_element_for(identifiers).send_keys(value)
      end
    end

    def elements(name, identifiers)
      define_method("#{name}_elements") do
        get_elements_for(identifiers)
      end
    end

    def expected_element(name, wait_time = 0, timeout = AppPrism::DEFAULT_WAIT_TIME)
      define_method("has_expected_element?") do
        sleep wait_time
        self.respond_to?("#{name}_element") && self.send("#{name}_element").when_visible(timeout)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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