Sha256: d9417e4afc1d59b88dbea137ca20b2cf78efda3dc32772f7d3aa53b41742cdc7

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

Dir[File.dirname(__FILE__) + "/*.rb"].each do |file| 
  require file 
end

module Cello
  module Structure
    module ElementHelper

      def element(name, type, *args)
        class_eval do
          define_method name do
            browser.send(type, *args)
          end

          define_extras(name, type)
        end
      end

      protected

      def define_extras(name, type)
        define_method "#{name}_is_real?" do
          send(name).exists?
        end
        define_method "#{name}_click" do
          send(name).click
        end
        define_method "#{name}_is_visible?" do
          send(name).visible?
        end
        define_method "#{name}_is_enable?" do
          send(name).enabled?
        end
        define_method "#{name}_right_click" do
          send(name).right_click
        end

        method_name = "define_extras_for_#{type}"
        send(method_name, name) if respond_to? method_name
      end

     include CheckboxHelper
     include TextfieldHelper
     include SelectHelper
     include DivHelper
     include RadioHelper
     include LinkHelper
     include ButtonHelper
     include SpanHelper
     include HiddenHelper

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cello-0.0.12 lib/cello/element_helper.rb