Module: AutomationObject::BluePrint::PageObjectAdapter

Defined in:
lib/automation_object/blue_print/page_object_adapter.rb,
lib/automation_object/blue_print/page_object_adapter/top.rb,
lib/automation_object/blue_print/page_object_adapter/hook.rb,
lib/automation_object/blue_print/page_object_adapter/modal.rb,
lib/automation_object/blue_print/page_object_adapter/screen.rb,
lib/automation_object/blue_print/page_object_adapter/element.rb,
lib/automation_object/blue_print/page_object_adapter/composite.rb,
lib/automation_object/blue_print/page_object_adapter/hook_action.rb,
lib/automation_object/blue_print/page_object_adapter/element_hash.rb,
lib/automation_object/blue_print/page_object_adapter/custom_method.rb,
lib/automation_object/blue_print/page_object_adapter/element_array.rb,
lib/automation_object/blue_print/page_object_adapter/automatic_modal_change.rb,
lib/automation_object/blue_print/page_object_adapter/helpers/element_helper.rb,
lib/automation_object/blue_print/page_object_adapter/hook_element_requirements.rb,
lib/automation_object/blue_print/page_object_adapter/helpers/multiple_elements_helper.rb

Overview

BluePrint PageObject Adapter Using classes to define page objects

Defined Under Namespace

Modules: ElementHelper, MultipleElementsHelper Classes: AutomaticModalChange, Composite, CustomMethod, Element, ElementArray, ElementHash, HockAction, Hook, HookElementRequirements, Modal, Screen, Top

Class Method Summary collapse

Class Method Details

.build(path = '') ⇒ AutomationObject::BluePrint::Composite::Top

Returns Composite BluePrint Object

Parameters:

  • path (String) (defaults to: '')

    path to PageObject classes

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/automation_object/blue_print/page_object_adapter.rb', line 19

def build(path = '')
  # Require ruby files in that path into a module namespace
  path = File.expand_path(path)

  defined_module = define_random_module()

  # Remove any defined classes in UserDefined namespace
  defined_module.constants.select do |constant|
    defined_module.const_get(constant).is_a? Class
    defined_module.remove_const(constant)
  end

  # Add classes defined into UserDefined module
  Dir[File.join(path, '**/*.rb')].each do |file|
    defined_module.module_eval(File.read(file))
  end

  # Will look for classes defined
  adapter_top = self::Top.new(defined_module)
  AutomationObject::BluePrint::Composite::Top.new(adapter_top)
end

.define_random_moduleObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/automation_object/blue_print/page_object_adapter.rb', line 41

def define_random_module
  random_module_name = [*('A'..'Z')].sample(20).join
  random_module_symbol = random_module_name.to_sym

  AutomationObject::BluePrint::PageObjectAdapter.module_eval %Q?
    module #{random_module_name}

    end
  ?

  const_get(random_module_symbol)
end