automation_object 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/automation_object.rb +22 -11
- data/lib/automation_object/blue_print.rb +13 -12
- data/lib/automation_object/blue_print/composite/automatic_onload_modal.rb +9 -8
- data/lib/automation_object/blue_print/composite/base.rb +5 -4
- data/lib/automation_object/blue_print/composite/custom_method.rb +8 -7
- data/lib/automation_object/blue_print/composite/element.rb +6 -5
- data/lib/automation_object/blue_print/composite/element_array.rb +6 -5
- data/lib/automation_object/blue_print/composite/element_hash.rb +7 -6
- data/lib/automation_object/blue_print/composite/helpers/element_helper.rb +7 -7
- data/lib/automation_object/blue_print/composite/helpers/multiple_elements_helper.rb +5 -4
- data/lib/automation_object/blue_print/composite/hook.rb +9 -11
- data/lib/automation_object/blue_print/composite/hook_action.rb +25 -24
- data/lib/automation_object/blue_print/composite/hook_element_requirements.rb +14 -13
- data/lib/automation_object/blue_print/composite/modal.rb +11 -21
- data/lib/automation_object/blue_print/composite/screen.rb +22 -16
- data/lib/automation_object/blue_print/composite/top.rb +13 -12
- data/lib/automation_object/blue_print/composite/view.rb +27 -16
- data/lib/automation_object/blue_print/hash_adapter.rb +15 -11
- data/lib/automation_object/blue_print/hash_adapter/automatic_onload_modal.rb +12 -11
- data/lib/automation_object/blue_print/hash_adapter/composite.rb +28 -25
- data/lib/automation_object/blue_print/hash_adapter/custom_method.rb +11 -10
- data/lib/automation_object/blue_print/hash_adapter/element.rb +10 -9
- data/lib/automation_object/blue_print/hash_adapter/element_array.rb +10 -9
- data/lib/automation_object/blue_print/hash_adapter/element_hash.rb +11 -10
- data/lib/automation_object/blue_print/hash_adapter/helpers/element_helper.rb +20 -25
- data/lib/automation_object/blue_print/hash_adapter/helpers/multiple_elements_helper.rb +15 -14
- data/lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb +9 -8
- data/lib/automation_object/blue_print/hash_adapter/helpers/validation_helper.rb +19 -24
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate.rb +8 -5
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_allowed_keys.rb +7 -8
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_element_presence_of.rb +28 -23
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_instance_of.rb +12 -13
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_modal_presence_of.rb +27 -23
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_presence_of.rb +9 -8
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_screen_presence_of.rb +27 -23
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_view_presence_of.rb +25 -21
- data/lib/automation_object/blue_print/hash_adapter/hook.rb +14 -11
- data/lib/automation_object/blue_print/hash_adapter/hook_action.rb +45 -47
- data/lib/automation_object/blue_print/hash_adapter/hook_element_requirements.rb +24 -28
- data/lib/automation_object/blue_print/hash_adapter/modal.rb +14 -13
- data/lib/automation_object/blue_print/hash_adapter/screen.rb +23 -22
- data/lib/automation_object/blue_print/hash_adapter/top.rb +16 -15
- data/lib/automation_object/blue_print/hash_adapter/view.rb +58 -4
- data/lib/automation_object/blue_print/yaml_adapter.rb +33 -34
- data/lib/automation_object/driver.rb +15 -13
- data/lib/automation_object/driver/appium_adapter/driver.rb +47 -46
- data/lib/automation_object/driver/appium_adapter/element.rb +29 -96
- data/lib/automation_object/driver/base.rb +4 -2
- data/lib/automation_object/driver/common_selenium/driver.rb +60 -0
- data/lib/automation_object/driver/common_selenium/element.rb +107 -0
- data/lib/automation_object/driver/common_selenium/element_geometry.rb +86 -0
- data/lib/automation_object/driver/driver.rb +60 -30
- data/lib/automation_object/driver/element.rb +70 -15
- data/lib/automation_object/driver/nokogiri_adapter/driver.rb +88 -34
- data/lib/automation_object/driver/nokogiri_adapter/element.rb +94 -16
- data/lib/automation_object/driver/nokogiri_adapter/error.rb +29 -8
- data/lib/automation_object/driver/nokogiri_adapter/{backup/form.rb → form.rb} +19 -6
- data/lib/automation_object/driver/nokogiri_adapter/request.rb +17 -0
- data/lib/automation_object/driver/nokogiri_adapter/session.rb +94 -0
- data/lib/automation_object/driver/nokogiri_adapter/window.rb +86 -0
- data/lib/automation_object/driver/selenium_adapter/driver.rb +36 -45
- data/lib/automation_object/driver/selenium_adapter/element.rb +15 -85
- data/lib/automation_object/dsl.rb +11 -28
- data/lib/automation_object/dsl/_base.rb +70 -0
- data/lib/automation_object/dsl/_proxy.rb +24 -0
- data/lib/automation_object/dsl/element.rb +34 -0
- data/lib/automation_object/dsl/element_array.rb +34 -0
- data/lib/automation_object/dsl/element_hash.rb +34 -0
- data/lib/automation_object/dsl/modal.rb +43 -0
- data/lib/automation_object/dsl/screen.rb +45 -0
- data/lib/automation_object/dsl/top.rb +25 -0
- data/lib/automation_object/framework.rb +28 -38
- data/lib/automation_object/helpers/composite.rb +30 -27
- data/lib/automation_object/helpers/composite_hook.rb +16 -15
- data/lib/automation_object/{blue_print/helpers/file_helper.rb → helpers/file.rb} +12 -12
- data/lib/automation_object/helpers/hash.rb +6 -5
- data/lib/automation_object/helpers/kernel.rb +11 -0
- data/lib/automation_object/helpers/{reflection_helper.rb → reflection.rb} +9 -8
- data/lib/automation_object/helpers/string.rb +25 -15
- data/lib/automation_object/{proxies → proxy}/mutex_proxy.rb +18 -21
- data/lib/automation_object/proxy/proxy.rb +23 -0
- data/lib/automation_object/proxy/throttle_proxy.rb +52 -0
- data/lib/automation_object/state.rb +11 -29
- data/lib/automation_object/state/{blue_print_adapter/composite.rb → composite/_base.rb} +35 -25
- data/lib/automation_object/state/{blue_print_adapter/helpers/element_helper.rb → composite/_common_element.rb} +11 -11
- data/lib/automation_object/state/composite/element.rb +22 -0
- data/lib/automation_object/state/composite/element_array.rb +27 -0
- data/lib/automation_object/state/composite/element_hash.rb +33 -0
- data/lib/automation_object/state/composite/element_proxy.rb +33 -0
- data/lib/automation_object/state/composite/helpers/window.rb +61 -0
- data/lib/automation_object/state/composite/helpers/window_manager.rb +60 -0
- data/lib/automation_object/state/composite/hook.rb +56 -0
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_action.rb +10 -8
- data/lib/automation_object/state/composite/hook_actions/action_loop.rb +36 -0
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/change_screen.rb +7 -5
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/change_to_previous_screen.rb +7 -5
- data/lib/automation_object/state/composite/hook_actions/close_modal.rb +29 -0
- data/lib/automation_object/state/composite/hook_actions/close_screen.rb +19 -0
- data/lib/automation_object/state/composite/hook_actions/element_requirement.rb +32 -0
- data/lib/automation_object/state/composite/hook_actions/new_screen.rb +35 -0
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/possible_screen_changes.rb +8 -7
- data/lib/automation_object/state/composite/hook_actions/reset_screen.rb +14 -0
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/show_modal.rb +7 -5
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/sleep.rb +4 -2
- data/lib/automation_object/state/{blue_print_adapter → composite}/hook_actions/wait_for_elements.rb +7 -5
- data/lib/automation_object/state/composite/modal.rb +45 -0
- data/lib/automation_object/state/composite/screen.rb +58 -0
- data/lib/automation_object/state/composite/top.rb +51 -0
- data/lib/automation_object/state/error.rb +45 -6
- data/lib/automation_object/state/session.rb +25 -23
- data/lib/automation_object/step_definitions.rb +5 -3
- data/lib/automation_object/step_definitions/element.rb +77 -0
- data/lib/automation_object/step_definitions/element_array.rb +135 -0
- data/lib/automation_object/step_definitions/element_hash.rb +126 -0
- data/lib/automation_object/step_definitions/screen.rb +62 -0
- data/lib/automation_object/step_definitions/{cache.rb → support/cache.rb} +8 -6
- data/lib/automation_object/step_definitions/support/element_array.rb +40 -0
- data/lib/automation_object/step_definitions/support/element_hash.rb +41 -0
- data/lib/automation_object/step_definitions/{parse.rb → support/parse.rb} +8 -6
- data/lib/automation_object/version.rb +2 -1
- metadata +203 -103
- data/lib/automation_object/driver/helpers/selenium_driver_helper.rb +0 -41
- data/lib/automation_object/driver/helpers/selenium_element_helper.rb +0 -138
- data/lib/automation_object/driver/nokogiri_adapter/backup/driver.rb +0 -83
- data/lib/automation_object/driver/nokogiri_adapter/backup/element.rb +0 -66
- data/lib/automation_object/driver/nokogiri_adapter/backup/helpers/driver_element_helper.rb +0 -52
- data/lib/automation_object/driver/nokogiri_adapter/backup/session.rb +0 -115
- data/lib/automation_object/dsl/blue_print_adapter.rb +0 -16
- data/lib/automation_object/dsl/blue_print_adapter/composite.rb +0 -54
- data/lib/automation_object/dsl/blue_print_adapter/element.rb +0 -14
- data/lib/automation_object/dsl/blue_print_adapter/element_array.rb +0 -14
- data/lib/automation_object/dsl/blue_print_adapter/element_hash.rb +0 -14
- data/lib/automation_object/dsl/blue_print_adapter/modal.rb +0 -23
- data/lib/automation_object/dsl/blue_print_adapter/screen.rb +0 -26
- data/lib/automation_object/dsl/blue_print_adapter/top.rb +0 -19
- data/lib/automation_object/dsl/models.rb +0 -18
- data/lib/automation_object/dsl/proxies/element.rb +0 -16
- data/lib/automation_object/dsl/proxies/element_array.rb +0 -16
- data/lib/automation_object/dsl/proxies/element_hash.rb +0 -16
- data/lib/automation_object/dsl/proxies/helpers/composite_helper.rb +0 -74
- data/lib/automation_object/dsl/proxies/modal.rb +0 -17
- data/lib/automation_object/dsl/proxies/screen.rb +0 -17
- data/lib/automation_object/dsl/proxies/top.rb +0 -17
- data/lib/automation_object/proxies/proxy.rb +0 -20
- data/lib/automation_object/proxies/throttle_proxy.rb +0 -57
- data/lib/automation_object/state/blue_print_adapter.rb +0 -16
- data/lib/automation_object/state/blue_print_adapter/element.rb +0 -20
- data/lib/automation_object/state/blue_print_adapter/element_array.rb +0 -25
- data/lib/automation_object/state/blue_print_adapter/element_hash.rb +0 -31
- data/lib/automation_object/state/blue_print_adapter/element_proxy.rb +0 -28
- data/lib/automation_object/state/blue_print_adapter/helpers/screen_manager.rb +0 -137
- data/lib/automation_object/state/blue_print_adapter/helpers/window.rb +0 -39
- data/lib/automation_object/state/blue_print_adapter/hook.rb +0 -56
- data/lib/automation_object/state/blue_print_adapter/hook_actions/action_loop.rb +0 -35
- data/lib/automation_object/state/blue_print_adapter/hook_actions/close_modal.rb +0 -31
- data/lib/automation_object/state/blue_print_adapter/hook_actions/close_screen.rb +0 -19
- data/lib/automation_object/state/blue_print_adapter/hook_actions/element_requirement.rb +0 -34
- data/lib/automation_object/state/blue_print_adapter/hook_actions/new_screen.rb +0 -37
- data/lib/automation_object/state/blue_print_adapter/hook_actions/reset_screen.rb +0 -18
- data/lib/automation_object/state/blue_print_adapter/modal.rb +0 -26
- data/lib/automation_object/state/blue_print_adapter/screen.rb +0 -32
- data/lib/automation_object/state/blue_print_adapter/top.rb +0 -45
- data/lib/automation_object/step_definitions/action.rb +0 -21
- data/lib/automation_object/step_definitions/element/actions.rb +0 -87
- data/lib/automation_object/step_definitions/element/regex.rb +0 -24
- data/lib/automation_object/step_definitions/element/steps.rb +0 -67
@@ -1,16 +0,0 @@
|
|
1
|
-
require_relative 'blue_print_adapter/top'
|
2
|
-
|
3
|
-
module AutomationObject
|
4
|
-
module State
|
5
|
-
#State adapter for building DSL framework
|
6
|
-
#Will work with the blueprints and adapter to accomplish the goal of maintaining the state
|
7
|
-
#And give control of operations via the DSL
|
8
|
-
module BluePrintAdapter
|
9
|
-
# @param args [Hash] expects :blue_prints, :driver
|
10
|
-
# @return [AutomationObject::State::BlueAdapter::Top]
|
11
|
-
def self.build(blue_prints, driver)
|
12
|
-
return Top.new(args.fetch(:blue_prints), args.fetch(:driver))
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative 'composite'
|
2
|
-
require_relative 'helpers/element_helper'
|
3
|
-
|
4
|
-
require_relative 'element_proxy'
|
5
|
-
|
6
|
-
module AutomationObject
|
7
|
-
module State
|
8
|
-
module BluePrintAdapter
|
9
|
-
class Element < AutomationObject::State::BluePrintAdapter::Composite
|
10
|
-
include ElementHelper
|
11
|
-
|
12
|
-
# @return [AutomationObject::State::BluePrintAdapter::ElementProxy] Selenium proxy
|
13
|
-
def load
|
14
|
-
element = self.driver.find_element(*self.blue_prints.selector_params)
|
15
|
-
ElementProxy.new(composite: self, element: element)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative 'composite'
|
2
|
-
require_relative 'helpers/element_helper'
|
3
|
-
|
4
|
-
require_relative 'element_proxy'
|
5
|
-
|
6
|
-
module AutomationObject
|
7
|
-
module State
|
8
|
-
module BluePrintAdapter
|
9
|
-
class ElementArray < AutomationObject::State::BluePrintAdapter::Composite
|
10
|
-
include ElementHelper
|
11
|
-
|
12
|
-
# @return [Array<AutomationObject::State::BluePrintAdapter::ElementProxy>] Selenium proxy
|
13
|
-
def load
|
14
|
-
elements = self.driver.find_elements(*self.blue_prints.selector_params)
|
15
|
-
|
16
|
-
wrapped_elements = elements.map { |element|
|
17
|
-
ElementProxy.new(composite: self, element: element)
|
18
|
-
}
|
19
|
-
|
20
|
-
return wrapped_elements
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative 'composite'
|
2
|
-
require_relative 'helpers/element_helper'
|
3
|
-
|
4
|
-
require_relative 'element_proxy'
|
5
|
-
|
6
|
-
module AutomationObject
|
7
|
-
module State
|
8
|
-
module BluePrintAdapter
|
9
|
-
class ElementHash < AutomationObject::State::BluePrintAdapter::Composite
|
10
|
-
include ElementHelper
|
11
|
-
|
12
|
-
# @return [Hash<String, AutomationObject::State::BluePrintAdapter::ElementProxy>] Selenium proxy
|
13
|
-
def load
|
14
|
-
elements = self.driver.find_elements(*self.blue_prints.selector_params)
|
15
|
-
elements_hash = {}
|
16
|
-
|
17
|
-
elements.each { |element|
|
18
|
-
#Want to wrap element, before sending for method!
|
19
|
-
#That will help us include custom methods, etc...
|
20
|
-
wrapped_element = ElementProxy.new(composite: self, element: element)
|
21
|
-
hash_key = wrapped_element.send(self.blue_prints.define_elements_by) #Send to wrapped state proxy
|
22
|
-
|
23
|
-
elements_hash[hash_key] = wrapped_element
|
24
|
-
}
|
25
|
-
|
26
|
-
return elements_hash
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require_relative '../../proxies/proxy'
|
2
|
-
|
3
|
-
module AutomationObject
|
4
|
-
module State
|
5
|
-
module BluePrintAdapter
|
6
|
-
#Proxy class to allow for usage of hooks
|
7
|
-
class ElementProxy < AutomationObject::Proxies::Proxy
|
8
|
-
def initialize(args = {})
|
9
|
-
@composite = args.fetch :composite
|
10
|
-
@subject = args.fetch :element
|
11
|
-
end
|
12
|
-
|
13
|
-
#Overiding base method to run possible hooks
|
14
|
-
def method_missing(method_symbol, *args, &block)
|
15
|
-
#Run before hook if needed
|
16
|
-
@composite.method_hooks[method_symbol].before if @composite.method_hook?(method_symbol)
|
17
|
-
|
18
|
-
subject_return = @subject.send(method_symbol, *args, &block)
|
19
|
-
|
20
|
-
#Run after hook if needed
|
21
|
-
@composite.method_hooks[method_symbol].after if @composite.method_hook?(method_symbol)
|
22
|
-
|
23
|
-
return subject_return
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require_relative 'window'
|
2
|
-
|
3
|
-
module AutomationObject
|
4
|
-
module State
|
5
|
-
module BluePrintAdapter
|
6
|
-
module ScreenManager
|
7
|
-
# @return [Array<Window>]
|
8
|
-
def windows
|
9
|
-
@windows ||= []
|
10
|
-
end
|
11
|
-
|
12
|
-
# @return [Array<String>] list of stored window handles
|
13
|
-
def window_handles
|
14
|
-
handles = []
|
15
|
-
self.windows.each { |window|
|
16
|
-
handles.push(window.window_handle)
|
17
|
-
}
|
18
|
-
return handles
|
19
|
-
end
|
20
|
-
|
21
|
-
def window_closed?(screen)
|
22
|
-
self.windows.each { |window|
|
23
|
-
if window.name == screen && window.closed?
|
24
|
-
self.delete_screen(screen)
|
25
|
-
return true
|
26
|
-
end
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def set_screen(name)
|
31
|
-
current_window_handle = self.driver.window_handle
|
32
|
-
previous_window = nil
|
33
|
-
|
34
|
-
self.windows.each { |window|
|
35
|
-
if window.window_handle == current_window_handle
|
36
|
-
previous_window = self.windows.delete(window)
|
37
|
-
break
|
38
|
-
end
|
39
|
-
}
|
40
|
-
|
41
|
-
self.windows << Window.new(name: name,
|
42
|
-
window_handle: current_window_handle,
|
43
|
-
previous_window: previous_window,
|
44
|
-
driver: self.driver)
|
45
|
-
end
|
46
|
-
|
47
|
-
def create_screen(name)
|
48
|
-
driver_handles = self.driver.window_handles
|
49
|
-
diff_handles = driver_handles - self.window_handles
|
50
|
-
|
51
|
-
#Should only have one extra window
|
52
|
-
if diff_handles.length > 1
|
53
|
-
raise "Expecting only one extra window, got #{diff_handles.length}"
|
54
|
-
end
|
55
|
-
|
56
|
-
self.windows << Window.new(name: name, window_handle: diff_handles.first, driver: self.driver)
|
57
|
-
end
|
58
|
-
|
59
|
-
def use_screen(name)
|
60
|
-
current_window_handle = self.driver.window_handle
|
61
|
-
self.windows.each { |window|
|
62
|
-
next unless window.name == name
|
63
|
-
|
64
|
-
break if window.window_handle == current_window_handle
|
65
|
-
|
66
|
-
self.driver.window_handle = window.window_handle
|
67
|
-
}
|
68
|
-
|
69
|
-
@current_screen_name = name
|
70
|
-
end
|
71
|
-
|
72
|
-
def use_modal(modal_name)
|
73
|
-
current_window.active_modal = modal_name
|
74
|
-
end
|
75
|
-
|
76
|
-
def delete_screen(name)
|
77
|
-
self.windows.each { |window|
|
78
|
-
self.windows.delete(name) if window.name == name
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
def screen_exists?(name)
|
83
|
-
self.windows.each { |window|
|
84
|
-
return true if window.name == name
|
85
|
-
}
|
86
|
-
|
87
|
-
return false
|
88
|
-
end
|
89
|
-
|
90
|
-
def destroy_modal
|
91
|
-
current_window.active_modal = nil
|
92
|
-
end
|
93
|
-
|
94
|
-
# @return [Window, nil]
|
95
|
-
def current_window
|
96
|
-
return nil unless @current_screen_name
|
97
|
-
return self.get_window(@current_screen_name)
|
98
|
-
end
|
99
|
-
|
100
|
-
def get_window(name)
|
101
|
-
self.windows.each { |window|
|
102
|
-
return window if name == window.name
|
103
|
-
}
|
104
|
-
|
105
|
-
return nil
|
106
|
-
end
|
107
|
-
|
108
|
-
def current_composite
|
109
|
-
if current_window.active_modal
|
110
|
-
return self.screens[@current_screen_name].modals[current_window.active_modal]
|
111
|
-
end
|
112
|
-
|
113
|
-
return self.screens[@current_screen_name]
|
114
|
-
end
|
115
|
-
|
116
|
-
def current_screen
|
117
|
-
@current_screen_name
|
118
|
-
end
|
119
|
-
|
120
|
-
def get_object(type, name)
|
121
|
-
object = nil
|
122
|
-
|
123
|
-
case type
|
124
|
-
when :element
|
125
|
-
object = self.current_composite.elements[name]
|
126
|
-
when :element_array
|
127
|
-
object = self.current_composite.element_arrays[name]
|
128
|
-
when :element_hash
|
129
|
-
object = self.current_composite.element_hashes[name]
|
130
|
-
end
|
131
|
-
|
132
|
-
return object.load
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module AutomationObject
|
2
|
-
module State
|
3
|
-
module BluePrintAdapter
|
4
|
-
class Window
|
5
|
-
attr_accessor :name, :window_handle, :previous_window, :driver, :active_modal
|
6
|
-
|
7
|
-
def initialize(args = {})
|
8
|
-
self.name = args.fetch :name
|
9
|
-
self.driver = args.fetch :driver
|
10
|
-
self.window_handle = args.fetch :window_handle
|
11
|
-
|
12
|
-
self.previous_window = args.fetch :previous_window, nil
|
13
|
-
end
|
14
|
-
|
15
|
-
# @return [Symbol, nil] name of screen or nil
|
16
|
-
def previous_screen_name
|
17
|
-
return (self.previous_window) ? self.previous_window.name : nil
|
18
|
-
end
|
19
|
-
|
20
|
-
#Change properties to the previous window if it exists
|
21
|
-
def back
|
22
|
-
return unless self.previous_window
|
23
|
-
|
24
|
-
self.name = self.previous_window.name
|
25
|
-
|
26
|
-
if self.previous_window.previous_window
|
27
|
-
self.previous_window = self.previous_window.previous_window
|
28
|
-
else
|
29
|
-
self.previous_window = nil
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def closed?
|
34
|
-
return !self.driver.window_handles.include?(self.window_handle)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require_relative 'composite'
|
2
|
-
|
3
|
-
require_relative 'hook_action'
|
4
|
-
require_relative 'hook_actions/element_requirement'
|
5
|
-
|
6
|
-
module AutomationObject
|
7
|
-
module State
|
8
|
-
module BluePrintAdapter
|
9
|
-
class Hook < AutomationObject::State::BluePrintAdapter::Composite
|
10
|
-
# @return [Boolean, nil] return nil if no live? check, otherwise boolean
|
11
|
-
def live?
|
12
|
-
self.before
|
13
|
-
|
14
|
-
return nil if self.blue_prints.live?.empty?
|
15
|
-
|
16
|
-
self.blue_prints.live?.each { |element_requirement_blueprints|
|
17
|
-
hook_element_requirement = ElementRequirement.new(blue_prints: element_requirement_blueprints,
|
18
|
-
composite: self,
|
19
|
-
loops: 1)
|
20
|
-
return false unless hook_element_requirement.run
|
21
|
-
}
|
22
|
-
|
23
|
-
self.after
|
24
|
-
|
25
|
-
return true
|
26
|
-
end
|
27
|
-
|
28
|
-
#Runs the before hook
|
29
|
-
# @return [Boolean, nil] return nil unless there is a hook, otherwise boolean depending on success of hook
|
30
|
-
def before
|
31
|
-
return nil if self.blue_prints.before.empty?
|
32
|
-
|
33
|
-
hook_action = HookAction.new(self.blue_prints.before,
|
34
|
-
self.driver,
|
35
|
-
:hook_action,
|
36
|
-
self,
|
37
|
-
self.location + '[hook_action]')
|
38
|
-
return hook_action.run
|
39
|
-
end
|
40
|
-
|
41
|
-
#Runs the after hook
|
42
|
-
# @return [Boolean, nil] return nil unless there is a hook, otherwise boolean depending on success of hook
|
43
|
-
def after
|
44
|
-
return nil if self.blue_prints.after.empty?
|
45
|
-
|
46
|
-
hook_action = HookAction.new(self.blue_prints.after,
|
47
|
-
self.driver,
|
48
|
-
:hook_action,
|
49
|
-
self,
|
50
|
-
self.location + '[hook_action]')
|
51
|
-
return hook_action.run
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module AutomationObject
|
2
|
-
module State
|
3
|
-
module BluePrintAdapter
|
4
|
-
class ActionLoop
|
5
|
-
attr_accessor :composite, :blue_prints, :loops
|
6
|
-
|
7
|
-
def initialize(args = {})
|
8
|
-
self.blue_prints = args.fetch(:blue_prints)
|
9
|
-
self.composite = args.fetch(:composite)
|
10
|
-
self.loops = args.fetch(:loops, 30)
|
11
|
-
end
|
12
|
-
|
13
|
-
def driver
|
14
|
-
return self.composite.driver
|
15
|
-
end
|
16
|
-
|
17
|
-
# @return [Boolean] run success or not
|
18
|
-
def run
|
19
|
-
self.loops.times do
|
20
|
-
if self.single_run
|
21
|
-
return true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
return false
|
26
|
-
end
|
27
|
-
|
28
|
-
# @return [Boolean] success or not
|
29
|
-
def single_run
|
30
|
-
raise 'Abstract Issue'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require_relative 'action_loop'
|
2
|
-
require_relative '../modal'
|
3
|
-
require_relative '../../error'
|
4
|
-
|
5
|
-
module AutomationObject
|
6
|
-
module State
|
7
|
-
module BluePrintAdapter
|
8
|
-
class CloseModal < ActionLoop
|
9
|
-
def single_run
|
10
|
-
self.driver.document_complete_wait
|
11
|
-
|
12
|
-
unless self.composite.parent.is_a?(Modal)
|
13
|
-
raise ModalParentExpected.new
|
14
|
-
end
|
15
|
-
|
16
|
-
modal = self.composite.parent
|
17
|
-
modal.active = modal.live?
|
18
|
-
|
19
|
-
if !modal.active?
|
20
|
-
self.composite.screen.modal = nil
|
21
|
-
self.composite.screen.current_modal = nil
|
22
|
-
self.composite.top.destroy_modal()
|
23
|
-
return true
|
24
|
-
else
|
25
|
-
return false
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative 'action_loop'
|
2
|
-
require_relative '../../error'
|
3
|
-
|
4
|
-
module AutomationObject
|
5
|
-
module State
|
6
|
-
module BluePrintAdapter
|
7
|
-
class CloseScreen < ActionLoop
|
8
|
-
def single_run
|
9
|
-
unless self.composite.screen
|
10
|
-
raise ScreenParentExpected.new
|
11
|
-
end
|
12
|
-
|
13
|
-
screen_name = self.composite.screen.name
|
14
|
-
return self.composite.top.window_closed?(screen_name)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|