Sha256: ad95ab226263f7885ce2d8827af238450c098c5df669a53fc1acff58c62f8f29

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

module Pagetience
  module ElementPlatforms
    class PageObjectGem < Base
      attr_reader :page_object_instance

      class << self
        def present?(klazz)
          klazz.class.ancestors.include? PageObject
        end
      end

      def initialize(klazz)
        super

        @page_object_instance = klazz
        @browser = @page_object_instance.browser
      end

      def platform_initialize
        @page_object_instance.instance_eval do
          PageObject.instance_method(:initialize).bind(self).call(@browser)
        end
      end

      def underlying_element_for(sym)
        @page_object_instance.send("#{sym}_element").element
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagetience-0.2.0 lib/pagetience/platforms/page-object-gem.rb