Class: AutomationObject::BluePrint::PageObjectAdapter::HockAction

Inherits:
Composite show all
Defined in:
lib/automation_object/blue_print/page_object_adapter/hook_action.rb

Overview

HockAction composite

Instance Attribute Summary

Attributes inherited from Composite

#constant, #user_defined_module

Attributes inherited from Composite

#children, #location, #name, #parent

Instance Method Summary collapse

Methods inherited from Composite

#create_composite, #get_child, #get_children, #get_page_object, #get_property, #initialize

Methods inherited from Composite

#add_has_many_relationships, #add_has_one_relationships, #get_child, #get_children, has_many, has_many_relationships, has_one, has_one_relationships, #initialize, #top

Methods included from Reflection

#add_alias, #add_attribute

Methods included from CompositeHook

#after_create_run, #before_create_run, included

Constructor Details

This class inherits a constructor from AutomationObject::BluePrint::PageObjectAdapter::Composite

Instance Method Details

#change_screenSymbol?

Returns screen to change to

Returns:

  • (Symbol, nil)

    screen to change to



29
30
31
32
33
34
35
36
37
38
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 29

def change_screen
  change_screen = hash[:change_screen]

  case change_screen
    when Symbol, String
      return change_screen.to_sym
    else
      return nil
  end
end

#change_to_previous_screenBoolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 63

def change_to_previous_screen
  hash[:change_to_previous_screen] ||= false
end

#close_modalBoolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 58

def close_modal
  hash[:close_modal] ||= false
end

#close_screenBoolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 53

def close_screen
  hash[:close_screen] ||= false
end

#empty?Boolean

See if hook actions are empty

Returns:

  • (Boolean)

    if hook actions are empty



24
25
26
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 24

def empty?
  hash.keys.empty?
end

#hook_orderArray<Symbol>

Get the order to run the hook in

Returns:

  • (Array<Symbol>)

    list of hook methods to run in given order



12
13
14
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 12

def hook_order
  hash.keys
end

#lengthInteger

Get length of hook actions

Returns:

  • (Integer)

    length of hook actions



18
19
20
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 18

def length
  hash.keys.length
end

#new_screenSymbol?

Returns new screen

Returns:

  • (Symbol, nil)

    new screen



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

def new_screen
  new_screen = hash[:new_screen]

  case new_screen
    when Symbol, String
      return new_screen.to_sym
    else
      return nil
  end
end

#possible_screen_changesArray

Returns:

  • (Array)


80
81
82
83
84
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 80

def possible_screen_changes
  return hash[:possible_screen_changes].map(&:to_sym) if hash[:possible_screen_changes].is_a?(Array)

  []
end

#reset_screenBoolean

Returns reset the screen?

Returns:

  • (Boolean)

    reset the screen?



87
88
89
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 87

def reset_screen
  hash[:reset_screen] ||= false
end

#show_modalSymbol?

Returns:

  • (Symbol, nil)


68
69
70
71
72
73
74
75
76
77
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 68

def show_modal
  show_modal = hash[:show_modal]

  case show_modal
    when Symbol, String
      return show_modal.to_sym
    else
      return nil
  end
end

#sleepNumeric

Returns amount of time to sleep

Returns:

  • (Numeric)

    amount of time to sleep



92
93
94
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 92

def sleep
  hash[:sleep] ||= 0
end

#wait_for_elementsArray<HookElementRequirements>

Custom method for array of children instead of Hash

Returns:



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/automation_object/blue_print/page_object_adapter/hook_action.rb', line 98

def wait_for_elements
  return @wait_for_elements if defined? @wait_for_elements
  wait_for_elements = hash[:wait_for_elements]

  children = wait_for_elements.is_a?(Array) ? wait_for_elements : []
  @wait_for_elements = create_array_children(:wait_for_elements, children,
                                             interface: HookElementRequirements,
                                             location: location + '[wait_for_elements]')

  @wait_for_elements
end