automation_object 0.7.6 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/lib/automation_object/blue_print.rb +1 -0
  3. data/lib/automation_object/blue_print/composite/{automatic_onload_modal.rb → automatic_modal_change.rb} +3 -4
  4. data/lib/automation_object/blue_print/composite/base.rb +1 -0
  5. data/lib/automation_object/blue_print/composite/custom_method.rb +2 -3
  6. data/lib/automation_object/blue_print/composite/element.rb +2 -3
  7. data/lib/automation_object/blue_print/composite/element_array.rb +2 -3
  8. data/lib/automation_object/blue_print/composite/element_hash.rb +2 -3
  9. data/lib/automation_object/blue_print/composite/helpers/container_helper.rb +75 -0
  10. data/lib/automation_object/blue_print/composite/helpers/element_helper.rb +30 -1
  11. data/lib/automation_object/blue_print/composite/helpers/multiple_elements_helper.rb +1 -0
  12. data/lib/automation_object/blue_print/composite/hook.rb +18 -6
  13. data/lib/automation_object/blue_print/composite/hook_action.rb +3 -4
  14. data/lib/automation_object/blue_print/composite/hook_element_requirements.rb +3 -4
  15. data/lib/automation_object/blue_print/composite/modal.rb +12 -9
  16. data/lib/automation_object/blue_print/composite/screen.rb +17 -14
  17. data/lib/automation_object/blue_print/composite/top.rb +3 -2
  18. data/lib/automation_object/blue_print/composite/view.rb +8 -7
  19. data/lib/automation_object/blue_print/hash_adapter.rb +1 -0
  20. data/lib/automation_object/blue_print/hash_adapter/{automatic_onload_modal.rb → automatic_modal_change.rb} +3 -2
  21. data/lib/automation_object/blue_print/hash_adapter/composite.rb +1 -0
  22. data/lib/automation_object/blue_print/hash_adapter/custom_method.rb +1 -0
  23. data/lib/automation_object/blue_print/hash_adapter/element.rb +2 -0
  24. data/lib/automation_object/blue_print/hash_adapter/element_array.rb +1 -0
  25. data/lib/automation_object/blue_print/hash_adapter/element_hash.rb +1 -0
  26. data/lib/automation_object/blue_print/hash_adapter/helpers/element_helper.rb +8 -2
  27. data/lib/automation_object/blue_print/hash_adapter/helpers/multiple_elements_helper.rb +1 -0
  28. data/lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb +2 -1
  29. data/lib/automation_object/blue_print/hash_adapter/helpers/validation_helper.rb +1 -0
  30. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate.rb +1 -0
  31. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_allowed_keys.rb +1 -0
  32. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_element_presence_of.rb +1 -0
  33. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_instance_of.rb +1 -0
  34. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_modal_presence_of.rb +1 -0
  35. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_presence_of.rb +1 -0
  36. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_screen_presence_of.rb +1 -0
  37. data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_view_presence_of.rb +1 -0
  38. data/lib/automation_object/blue_print/hash_adapter/hook.rb +2 -1
  39. data/lib/automation_object/blue_print/hash_adapter/hook_action.rb +4 -3
  40. data/lib/automation_object/blue_print/hash_adapter/hook_element_requirements.rb +2 -1
  41. data/lib/automation_object/blue_print/hash_adapter/modal.rb +2 -1
  42. data/lib/automation_object/blue_print/hash_adapter/screen.rb +14 -13
  43. data/lib/automation_object/blue_print/hash_adapter/top.rb +3 -2
  44. data/lib/automation_object/blue_print/hash_adapter/view.rb +12 -11
  45. data/lib/automation_object/blue_print/yaml_adapter.rb +1 -0
  46. data/lib/automation_object/driver.rb +1 -0
  47. data/lib/automation_object/driver/appium_adapter/driver.rb +2 -1
  48. data/lib/automation_object/driver/appium_adapter/element.rb +1 -0
  49. data/lib/automation_object/driver/base.rb +1 -0
  50. data/lib/automation_object/driver/common_selenium/driver.rb +1 -0
  51. data/lib/automation_object/driver/common_selenium/element.rb +1 -0
  52. data/lib/automation_object/driver/common_selenium/element_geometry.rb +1 -0
  53. data/lib/automation_object/driver/driver.rb +1 -0
  54. data/lib/automation_object/driver/element.rb +1 -0
  55. data/lib/automation_object/driver/nokogiri_adapter/driver.rb +5 -8
  56. data/lib/automation_object/driver/nokogiri_adapter/element.rb +9 -14
  57. data/lib/automation_object/driver/nokogiri_adapter/error.rb +1 -0
  58. data/lib/automation_object/driver/nokogiri_adapter/form.rb +1 -0
  59. data/lib/automation_object/driver/nokogiri_adapter/request.rb +1 -0
  60. data/lib/automation_object/driver/nokogiri_adapter/session.rb +1 -0
  61. data/lib/automation_object/driver/nokogiri_adapter/window.rb +1 -0
  62. data/lib/automation_object/driver/selenium_adapter/driver.rb +1 -0
  63. data/lib/automation_object/driver/selenium_adapter/element.rb +1 -0
  64. data/lib/automation_object/dsl.rb +4 -2
  65. data/lib/automation_object/dsl/_base.rb +11 -1
  66. data/lib/automation_object/dsl/_error.rb +71 -0
  67. data/lib/automation_object/dsl/_proxy.rb +1 -0
  68. data/lib/automation_object/dsl/element.rb +2 -2
  69. data/lib/automation_object/dsl/element_array.rb +2 -2
  70. data/lib/automation_object/dsl/element_hash.rb +2 -2
  71. data/lib/automation_object/dsl/modal.rb +47 -2
  72. data/lib/automation_object/dsl/screen.rb +67 -3
  73. data/lib/automation_object/dsl/top.rb +19 -0
  74. data/lib/automation_object/framework.rb +18 -1
  75. data/lib/automation_object/helpers/composite.rb +3 -1
  76. data/lib/automation_object/helpers/composite_hook.rb +1 -0
  77. data/lib/automation_object/helpers/file.rb +1 -0
  78. data/lib/automation_object/helpers/hash.rb +1 -0
  79. data/lib/automation_object/helpers/kernel.rb +1 -0
  80. data/lib/automation_object/helpers/reflection.rb +1 -0
  81. data/lib/automation_object/helpers/string.rb +1 -0
  82. data/lib/automation_object/proxy/mutex_proxy.rb +1 -0
  83. data/lib/automation_object/proxy/proxy.rb +1 -0
  84. data/lib/automation_object/proxy/throttle_proxy.rb +2 -1
  85. data/lib/automation_object/state.rb +5 -1
  86. data/lib/automation_object/state/_base.rb +2 -1
  87. data/lib/automation_object/state/_common_element.rb +5 -0
  88. data/lib/automation_object/state/_error.rb +1 -0
  89. data/lib/automation_object/state/automatic_modal_change.rb +13 -0
  90. data/lib/automation_object/state/automatic_screen_changes.rb +13 -0
  91. data/lib/automation_object/state/element.rb +2 -1
  92. data/lib/automation_object/state/element_array.rb +2 -1
  93. data/lib/automation_object/state/element_hash.rb +2 -1
  94. data/lib/automation_object/state/element_proxy.rb +1 -0
  95. data/lib/automation_object/state/helpers/automatic_routing.rb +96 -0
  96. data/lib/automation_object/state/helpers/container_helper.rb +46 -0
  97. data/lib/automation_object/state/hook.rb +1 -0
  98. data/lib/automation_object/state/hook_action.rb +1 -0
  99. data/lib/automation_object/state/hook_actions/action_loop.rb +1 -0
  100. data/lib/automation_object/state/hook_actions/change_screen.rb +1 -0
  101. data/lib/automation_object/state/hook_actions/change_to_previous_screen.rb +1 -0
  102. data/lib/automation_object/state/hook_actions/close_modal.rb +1 -0
  103. data/lib/automation_object/state/hook_actions/close_screen.rb +1 -0
  104. data/lib/automation_object/state/hook_actions/element_requirement.rb +1 -0
  105. data/lib/automation_object/state/hook_actions/new_screen.rb +1 -0
  106. data/lib/automation_object/state/hook_actions/possible_screen_changes.rb +1 -0
  107. data/lib/automation_object/state/hook_actions/reset_screen.rb +1 -0
  108. data/lib/automation_object/state/hook_actions/show_modal.rb +1 -0
  109. data/lib/automation_object/state/hook_actions/sleep.rb +1 -0
  110. data/lib/automation_object/state/hook_actions/wait_for_elements.rb +1 -0
  111. data/lib/automation_object/state/modal.rb +5 -14
  112. data/lib/automation_object/state/screen.rb +33 -19
  113. data/lib/automation_object/state/top.rb +17 -2
  114. data/lib/automation_object/step_definitions.rb +3 -4
  115. data/lib/automation_object/step_definitions/element.rb +22 -23
  116. data/lib/automation_object/step_definitions/element_array.rb +26 -27
  117. data/lib/automation_object/step_definitions/element_hash.rb +26 -27
  118. data/lib/automation_object/step_definitions/modal.rb +31 -0
  119. data/lib/automation_object/step_definitions/screen.rb +22 -10
  120. data/lib/automation_object/step_definitions/support/cache.rb +5 -2
  121. data/lib/automation_object/step_definitions/support/element_array.rb +1 -1
  122. data/lib/automation_object/step_definitions/support/parse.rb +1 -1
  123. data/lib/automation_object/version.rb +2 -1
  124. metadata +59 -39
  125. data/lib/automation_object/step_definitions/support/minitest.rb +0 -10
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'base'
4
5
 
@@ -12,12 +13,12 @@ module AutomationObject
12
13
  # Hoping to improve code completion and standard interface where
13
14
  # classes use this as a template to add additional adapters
14
15
  class Top < Base
15
- # @return [Hash<Screen>]
16
+ # @return [Hash<AutomationObject::BluePrint::Composite::Screen>]
16
17
  def screens
17
18
  adapter.screens
18
19
  end
19
20
 
20
- # @return [Hash<View>]
21
+ # @return [Hash<AutomationObject::BluePrint::Composite::View>]
21
22
  def views
22
23
  adapter.views
23
24
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'base'
4
5
 
@@ -24,9 +25,9 @@ module AutomationObject
24
25
  adapter.dismiss
25
26
  end
26
27
 
27
- # @return [Array<AutomaticOnloadModal>]
28
- def automatic_onload_modals
29
- adapter.automatic_onload_modals
28
+ # @return [Array<AutomationObject::BluePrint::Composite::AutomaticModalChange>]
29
+ def automatic_modal_changes
30
+ adapter.automatic_modal_changes
30
31
  end
31
32
 
32
33
  # @return [Array<Symbol>]
@@ -34,22 +35,22 @@ module AutomationObject
34
35
  adapter.automatic_screen_changes
35
36
  end
36
37
 
37
- # @return [Hash<Modal>]
38
+ # @return [Hash<AutomationObject::BluePrint::Composite::Modal>]
38
39
  def modals
39
40
  adapter.modals
40
41
  end
41
42
 
42
- # @return [Hash<Element>]
43
+ # @return [Hash<AutomationObject::BluePrint::Composite::Element>]
43
44
  def elements
44
45
  adapter.elements
45
46
  end
46
47
 
47
- # @return [Hash<ElementArray>]
48
+ # @return [Hash<AutomationObject::BluePrint::Composite::ElementArray>]
48
49
  def element_arrays
49
50
  adapter.element_arrays
50
51
  end
51
52
 
52
- # @return [Hash<ElementHash>]
53
+ # @return [Hash<AutomationObject::BluePrint::Composite::ElementHash>]
53
54
  def element_hashes
54
55
  adapter.element_hashes
55
56
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'composite/top'
3
4
  require_relative 'hash_adapter/top'
4
5
 
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
5
6
  module AutomationObject
6
7
  module BluePrint
7
8
  module HashAdapter
8
- # Automatic Onload Modal Composite
9
- class AutomaticOnloadModal < Composite
9
+ # Automatic Modal Change Composite
10
+ class AutomaticModalChange < Composite
10
11
  # Validations
11
12
  validates :modal_name, instance_of: [String, Symbol], modal_presence_of: true, presence_of: true
12
13
  validates :number_of_checks, instance_of: Numeric
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative '../../helpers/composite'
3
4
  require_relative '../../helpers/string'
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -29,6 +30,7 @@ module AutomationObject
29
30
  validates :in_iframe, instance_of: String, element_presence_of: true
30
31
  validates :css, instance_of: String, presence_of: { unless_presence_of: :xpath }
31
32
  validates :xpath, instance_of: String, presence_of: { unless_presence_of: :css }
33
+ validates :default_input, instance_of: String
32
34
  end
33
35
  end
34
36
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -1,9 +1,15 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module AutomationObject
3
4
  module BluePrint
4
5
  module HashAdapter
5
6
  # Helper module for Element composite classes
6
7
  module ElementHelper
8
+ # @return [String, nil] text input for automatic screen/modal change if needed
9
+ def default_input
10
+ hash[:default_input]
11
+ end
12
+
7
13
  # @return [Array<Symbol, String>, nil] params as an array for driver find_element args
8
14
  def selector_params
9
15
  if hash[:xpath].is_a?(String)
@@ -30,7 +36,7 @@ module AutomationObject
30
36
  method_hooks.key?(name)
31
37
  end
32
38
 
33
- # @return [Hash<Hook>] array of Hook that are defined under the element
39
+ # @return [Hash<Hook>] hash of Hook that are defined under the element
34
40
  def method_hooks
35
41
  return @method_hooks if defined? @method_hooks
36
42
 
@@ -38,7 +44,7 @@ module AutomationObject
38
44
  hash.each do |key, value|
39
45
  # Skip possible keys that elements can have
40
46
  # Otherwise should be a method hook
41
- next if [:load, :custom_methods, :in_iframe, :css, :xpath, :define_elements_by, :custom_range].include?(key)
47
+ next if %i[load custom_methods in_iframe css xpath define_elements_by custom_range].include?(key)
42
48
  children[key] = value
43
49
  end
44
50
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module AutomationObject
3
4
  module BluePrint
4
5
  module HashAdapter
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module AutomationObject
3
4
  module BluePrint
4
5
  module HashAdapter
@@ -16,7 +17,7 @@ module AutomationObject
16
17
  def message
17
18
  message = "\nBluePrint::HashAdapter composite validation failed for the following errors:\n"
18
19
  @errors.each do |error|
19
- message << " - #{error}\n"
20
+ message += " - #{error}\n"
20
21
  end
21
22
 
22
23
  message + "\n"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require all the validators
3
4
  require_relative 'validators/validate_instance_of'
4
5
  require_relative 'validators/validate_allowed_keys'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module AutomationObject
3
4
  module BluePrint
4
5
  module HashAdapter
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'validate'
3
4
 
4
5
  module AutomationObject
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -18,7 +19,7 @@ module AutomationObject
18
19
  has_one :after, interface: HookAction
19
20
 
20
21
  # Validations
21
- validates_keys allowed_keys: [:before, :live?, :after]
22
+ validates_keys allowed_keys: %i[before live? after]
22
23
 
23
24
  # @return [Array<HookElementRequirements>] array of element requirements
24
25
  def live?
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
  require_relative 'hook_element_requirements'
@@ -12,9 +13,9 @@ module AutomationObject
12
13
  before_create :wait_for_elements
13
14
 
14
15
  # Validations
15
- validates_keys allowed_keys: [:new_screen, :show_modal, :close_screen, :change_screen,
16
- :sleep, :wait_for_elements, :change_to_previous_screen, :close_modal, :reset_screen,
17
- :possible_screen_changes]
16
+ validates_keys allowed_keys: %i[new_screen show_modal close_screen change_screen
17
+ sleep wait_for_elements change_to_previous_screen close_modal reset_screen
18
+ possible_screen_changes]
18
19
 
19
20
  validates :change_screen, instance_of: [String, Symbol], screen_presence_of: true
20
21
  validates :new_screen, instance_of: [String, Symbol], screen_presence_of: true
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -17,7 +18,7 @@ module AutomationObject
17
18
  hook_order = [:exists?] # Always put exists? first
18
19
 
19
20
  hash.each_key do |hook_name|
20
- hook_order.push(hook_name) unless [:element_name, :exists?].include?(hook_name)
21
+ hook_order.push(hook_name) unless %i[element_name exists?].include?(hook_name)
21
22
  end
22
23
 
23
24
  hook_order
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -21,7 +22,7 @@ module AutomationObject
21
22
  has_many :element_hashes, interface: ElementHash
22
23
 
23
24
  # Validations
24
- validates_keys allowed_keys: [:load, :elements, :element_arrays, :element_hashes]
25
+ validates_keys allowed_keys: %i[load elements element_arrays element_hashes]
25
26
 
26
27
  validates :load, instance_of: Hash
27
28
  validates :elements, instance_of: Hash
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
5
6
  # Require child classes
6
- require_relative 'automatic_onload_modal'
7
+ require_relative 'automatic_modal_change'
7
8
  require_relative 'element'
8
9
  require_relative 'element_array'
9
10
  require_relative 'element_hash'
@@ -17,7 +18,7 @@ module AutomationObject
17
18
  class Screen < Composite
18
19
  # Creation hooks
19
20
  before_create :merge_views
20
- before_create :automatic_onload_modals
21
+ before_create :automatic_modal_changes
21
22
 
22
23
  # Relationships
23
24
  has_one :load, interface: Hook
@@ -30,10 +31,10 @@ module AutomationObject
30
31
  has_many :element_hashes, interface: ElementHash
31
32
 
32
33
  # Validations
33
- validates_keys allowed_keys: [:automatic_onload_modals, :automatic_screen_changes, :elements,
34
- :element_arrays, :element_hashes, :included_views, :load, :modals]
34
+ validates_keys allowed_keys: %i[automatic_modal_changes automatic_screen_changes elements
35
+ element_arrays element_hashes included_views load modals]
35
36
 
36
- validates :automatic_onload_modals, instance_of: Array, modal_presence_of: true
37
+ validates :automatic_modal_changes, instance_of: Array, modal_presence_of: true
37
38
  validates :automatic_screen_changes, instance_of: Array, screen_presence_of: true
38
39
 
39
40
  validates :elements, instance_of: Hash
@@ -48,17 +49,17 @@ module AutomationObject
48
49
 
49
50
  validates :modals, instance_of: Hash
50
51
 
51
- # @return [Array<AutomaticOnloadModal>] array of AutomaticOnloadModal that are defined under the screen
52
- def automatic_onload_modals
53
- return @automatic_onload_modals if defined? @automatic_onload_modals
52
+ # @return [Array<AutomaticModalChange>] array of AutomaticModalChange that are defined under the screen
53
+ def automatic_modal_changes
54
+ return @automatic_modal_changes if defined? @automatic_modal_changes
54
55
 
55
- children = hash[:automatic_onload_modals]
56
+ children = hash[:automatic_modal_changes]
56
57
  children = children.is_a?(Array) ? children : []
57
- @automatic_onload_modals = create_array_children(:automatic_onload_modals, children,
58
- interface: AutomaticOnloadModal,
59
- location: location + '[automatic_onload_modals]')
58
+ @automatic_modal_changes = create_array_children(:automatic_modal_changes, children,
59
+ interface: AutomaticModalChange,
60
+ location: location + '[automatic_modal_changes]')
60
61
 
61
- @automatic_onload_modals
62
+ @automatic_modal_changes
62
63
  end
63
64
 
64
65
  # @return [Array<Symbol>] array of screens where screen can automatically change to
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -16,8 +17,8 @@ module AutomationObject
16
17
  has_many :views, interface: View
17
18
 
18
19
  # Validations
19
- validates_keys allowed_keys: [:base_url, :default_screen, :screen_transition_sleep, :screens,
20
- :throttle_driver_methods, :throttle_element_methods, :views]
20
+ validates_keys allowed_keys: %i[base_url default_screen screen_transition_sleep screens
21
+ throttle_driver_methods throttle_element_methods views]
21
22
 
22
23
  validates :base_url, instance_of: String
23
24
  validates :default_screen, instance_of: [Symbol, String], screen_presence_of: true
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Require parent class
3
4
  require_relative 'composite'
4
5
 
@@ -9,7 +10,7 @@ module AutomationObject
9
10
  class View < Composite
10
11
  # Creation hooks
11
12
  before_create :merge_views
12
- before_create :automatic_onload_modals
13
+ before_create :automatic_modal_changes
13
14
 
14
15
  # Relationships
15
16
  has_one :load, interface: Hook
@@ -22,8 +23,8 @@ module AutomationObject
22
23
  has_many :element_hashes, interface: ElementHash
23
24
 
24
25
  # Validations
25
- validates_keys allowed_keys: [:automatic_onload_modals, :automatic_screen_changes, :elements, :element_arrays,
26
- :element_groups, :element_hashes, :included_views, :load, :modals]
26
+ validates_keys allowed_keys: %i[automatic_onload_modals automatic_screen_changes elements element_arrays
27
+ element_groups element_hashes included_views load modals]
27
28
 
28
29
  validates :automatic_onload_modals, instance_of: Array, modal_presence_of: true
29
30
  validates :automatic_screen_changes, instance_of: Array, screen_presence_of: true
@@ -39,17 +40,17 @@ module AutomationObject
39
40
 
40
41
  validates :modals, instance_of: Hash
41
42
 
42
- # @return [Array<AutomaticOnloadModal>] array of AutomaticOnloadModal that are defined under the screen
43
- def automatic_onload_modals
44
- return @automatic_onload_modals if defined? @automatic_onload_modals
43
+ # @return [Array<AutomaticModalChange>] array of AutomaticModalChange that are defined under the screen
44
+ def automatic_modal_changes
45
+ return @automatic_modal_changes if defined? @automatic_modal_changes
45
46
 
46
- children = hash[:automatic_onload_modals]
47
+ children = hash[:automatic_modal_changes]
47
48
  children = children.is_a?(Array) ? children : []
48
- @automatic_onload_modals = create_array_children(:automatic_onload_modals, children,
49
- interface: AutomaticOnloadModal,
50
- location: location + '[automatic_onload_modals]')
49
+ @automatic_modal_changes = create_array_children(:automatic_modal_changes, children,
50
+ interface: AutomaticModalChange,
51
+ location: location + '[automatic_modal_change]')
51
52
 
52
- @automatic_onload_modals
53
+ @automatic_modal_changes
53
54
  end
54
55
 
55
56
  # @return [Array<Symbol>] array of screens where screen can automatically change to