automation_object 0.0.4 → 0.5.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.
- checksums.yaml +4 -4
- data/lib/automation_object.rb +14 -72
- data/lib/automation_object/blue_print.rb +37 -100
- data/lib/automation_object/blue_print/composite/automatic_onload_modal.rb +28 -0
- data/lib/automation_object/blue_print/composite/base.rb +18 -0
- data/lib/automation_object/blue_print/composite/custom_method.rb +23 -0
- data/lib/automation_object/blue_print/composite/element.rb +20 -0
- data/lib/automation_object/blue_print/composite/element_array.rb +21 -0
- data/lib/automation_object/blue_print/composite/element_hash.rb +26 -0
- data/lib/automation_object/blue_print/composite/helpers/element_helper.rb +33 -0
- data/lib/automation_object/blue_print/composite/helpers/multiple_elements_helper.rb +18 -0
- data/lib/automation_object/blue_print/composite/hook.rb +31 -0
- data/lib/automation_object/blue_print/composite/hook_action.rb +84 -0
- data/lib/automation_object/blue_print/composite/hook_element_requirements.rb +39 -0
- data/lib/automation_object/blue_print/composite/modal.rb +56 -0
- data/lib/automation_object/blue_print/composite/screen.rb +61 -0
- data/lib/automation_object/blue_print/composite/top.rb +51 -0
- data/lib/automation_object/blue_print/composite/view.rb +48 -0
- data/lib/automation_object/blue_print/hash_adapter.rb +17 -0
- data/lib/automation_object/blue_print/hash_adapter/automatic_onload_modal.rb +35 -0
- data/lib/automation_object/blue_print/hash_adapter/composite.rb +93 -0
- data/lib/automation_object/blue_print/hash_adapter/custom_method.rb +30 -0
- data/lib/automation_object/blue_print/hash_adapter/element.rb +34 -0
- data/lib/automation_object/blue_print/hash_adapter/element_array.rb +36 -0
- data/lib/automation_object/blue_print/hash_adapter/element_hash.rb +43 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/element_helper.rb +59 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/multiple_elements_helper.rb +35 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb +26 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validation_helper.rb +99 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate.rb +23 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_allowed_keys.rb +31 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_element_presence_of.rb +55 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_instance_of.rb +39 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_modal_presence_of.rb +54 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_presence_of.rb +36 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_screen_presence_of.rb +55 -0
- data/lib/automation_object/blue_print/hash_adapter/helpers/validators/validate_view_presence_of.rb +52 -0
- data/lib/automation_object/blue_print/hash_adapter/hook.rb +35 -0
- data/lib/automation_object/blue_print/hash_adapter/hook_action.rb +134 -0
- data/lib/automation_object/blue_print/hash_adapter/hook_element_requirements.rb +64 -0
- data/lib/automation_object/blue_print/hash_adapter/modal.rb +52 -0
- data/lib/automation_object/blue_print/hash_adapter/screen.rb +91 -0
- data/lib/automation_object/blue_print/hash_adapter/top.rb +63 -0
- data/lib/automation_object/blue_print/hash_adapter/view.rb +29 -0
- data/lib/automation_object/blue_print/helpers/file_helper.rb +38 -0
- data/lib/automation_object/blue_print/yaml_adapter.rb +50 -0
- data/lib/automation_object/driver.rb +44 -0
- data/lib/automation_object/driver/appium_adapter/driver.rb +150 -0
- data/lib/automation_object/driver/appium_adapter/element.rb +118 -0
- data/lib/automation_object/driver/base.rb +11 -0
- data/lib/automation_object/driver/driver.rb +69 -245
- data/lib/automation_object/driver/element.rb +51 -210
- data/lib/automation_object/driver/helpers/selenium_driver_helper.rb +41 -0
- data/lib/automation_object/driver/helpers/selenium_element_helper.rb +138 -0
- data/lib/automation_object/driver/nokogiri_adapter/backup/driver.rb +83 -0
- data/lib/automation_object/driver/nokogiri_adapter/backup/element.rb +66 -0
- data/lib/automation_object/driver/nokogiri_adapter/backup/form.rb +29 -0
- data/lib/automation_object/driver/nokogiri_adapter/backup/helpers/driver_element_helper.rb +52 -0
- data/lib/automation_object/driver/nokogiri_adapter/backup/session.rb +115 -0
- data/lib/automation_object/driver/nokogiri_adapter/driver.rb +104 -0
- data/lib/automation_object/driver/nokogiri_adapter/element.rb +85 -0
- data/lib/automation_object/driver/nokogiri_adapter/error.rb +17 -0
- data/lib/automation_object/driver/selenium_adapter/driver.rb +143 -0
- data/lib/automation_object/driver/selenium_adapter/element.rb +116 -0
- data/lib/automation_object/dsl.rb +33 -0
- data/lib/automation_object/dsl/blue_print_adapter.rb +16 -0
- data/lib/automation_object/dsl/blue_print_adapter/composite.rb +54 -0
- data/lib/automation_object/dsl/blue_print_adapter/element.rb +14 -0
- data/lib/automation_object/dsl/blue_print_adapter/element_array.rb +14 -0
- data/lib/automation_object/dsl/blue_print_adapter/element_hash.rb +14 -0
- data/lib/automation_object/dsl/blue_print_adapter/modal.rb +23 -0
- data/lib/automation_object/dsl/blue_print_adapter/screen.rb +26 -0
- data/lib/automation_object/dsl/blue_print_adapter/top.rb +19 -0
- data/lib/automation_object/dsl/models.rb +18 -0
- data/lib/automation_object/dsl/proxies/element.rb +16 -0
- data/lib/automation_object/dsl/proxies/element_array.rb +16 -0
- data/lib/automation_object/dsl/proxies/element_hash.rb +16 -0
- data/lib/automation_object/dsl/proxies/helpers/composite_helper.rb +74 -0
- data/lib/automation_object/dsl/proxies/modal.rb +17 -0
- data/lib/automation_object/dsl/proxies/screen.rb +17 -0
- data/lib/automation_object/dsl/proxies/top.rb +17 -0
- data/lib/automation_object/framework.rb +79 -386
- data/lib/automation_object/helpers/composite.rb +95 -0
- data/lib/automation_object/helpers/composite_hook.rb +46 -0
- data/lib/automation_object/helpers/hash.rb +15 -0
- data/lib/automation_object/helpers/reflection_helper.rb +28 -0
- data/lib/automation_object/helpers/string.rb +27 -0
- data/lib/automation_object/proxies/mutex_proxy.rb +63 -0
- data/lib/automation_object/proxies/proxy.rb +20 -0
- data/lib/automation_object/proxies/throttle_proxy.rb +57 -0
- data/lib/automation_object/state.rb +37 -0
- data/lib/automation_object/state/blue_print_adapter.rb +16 -0
- data/lib/automation_object/state/blue_print_adapter/composite.rb +65 -0
- data/lib/automation_object/state/blue_print_adapter/element.rb +20 -0
- data/lib/automation_object/state/blue_print_adapter/element_array.rb +25 -0
- data/lib/automation_object/state/blue_print_adapter/element_hash.rb +31 -0
- data/lib/automation_object/state/blue_print_adapter/element_proxy.rb +28 -0
- data/lib/automation_object/state/blue_print_adapter/helpers/element_helper.rb +31 -0
- data/lib/automation_object/state/blue_print_adapter/helpers/screen_manager.rb +137 -0
- data/lib/automation_object/state/blue_print_adapter/helpers/window.rb +39 -0
- data/lib/automation_object/state/blue_print_adapter/hook.rb +56 -0
- data/lib/automation_object/state/blue_print_adapter/hook_action.rb +33 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/action_loop.rb +35 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/change_screen.rb +26 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/change_to_previous_screen.rb +21 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/close_modal.rb +31 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/close_screen.rb +19 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/element_requirement.rb +34 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/new_screen.rb +37 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/possible_screen_changes.rb +21 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/reset_screen.rb +18 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/show_modal.rb +26 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/sleep.rb +18 -0
- data/lib/automation_object/state/blue_print_adapter/hook_actions/wait_for_elements.rb +20 -0
- data/lib/automation_object/state/blue_print_adapter/modal.rb +26 -0
- data/lib/automation_object/state/blue_print_adapter/screen.rb +32 -0
- data/lib/automation_object/state/blue_print_adapter/top.rb +45 -0
- data/lib/automation_object/state/error.rb +24 -0
- data/lib/automation_object/state/session.rb +38 -0
- data/lib/automation_object/step_definitions.rb +14 -0
- data/lib/automation_object/step_definitions/action.rb +21 -0
- data/lib/automation_object/step_definitions/cache.rb +23 -0
- data/lib/automation_object/step_definitions/element/actions.rb +87 -0
- data/lib/automation_object/step_definitions/element/regex.rb +24 -0
- data/lib/automation_object/step_definitions/element/steps.rb +67 -0
- data/lib/automation_object/step_definitions/parse.rb +39 -0
- data/lib/automation_object/version.rb +1 -1
- metadata +194 -110
- data/lib/automation_object/blue_print_validation/base_validation.rb +0 -44
- data/lib/automation_object/blue_print_validation/common_methods.rb +0 -106
- data/lib/automation_object/blue_print_validation/element_validation.rb +0 -198
- data/lib/automation_object/blue_print_validation/formatted_errors.rb +0 -41
- data/lib/automation_object/blue_print_validation/hook_validation.rb +0 -393
- data/lib/automation_object/blue_print_validation/key_value_constants.rb +0 -75
- data/lib/automation_object/blue_print_validation/modal_validation.rb +0 -37
- data/lib/automation_object/blue_print_validation/screen_modal_common_methods.rb +0 -119
- data/lib/automation_object/blue_print_validation/screen_validation.rb +0 -21
- data/lib/automation_object/blue_print_validation/validation_object.rb +0 -32
- data/lib/automation_object/driver/anonymous.rb +0 -27
- data/lib/automation_object/element/element.rb +0 -145
- data/lib/automation_object/element/element_array.rb +0 -12
- data/lib/automation_object/element/element_cell.rb +0 -126
- data/lib/automation_object/element/element_group.rb +0 -33
- data/lib/automation_object/element/element_hash.rb +0 -25
- data/lib/automation_object/element/element_helpers.rb +0 -29
- data/lib/automation_object/element/element_methods.rb +0 -134
- data/lib/automation_object/element/elements_helpers.rb +0 -204
- data/lib/automation_object/framework/events.rb +0 -8
- data/lib/automation_object/framework/helpers.rb +0 -101
- data/lib/automation_object/framework/print_objects.rb +0 -67
- data/lib/automation_object/framework/screen_monitor.rb +0 -55
- data/lib/automation_object/framework/screen_routing.rb +0 -310
- data/lib/automation_object/framework/window_helpers.rb +0 -181
- data/lib/automation_object/hash.rb +0 -6
- data/lib/automation_object/hook_helpers.rb +0 -27
- data/lib/automation_object/logger.rb +0 -179
- data/lib/automation_object/object.rb +0 -22
- data/lib/automation_object/screen/modal.rb +0 -8
- data/lib/automation_object/screen/screen.rb +0 -209
- data/lib/automation_object/screen/screen_hook_helpers.rb +0 -319
- data/lib/automation_object/screen/screen_modal_helpers.rb +0 -101
- data/lib/automation_object/screen/screen_prompt_helpers.rb +0 -21
- data/lib/automation_object/screen/screen_window_helpers.rb +0 -149
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/element'
|
|
3
|
+
|
|
4
|
+
module AutomationObject
|
|
5
|
+
module Dsl
|
|
6
|
+
module BluePrintAdapter
|
|
7
|
+
#Element BluePrint adapter composite
|
|
8
|
+
class Element < Composite
|
|
9
|
+
#Which proxy to create for this composite
|
|
10
|
+
implements_proxy AutomationObject::Dsl::Proxies::Element
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/element_array'
|
|
3
|
+
|
|
4
|
+
module AutomationObject
|
|
5
|
+
module Dsl
|
|
6
|
+
module BluePrintAdapter
|
|
7
|
+
#ElementArray BluePrint adapter composite
|
|
8
|
+
class ElementArray < Composite
|
|
9
|
+
#Which proxy to create for this composite
|
|
10
|
+
implements_proxy AutomationObject::Dsl::Proxies::ElementArray
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/element_hash'
|
|
3
|
+
|
|
4
|
+
module AutomationObject
|
|
5
|
+
module Dsl
|
|
6
|
+
module BluePrintAdapter
|
|
7
|
+
#ElementHash BluePrint adapter composite
|
|
8
|
+
class ElementHash < Composite
|
|
9
|
+
#Which proxy to create for this composite
|
|
10
|
+
implements_proxy AutomationObject::Dsl::Proxies::ElementHash
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/modal'
|
|
3
|
+
|
|
4
|
+
require_relative 'element'
|
|
5
|
+
require_relative 'element_array'
|
|
6
|
+
require_relative 'element_hash'
|
|
7
|
+
|
|
8
|
+
module AutomationObject
|
|
9
|
+
module Dsl
|
|
10
|
+
module BluePrintAdapter
|
|
11
|
+
#Modal BluePrint adapter composite
|
|
12
|
+
class Modal < Composite
|
|
13
|
+
#Which proxy to create for this composite
|
|
14
|
+
implements_proxy AutomationObject::Dsl::Proxies::Modal
|
|
15
|
+
|
|
16
|
+
#Children for this composite
|
|
17
|
+
has_many :elements, interface: Element
|
|
18
|
+
has_many :element_arrays, interface: ElementArray
|
|
19
|
+
has_many :element_hashes, interface: ElementHash
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/screen'
|
|
3
|
+
|
|
4
|
+
require_relative 'modal'
|
|
5
|
+
require_relative 'element'
|
|
6
|
+
require_relative 'element_array'
|
|
7
|
+
require_relative 'element_hash'
|
|
8
|
+
|
|
9
|
+
module AutomationObject
|
|
10
|
+
module Dsl
|
|
11
|
+
module BluePrintAdapter
|
|
12
|
+
#Screen BluePrint adapter composite
|
|
13
|
+
class Screen < Composite
|
|
14
|
+
#Which proxy to create for this composite
|
|
15
|
+
implements_proxy AutomationObject::Dsl::Proxies::Screen
|
|
16
|
+
|
|
17
|
+
#Children for this composite
|
|
18
|
+
has_many :modals, interface: Modal
|
|
19
|
+
|
|
20
|
+
has_many :elements, interface: Element
|
|
21
|
+
has_many :element_arrays, interface: ElementArray
|
|
22
|
+
has_many :element_hashes, interface: ElementHash
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require_relative 'composite'
|
|
2
|
+
require_relative '../proxies/top'
|
|
3
|
+
|
|
4
|
+
require_relative 'screen'
|
|
5
|
+
|
|
6
|
+
module AutomationObject
|
|
7
|
+
module Dsl
|
|
8
|
+
module BluePrintAdapter
|
|
9
|
+
#Top BluePrint adapter composite
|
|
10
|
+
class Top < Composite
|
|
11
|
+
#Which proxy to create for this composite
|
|
12
|
+
implements_proxy AutomationObject::Dsl::Proxies::Top
|
|
13
|
+
|
|
14
|
+
#Children for this composite
|
|
15
|
+
has_many :screens, interface: Screen
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module AutomationObject
|
|
2
|
+
module Dsl
|
|
3
|
+
module Models
|
|
4
|
+
class Top < OpenStruct;
|
|
5
|
+
end
|
|
6
|
+
class Screen < OpenStruct;
|
|
7
|
+
end
|
|
8
|
+
class Modal < OpenStruct;
|
|
9
|
+
end
|
|
10
|
+
class Element < OpenStruct;
|
|
11
|
+
end
|
|
12
|
+
class ElementHash < OpenStruct;
|
|
13
|
+
end
|
|
14
|
+
class ElementArray < OpenStruct;
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/composite_helper'
|
|
4
|
+
|
|
5
|
+
module AutomationObject::Dsl
|
|
6
|
+
module Proxies
|
|
7
|
+
#Element proxy for model
|
|
8
|
+
class Element < AutomationObject::Proxies::Proxy
|
|
9
|
+
include CompositeHelper
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@subject = nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/composite_helper'
|
|
4
|
+
|
|
5
|
+
module AutomationObject::Dsl
|
|
6
|
+
module Proxies
|
|
7
|
+
#ElementArray proxy for model
|
|
8
|
+
class ElementArray < AutomationObject::Proxies::Proxy
|
|
9
|
+
include CompositeHelper
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@subject = nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/composite_helper'
|
|
4
|
+
|
|
5
|
+
module AutomationObject::Dsl
|
|
6
|
+
module Proxies
|
|
7
|
+
#ElementHash proxy for model
|
|
8
|
+
class ElementHash < AutomationObject::Proxies::Proxy
|
|
9
|
+
include CompositeHelper
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@subject = nil
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module AutomationObject::Dsl
|
|
2
|
+
module Proxies
|
|
3
|
+
#CompositeHelper for DSL Proxies
|
|
4
|
+
#Proxies will deal with the State and wrap around the models
|
|
5
|
+
module CompositeHelper
|
|
6
|
+
attr_accessor :state
|
|
7
|
+
|
|
8
|
+
# @param state [AutomationObject::State::Session]
|
|
9
|
+
def state=(state)
|
|
10
|
+
@state = state
|
|
11
|
+
self.children.each { |child|
|
|
12
|
+
@subject[child].state = @state
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @return [Array] hooks array or empty array
|
|
17
|
+
def hooks
|
|
18
|
+
@hooks ||= Array.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @return [Hash] composite hooks or empty hash
|
|
22
|
+
def composite_hooks
|
|
23
|
+
@composite_hooks ||= Hash.new
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @return [Array] children array or empty array
|
|
27
|
+
def children
|
|
28
|
+
@children ||= Array.new
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Use this to add children to the DSL composite
|
|
32
|
+
# @param args [Hash] arguments for adding a child to this composite
|
|
33
|
+
def add(args={})
|
|
34
|
+
name = args.fetch :name
|
|
35
|
+
@subject[name] = args.fetch :object
|
|
36
|
+
self.children.push(name)
|
|
37
|
+
|
|
38
|
+
type = args.fetch(:type)
|
|
39
|
+
|
|
40
|
+
case type
|
|
41
|
+
when :screen, :modal
|
|
42
|
+
#Just load
|
|
43
|
+
self.composite_hooks[name] = lambda { self.request_load(type, name) }
|
|
44
|
+
when :element, :element_array, :element_hash
|
|
45
|
+
#Set return to subject
|
|
46
|
+
self.composite_hooks[name] = lambda { @subject[name] = self.request_load(type, name) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
@subject[name].hooks.push(self.composite_hooks[name]) if self.composite_hooks.has_key?(name)
|
|
50
|
+
return @subject[name]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Request the state to load an object
|
|
54
|
+
# @param type [Symbol] type of object (:screen, :modal, :element, :etc...)
|
|
55
|
+
# @param name [Symbol] name of the object
|
|
56
|
+
def request_load(type, name)
|
|
57
|
+
@state.load(type, name)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
#Override to allow for hooks to be run when using the DSL API
|
|
61
|
+
def method_missing(method_symbol, *args, &block)
|
|
62
|
+
return super unless self.children.include?(method_symbol)
|
|
63
|
+
|
|
64
|
+
self.hooks.each { |hook| hook.call }
|
|
65
|
+
|
|
66
|
+
if self.composite_hooks.has_key?(method_symbol)
|
|
67
|
+
self.composite_hooks[method_symbol].call
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
super
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
require_relative '../models.rb'
|
|
3
|
+
|
|
4
|
+
require_relative 'helpers/composite_helper'
|
|
5
|
+
|
|
6
|
+
module AutomationObject::Dsl
|
|
7
|
+
module Proxies
|
|
8
|
+
#Modal proxy for model
|
|
9
|
+
class Modal < AutomationObject::Proxies::Proxy
|
|
10
|
+
include CompositeHelper
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@subject = Models::Modal.new
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
require_relative '../models.rb'
|
|
3
|
+
|
|
4
|
+
require_relative 'helpers/composite_helper'
|
|
5
|
+
|
|
6
|
+
module AutomationObject::Dsl
|
|
7
|
+
module Proxies
|
|
8
|
+
#Screen proxy for model
|
|
9
|
+
class Screen < AutomationObject::Proxies::Proxy
|
|
10
|
+
include CompositeHelper
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@subject = Models::Screen.new
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative '../../proxies/proxy'
|
|
2
|
+
require_relative '../models'
|
|
3
|
+
|
|
4
|
+
require_relative 'helpers/composite_helper'
|
|
5
|
+
|
|
6
|
+
module AutomationObject::Dsl
|
|
7
|
+
module Proxies
|
|
8
|
+
#Top proxy for model
|
|
9
|
+
class Top < AutomationObject::Proxies::Proxy
|
|
10
|
+
include CompositeHelper
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@subject = Models::Top.new
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,407 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
include AutomationObject::FrameworkPrintObjects
|
|
7
|
-
include AutomationObject::FrameworkScreenMonitor
|
|
8
|
-
|
|
9
|
-
include EventEmitter
|
|
10
|
-
include AutomationObject::FrameworkEvents
|
|
11
|
-
|
|
12
|
-
attr_accessor :driver_object, :configuration,
|
|
13
|
-
:current_screen_class, :previous_screen_class, #Singular
|
|
14
|
-
:current_screen_hash, :previous_screen_hash, #Multiple, base screens on window_handle
|
|
15
|
-
:screen_history_hash, #keys => window_handles, values => array of screen_class_symbols
|
|
16
|
-
:screen_monitor_thread,
|
|
17
|
-
:screen_monitor_mutex_object
|
|
18
|
-
|
|
19
|
-
def initialize(driver, configuration)
|
|
20
|
-
self.screen_monitor_mutex_object = Mutex.new #Mutex for screen monitor threads, operate one at a time, multiple window edge case
|
|
21
|
-
|
|
22
|
-
#Hash for contained screen monitor threads
|
|
23
|
-
self.screen_monitor_thread = Hash.new
|
|
24
|
-
|
|
25
|
-
self.configuration = configuration
|
|
26
|
-
|
|
27
|
-
#Wrap driver object in our Driver for Thread Safe operations
|
|
28
|
-
self.driver_object = AutomationObject::Driver::Driver.new(driver)
|
|
29
|
-
if self.configuration['throttle_driver_methods']
|
|
30
|
-
AutomationObject::Driver::Driver::throttle_methods = self.configuration['throttle_driver_methods']
|
|
31
|
-
end
|
|
32
|
-
if self.configuration['throttle_element_methods']
|
|
33
|
-
AutomationObject::Driver::Element::throttle_methods = self.configuration['throttle_element_methods']
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
#Support multiple windows for Browser
|
|
37
|
-
if self.is_browser?
|
|
38
|
-
self.current_screen_hash = Hash.new
|
|
39
|
-
self.previous_screen_hash = Hash.new
|
|
40
|
-
self.screen_history_hash = Hash.new
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
#Add Screens
|
|
44
|
-
self.add_screens(configuration['screens']) if configuration['screens']
|
|
45
|
-
|
|
46
|
-
#Set Initial Screen
|
|
47
|
-
self.set_initial_screen
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def respond_to?(method_symbol, include_private = false)
|
|
51
|
-
#Translate method in possible internal storage attribute
|
|
52
|
-
class_symbol = self.translate_string_to_class(method_symbol)
|
|
53
|
-
instance_symbol = class_symbol.to_s.gsub(/^@/, '')
|
|
54
|
-
instance_symbol = "@#{instance_symbol}".to_sym
|
|
55
|
-
|
|
56
|
-
self.instance_variables.each { |instance_variable|
|
|
57
|
-
return true if instance_variable == instance_symbol
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
#If not then do the super on the method_symbol
|
|
61
|
-
super.respond_to?(method_symbol, include_private)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def method_missing(screen_name, *args, &block)
|
|
65
|
-
unless self.current_screen_class #Don't think this happens, but throwing an exception for checking
|
|
66
|
-
raise "No current screen defined when calling the screen (#{screen_name})"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
#Translate screen name to internal class property
|
|
70
|
-
screen_class_symbol = self.translate_string_to_class(screen_name)
|
|
71
|
-
unless self.respond_to?(screen_class_symbol)
|
|
72
|
-
raise ArgumentError, "Screen called (#{screen_name}) has not been defined"
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
#Check for any closed windows and update accordingly
|
|
76
|
-
#Todo: Important!!!! check if this affects anything negatively
|
|
77
|
-
#self.check_closed_windows if self.is_browser?
|
|
78
|
-
|
|
79
|
-
#Return screen object if it is the current screen
|
|
80
|
-
return self.send(screen_class_symbol, *args, &block) if self.current_screen_class == screen_class_symbol
|
|
81
|
-
|
|
82
|
-
#Check mobile, then just switch_to if the screen is already live
|
|
83
|
-
if self.is_browser?
|
|
84
|
-
self.current_screen_hash.each { |window_handle, current_screen_symbol|
|
|
85
|
-
if current_screen_symbol == screen_class_symbol
|
|
86
|
-
self.switch_to_window(window_handle) unless window_handle == self.get_current_window_handle
|
|
87
|
-
|
|
88
|
-
self.current_screen_class = current_screen_symbol
|
|
89
|
-
return self.send(screen_class_symbol, *args, &block)
|
|
90
|
-
end
|
|
91
|
-
}
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
unless self.is_browser?
|
|
95
|
-
self.route_to_screen(self.current_screen_class, screen_class_symbol)
|
|
96
|
-
return self.send(screen_class_symbol, *args, &block)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
#Screen is not live, then try to route to it
|
|
100
|
-
routed = false
|
|
101
|
-
|
|
102
|
-
self.current_screen_hash.each { |window_handle, current_screen_symbol|
|
|
103
|
-
self.switch_to_window(window_handle)
|
|
104
|
-
self.current_screen_class = current_screen_symbol
|
|
105
|
-
|
|
106
|
-
begin
|
|
107
|
-
self.route_to_screen(self.current_screen_class, screen_class_symbol)
|
|
108
|
-
routed = true
|
|
109
|
-
break
|
|
110
|
-
rescue Exception => e
|
|
111
|
-
puts "Unable to route under #{self.current_screen_class} and #{screen_class_symbol}".colorize(:red)
|
|
112
|
-
ap e
|
|
113
|
-
ap e.message
|
|
114
|
-
ap e.backtrace
|
|
115
|
-
# ignored
|
|
116
|
-
end
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
unless routed
|
|
120
|
-
#Kind of an edge case but can happen
|
|
121
|
-
if self.current_screen_class != screen_class_symbol
|
|
122
|
-
requested_screen = self.translate_class_to_string(screen_class_symbol)
|
|
123
|
-
current_screen = self.translate_class_to_string(self.current_screen_class)
|
|
124
|
-
|
|
125
|
-
raise "Unable to route to screen from any of the current screens. Current Screen (#{current_screen}), Requested Screen (#{requested_screen})"
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
self.send(screen_class_symbol, *args, &block)
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
def set_initial_screen
|
|
133
|
-
if self.is_browser?
|
|
134
|
-
unless self.configuration['base_url']
|
|
135
|
-
raise ArgumentError, 'base_url is required for Browser configurations'
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
begin
|
|
139
|
-
self.driver_object.navigate.to(self.configuration['base_url'])
|
|
140
|
-
rescue Net::ReadTimeout
|
|
141
|
-
sleep(5)
|
|
142
|
-
self.driver_object.navigate.to(self.configuration['base_url'])
|
|
143
|
-
end
|
|
144
|
-
else
|
|
145
|
-
raise ArgumentError, 'App based configuration should not have base_url in configuration' if self.configuration['base_url']
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
#Skip checking live? configurations if default_screen is set
|
|
149
|
-
if self.configuration['default_screen']
|
|
150
|
-
initial_screen_symbol = self.translate_string_to_class(self.configuration['default_screen'])
|
|
151
|
-
|
|
152
|
-
unless self.respond_to?(initial_screen_symbol)
|
|
153
|
-
raise "Default screen #{self.configuration['default_screen']} has not been defined in configuration"
|
|
154
|
-
end
|
|
155
|
-
else
|
|
156
|
-
initial_screen_symbol = self.find_current_screen
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
unless initial_screen_symbol
|
|
160
|
-
raise 'Unable to find the initial screen via live? configurations or no default screen was specified'
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
AutomationObject::Logger::add("Setting as initial screen #{initial_screen_symbol}")
|
|
164
|
-
|
|
165
|
-
self.set_current_screen(initial_screen_symbol)
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
def find_current_screen
|
|
169
|
-
AutomationObject::Logger::add('Looking for possible current screens through screen live? configurations')
|
|
170
|
-
|
|
171
|
-
return nil unless self.configuration['screens'].class == Hash
|
|
172
|
-
|
|
173
|
-
self.configuration['screens'].each_key { |screen_name|
|
|
174
|
-
screen_class_symbol = self.translate_string_to_class(screen_name)
|
|
175
|
-
|
|
176
|
-
next unless self.configuration['screens'][screen_name].class == Hash
|
|
177
|
-
next unless self.configuration['screens'][screen_name]['live?'].class == Hash
|
|
178
|
-
|
|
179
|
-
if self.current_screen?(screen_name)
|
|
180
|
-
AutomationObject::Logger::add("Found current screen #{screen_name}")
|
|
181
|
-
return screen_class_symbol
|
|
182
|
-
end
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
nil
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def current_screen?(screen_name)
|
|
189
|
-
screen_class_symbol = self.translate_string_to_class(screen_name)
|
|
190
|
-
|
|
191
|
-
#Raise error if screen doesn't exist, shouldn't be called in the first place if it doesn't
|
|
192
|
-
unless self.respond_to?(screen_class_symbol)
|
|
193
|
-
raise ArgumentError, "Screen has not been defined, #{screen_class_symbol}"
|
|
194
|
-
end
|
|
1
|
+
require_relative 'proxies/proxy'
|
|
2
|
+
require_relative 'blue_print'
|
|
3
|
+
require_relative 'driver'
|
|
4
|
+
require_relative 'dsl'
|
|
5
|
+
require_relative 'state'
|
|
195
6
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
7
|
+
module AutomationObject
|
|
8
|
+
#Framework class, the core
|
|
9
|
+
#A Proxy class that will become the DSL Framework
|
|
10
|
+
class Framework < Proxies::Proxy
|
|
11
|
+
# @return [AutomationObject::BluePrint::Composite::Top]
|
|
12
|
+
attr_accessor :blue_prints
|
|
13
|
+
|
|
14
|
+
# @return [AutomationObject::Driver::Driver]
|
|
15
|
+
attr_accessor :driver
|
|
16
|
+
|
|
17
|
+
# @return [AutomationObject::State::Session]
|
|
18
|
+
attr_accessor :state
|
|
19
|
+
|
|
20
|
+
# @return [Dsl] workable dsl composite object
|
|
21
|
+
attr_accessor :dsl
|
|
22
|
+
|
|
23
|
+
# Will assume nil or :nokogiri is XML based and AutomationObject
|
|
24
|
+
# can also automate XML
|
|
25
|
+
# @param driver [Selenium::WebDriver::Driver,Appium::Driver,nil] selenium type driver or nil
|
|
26
|
+
# @param blue_prints [Hash] arguments for Framework
|
|
27
|
+
def initialize(driver, blue_prints)
|
|
28
|
+
self.driver = driver
|
|
29
|
+
self.blue_prints = blue_prints
|
|
30
|
+
|
|
31
|
+
#Create the DSL
|
|
32
|
+
#Should create all subsequent needed object
|
|
33
|
+
@subject = self.dsl
|
|
34
|
+
|
|
35
|
+
AutomationObject::Framework.singleton = self
|
|
200
36
|
end
|
|
201
37
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
screen_class_symbol = self.translate_string_to_class(screen_name)
|
|
207
|
-
|
|
208
|
-
#Add screen class to self
|
|
209
|
-
setter = "#{screen_class_symbol}="
|
|
210
|
-
self.class.send(:attr_accessor, screen_class_symbol) unless self.respond_to?(setter)
|
|
211
|
-
|
|
212
|
-
screen_object_options = {
|
|
213
|
-
:framework_object => self,
|
|
214
|
-
:driver_object => self.driver_object,
|
|
215
|
-
:blue_prints => screen_configuration,
|
|
216
|
-
:screen_name => screen_name
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
send setter, Screen.new(screen_object_options)
|
|
220
|
-
|
|
221
|
-
#Add Listeners
|
|
222
|
-
self.send(screen_class_symbol).on :change_screen do |args|
|
|
223
|
-
this.change_screen_listener(args[:screen_class_symbol], args[:created_window_handle])
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
self.send(screen_class_symbol).on :possible_screen_changes do |args|
|
|
227
|
-
this.possible_change_screen_listener(args[:possible_screens], args[:created_window_handle])
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
self.send(screen_class_symbol).on :close_window do |args|
|
|
231
|
-
this.close_window(args[:screen_name], args[:skip_close])
|
|
232
|
-
end
|
|
233
|
-
}
|
|
38
|
+
# dsl get method
|
|
39
|
+
# @return [Dsl] workable dsl composite object
|
|
40
|
+
def dsl
|
|
41
|
+
@dsl ||= Dsl.new(blue_prints: self.blue_prints, state: self.state)
|
|
234
42
|
end
|
|
235
43
|
|
|
236
|
-
|
|
237
|
-
|
|
44
|
+
# state get method
|
|
45
|
+
# @return [State] state object which actively controls the ui state
|
|
46
|
+
def state
|
|
47
|
+
@state ||= State.new(self.blue_prints, self.driver)
|
|
238
48
|
end
|
|
239
49
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
50
|
+
# BluePrints (UI configurations) wrapped in an composite
|
|
51
|
+
# Composite provides a common interface for all adapters
|
|
52
|
+
# @param value [String, Hash] String to YAML files or Hash configuration
|
|
53
|
+
# @return [AutomationObject::BluePrint::Composite::Top] top composite object
|
|
54
|
+
def blue_prints=(value)
|
|
55
|
+
case value
|
|
56
|
+
when String
|
|
57
|
+
BluePrint.adapter = :yaml
|
|
58
|
+
when Hash
|
|
59
|
+
BluePrint.adapter = :hash
|
|
247
60
|
end
|
|
248
61
|
|
|
249
|
-
|
|
250
|
-
raise ArgumentError, "Requested symbol (#{screen_class_symbol}) is not a Screen class"
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
#Remove listeners
|
|
254
|
-
self.send(screen_class_symbol).reset_screen
|
|
62
|
+
@blue_prints = BluePrint.new(value)
|
|
255
63
|
end
|
|
256
64
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
self.reset_screen(screen_class_symbol)
|
|
268
|
-
|
|
269
|
-
#Sleep if default sleep
|
|
270
|
-
if self.configuration['screen_transition_sleep']
|
|
271
|
-
transition_sleep = self.configuration['screen_transition_sleep'].to_f
|
|
272
|
-
sleep(transition_sleep)
|
|
65
|
+
# Driver port provides a formatted interface for interacting with different drivers
|
|
66
|
+
# @return [AutomationObject::Driver::Driver] driver interface object
|
|
67
|
+
def driver=(value)
|
|
68
|
+
case value
|
|
69
|
+
when Selenium::WebDriver::Driver
|
|
70
|
+
Driver.adapter = :selenium
|
|
71
|
+
when Appium::Driver
|
|
72
|
+
Driver.adapter = :appium
|
|
73
|
+
else
|
|
74
|
+
Driver.adapter = :nokogiri
|
|
273
75
|
end
|
|
274
76
|
|
|
275
|
-
|
|
276
|
-
self.send(self.previous_screen_class).active_modal = nil if self.previous_screen_class
|
|
277
|
-
|
|
278
|
-
#Do multiple set current screens if multiple screens
|
|
279
|
-
if self.is_browser?
|
|
280
|
-
self.set_current_screen_multiple(screen_class_symbol, new_window)
|
|
281
|
-
self.wait_for_window_load
|
|
282
|
-
self.wait_for_stable_body_size
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
#Before Load Event
|
|
286
|
-
self.send(screen_class_symbol).before_load
|
|
287
|
-
|
|
288
|
-
#Set current_screen_class
|
|
289
|
-
self.current_screen_class = screen_class_symbol
|
|
290
|
-
|
|
291
|
-
#Emit Screen Change
|
|
292
|
-
self.emit :change_screen, self.translate_class_to_symbol(screen_class_symbol)
|
|
293
|
-
|
|
294
|
-
#Possible Automatic Screen Changes
|
|
295
|
-
screen_configuration = self.send(screen_class_symbol).configuration
|
|
296
|
-
return unless screen_configuration.is_a?(Hash)
|
|
297
|
-
return unless screen_configuration['automatic_screen_changes'].is_a?(Array)
|
|
298
|
-
return if screen_configuration.length == 0
|
|
299
|
-
|
|
300
|
-
AutomationObject::Logger::add("Adding thread listener for screen #{screen_class_symbol}")
|
|
301
|
-
self.screen_monitor_thread[screen_class_symbol] = Thread.new {
|
|
302
|
-
self.screen_monitor_thread_method(screen_class_symbol)
|
|
303
|
-
}
|
|
77
|
+
@driver = Driver.new(value)
|
|
304
78
|
end
|
|
305
79
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
message = "Tried to change screen to (#{screen_name}).
|
|
314
|
-
(#{screen_name}) did not pass live? configuration test. "
|
|
315
|
-
|
|
316
|
-
#If it misses the first time around, no need to error out the screen is should be on anyways
|
|
317
|
-
return if possible_screen_symbol == screen_class_symbol
|
|
318
|
-
|
|
319
|
-
if possible_screen_symbol
|
|
320
|
-
possible_screen_name = self.translate_class_to_string(possible_screen_symbol)
|
|
321
|
-
message << "Got (#{possible_screen_name}) screen instead."
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
raise message
|
|
325
|
-
end
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
def possible_change_screen_listener(possible_screens, created_window_handle = false)
|
|
329
|
-
AutomationObject::Logger::add("Going to try to change to possible screens #{possible_screens}")
|
|
330
|
-
|
|
331
|
-
set_new_screen = false
|
|
332
|
-
|
|
333
|
-
possible_screens.each { |possible_screen_name|
|
|
334
|
-
possible_screen_symbol = self.translate_string_to_class(possible_screen_name)
|
|
335
|
-
|
|
336
|
-
begin
|
|
337
|
-
self.set_current_screen(possible_screen_symbol, created_window_handle)
|
|
338
|
-
|
|
339
|
-
if self.current_screen?(possible_screen_name)
|
|
340
|
-
set_new_screen = true
|
|
341
|
-
break #It worked, screen changed
|
|
342
|
-
end
|
|
343
|
-
rescue
|
|
344
|
-
#Unable to set current screen, don't do much
|
|
345
|
-
end
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return if set_new_screen
|
|
349
|
-
|
|
350
|
-
#Raise message since unable to change to any of the screens
|
|
351
|
-
raise "Unable to change to any of the possible screens #{possible_screens}"
|
|
80
|
+
# Reset the entire state, remove any values
|
|
81
|
+
# Leave the driver alone here, can be done elsewhere
|
|
82
|
+
# @return [void]
|
|
83
|
+
def quit
|
|
84
|
+
self.state.quit #Quit the state. That way it knows to kill threads if operational
|
|
85
|
+
self.dsl, self.state, self.blue_prints, self.driver = nil
|
|
352
86
|
end
|
|
353
87
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
self.screen_history_hash[current_window_handle] = Array.new
|
|
360
|
-
self.screen_history_hash[current_window_handle].push(screen_class_symbol)
|
|
361
|
-
self.send(screen_class_symbol).window_handle = current_window_handle
|
|
362
|
-
|
|
363
|
-
return
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
switch_to_window_handle = nil
|
|
367
|
-
|
|
368
|
-
if new_window
|
|
369
|
-
self.current_screen_hash[new_window] = screen_class_symbol
|
|
370
|
-
self.switch_to_window(new_window)
|
|
371
|
-
self.screen_history_hash[new_window] = Array.new
|
|
372
|
-
self.screen_history_hash[new_window].push(screen_class_symbol)
|
|
373
|
-
self.send(screen_class_symbol).window_handle = new_window
|
|
374
|
-
|
|
375
|
-
return
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
#Add previous screen to previous screen hash
|
|
379
|
-
if self.current_screen_class and not new_window
|
|
380
|
-
self.current_screen_hash.each { |window_handle, current_screen_symbol|
|
|
381
|
-
if self.current_screen_class == current_screen_symbol
|
|
382
|
-
self.previous_screen_hash[window_handle] = current_screen_symbol
|
|
383
|
-
self.current_screen_hash[window_handle] = screen_class_symbol
|
|
384
|
-
switch_to_window_handle = window_handle
|
|
385
|
-
|
|
386
|
-
unless self.screen_history_hash[window_handle].class == Array
|
|
387
|
-
self.screen_history_hash[window_handle] = Array.new
|
|
388
|
-
end
|
|
389
|
-
|
|
390
|
-
self.screen_history_hash[window_handle].push(screen_class_symbol)
|
|
391
|
-
self.send(screen_class_symbol).window_handle = window_handle
|
|
392
|
-
|
|
393
|
-
break
|
|
394
|
-
end
|
|
395
|
-
}
|
|
396
|
-
end
|
|
397
|
-
|
|
398
|
-
#Switch to window handle if set
|
|
399
|
-
if switch_to_window_handle
|
|
400
|
-
return if self.current_screen_hash.keys.length == 1
|
|
88
|
+
# Static Hack
|
|
89
|
+
# TODO: figure a multiple instance way of using ao in Cucumber context
|
|
90
|
+
# Leaving for now to continue testing and building of whole framework
|
|
91
|
+
class << self
|
|
92
|
+
attr_accessor :singleton
|
|
401
93
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
94
|
+
#Singleton method if using Cucumber
|
|
95
|
+
# @return [Framework] singleton of self
|
|
96
|
+
def get
|
|
97
|
+
return self.singleton
|
|
405
98
|
end
|
|
406
99
|
end
|
|
407
100
|
end
|