module AutomationObject::BluePrint::PageObjectAdapter
BluePrint
PageObject
Adapter Using classes to define page objects
Public Instance Methods
build(path = '')
click to toggle source
@param path [String] path to PageObject
classes @return [AutomationObject::BluePrint::Composite::Top] Composite
BluePrint
Object
# 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_module()
click to toggle source
# 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