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
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module BluePrintValidation
|
|
3
|
-
module KeyValueConstants
|
|
4
|
-
ELEMENT_KEYS = ['length', 'exists?', 'click', 'visible?', 'invisible?',
|
|
5
|
-
'id', 'href', 'scroll_to_view', 'x', 'y', 'width', 'height', 'drag_to_element',
|
|
6
|
-
'get_element_center', 'name', 'value', 'type', 'clear', 'tag_name', 'text',
|
|
7
|
-
'size', 'location', 'rel_location', 'send_keys', 'set_value', 'displayed?', 'selected?',
|
|
8
|
-
'attribute', 'clear', 'attribute', 'click', 'css_value', 'displayed?', 'enabled?',
|
|
9
|
-
'location', 'location_once_scrolled_into_view', 'ref', 'selected?', 'send_keys',
|
|
10
|
-
'size', 'submit', 'tag_name', 'text', 'content']
|
|
11
|
-
|
|
12
|
-
HOOK_KEYS = ['live?', 'before_load', 'accept', 'dismiss', 'scroll_up', 'scroll_down', 'scroll_right', 'scroll_left']
|
|
13
|
-
|
|
14
|
-
BASE_PAIR_TYPES = {
|
|
15
|
-
'base_url' => String,
|
|
16
|
-
'default_screen' => String,
|
|
17
|
-
'throttle_element_interactions' => Hash,
|
|
18
|
-
'throttle_element_methods' => Hash,
|
|
19
|
-
'throttle_driver_methods' => Hash,
|
|
20
|
-
'screen_transition_sleep' => Numeric,
|
|
21
|
-
'views' => Hash,
|
|
22
|
-
'screens' => Hash
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
THROTTLE_ELEMENT_PAIR_TYPES = Hash[*ELEMENT_KEYS.collect { |v| [v, Numeric] }.flatten]
|
|
26
|
-
|
|
27
|
-
SCREEN_PAIR_TYPES = {
|
|
28
|
-
'modals' => Hash,
|
|
29
|
-
'included_views' => Array,
|
|
30
|
-
'automatic_screen_changes' => Array,
|
|
31
|
-
'elements' => Hash,
|
|
32
|
-
'element_groups' => Hash
|
|
33
|
-
}.merge(Hash[*HOOK_KEYS.collect { |v| [v, Hash] }.flatten])
|
|
34
|
-
|
|
35
|
-
MODAL_PAIR_TYPES = SCREEN_PAIR_TYPES
|
|
36
|
-
|
|
37
|
-
ELEMENT_PAIR_TYPES = {
|
|
38
|
-
'in_iframe' => String,
|
|
39
|
-
'css' => String,
|
|
40
|
-
'xpath' => String,
|
|
41
|
-
'multiple' => TrueClass,
|
|
42
|
-
'multiple_ios_fix' => TrueClass,
|
|
43
|
-
'define_elements_by' => String,
|
|
44
|
-
'custom_methods' => Hash,
|
|
45
|
-
'custom_range' => Hash,
|
|
46
|
-
'remove_duplicates' => String
|
|
47
|
-
}.merge(Hash[*ELEMENT_KEYS.collect { |v| [v, Hash] }.flatten])
|
|
48
|
-
|
|
49
|
-
ELEMENT_CUSTOM_METHOD_PAIR_TYPES = {
|
|
50
|
-
'element_method' => String,
|
|
51
|
-
'evaluate' => String
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
HOOK_PAIR_TYPES = {
|
|
55
|
-
'before' => Hash,
|
|
56
|
-
'after' => Hash,
|
|
57
|
-
'elements' => Array
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
HOOK_ACTION_PAIR_TYPES = {
|
|
61
|
-
'wait_for_new_window' => TrueClass,
|
|
62
|
-
'show_modal' => String,
|
|
63
|
-
'close_window' => TrueClass,
|
|
64
|
-
'change_screen' => String,
|
|
65
|
-
'sleep' => Numeric,
|
|
66
|
-
'wait_for_elements' => Array,
|
|
67
|
-
'change_to_previous_screen' => TrueClass,
|
|
68
|
-
'close_modal' => TrueClass,
|
|
69
|
-
'automatic_onload_modals' => Array,
|
|
70
|
-
'reset_screen' => TrueClass,
|
|
71
|
-
'possible_screen_changes' => Array
|
|
72
|
-
}
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module BluePrintValidation
|
|
3
|
-
module ModalValidation
|
|
4
|
-
include ScreenModalCommonMethods
|
|
5
|
-
|
|
6
|
-
def validate_modals
|
|
7
|
-
error_messages = Array.new
|
|
8
|
-
|
|
9
|
-
self.get_all_modals.each { |modal|
|
|
10
|
-
error_messages += self.validate_screen_modal(modal[:screen_name], modal[:modal_name], modal[:configuration])
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return error_messages
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def get_all_modals
|
|
17
|
-
modals = Array.new
|
|
18
|
-
return modals unless self.has_key?('screens')
|
|
19
|
-
return modals unless self['screens'].class == Hash
|
|
20
|
-
|
|
21
|
-
self['screens'].each { |screen_name, screen_configuration|
|
|
22
|
-
next unless screen_configuration.class == Hash
|
|
23
|
-
next unless screen_configuration.has_key?('modals')
|
|
24
|
-
next unless screen_configuration['modals'].class == Hash
|
|
25
|
-
|
|
26
|
-
screen_configuration['modals'].each { |modal_name, modal_configuration|
|
|
27
|
-
next if modal_configuration == nil
|
|
28
|
-
modal = {:screen_name => screen_name, :modal_name => modal_name, :configuration => modal_configuration}
|
|
29
|
-
modals.push(modal)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return modals
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module BluePrintValidation
|
|
3
|
-
module ScreenModalCommonMethods
|
|
4
|
-
def validate_screen_modal(screen_name, modal_name = false, configuration)
|
|
5
|
-
error_messages = Array.new
|
|
6
|
-
|
|
7
|
-
if modal_name == false #Skip multiple errors
|
|
8
|
-
unless screen_name.is_a?(String)
|
|
9
|
-
error_message = "(screens) level key (#{screen_name}) is an invalid key type, expecting: ("
|
|
10
|
-
error_message << String.to_s
|
|
11
|
-
error_message << "), got: (#{screen_name.class.to_s})"
|
|
12
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
13
|
-
end
|
|
14
|
-
else
|
|
15
|
-
unless modal_name.is_a?(String)
|
|
16
|
-
error_message = "(screens/#{screen_name}/modals) level key (#{modal_name}) is an invalid key type, expecting: ("
|
|
17
|
-
error_message << String.to_s
|
|
18
|
-
error_message << "), got: (#{modal_name.class.to_s})"
|
|
19
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
return error_messages if configuration == nil
|
|
24
|
-
|
|
25
|
-
unless configuration.is_a?(Hash)
|
|
26
|
-
if modal_name == false
|
|
27
|
-
error_message = "(screens) level key (#{screen_name}) has an invalid value type, expecting: ("
|
|
28
|
-
else
|
|
29
|
-
error_message = "(screens/#{screen_name}/modals) level key (#{modal_name}) has an invalid value type, expecting: ("
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
error_message << Hash.to_s
|
|
33
|
-
error_message << "), got: (#{configuration.class.to_s})"
|
|
34
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
35
|
-
|
|
36
|
-
return error_messages
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
configuration.each { |sub_screen_key, sub_screen_value|
|
|
40
|
-
#Check if valid screen keys
|
|
41
|
-
unless KeyValueConstants::SCREEN_PAIR_TYPES.keys.include?(sub_screen_key)
|
|
42
|
-
if modal_name == false
|
|
43
|
-
error_message = "(screens) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
44
|
-
else
|
|
45
|
-
error_message = "(screens/#{screen_name}/modals) level key (#{modal_name}) sub key (#{sub_screen_key}) "
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
error_message << 'is not a valid key, available (screens) sub level keys ('
|
|
49
|
-
error_message << KeyValueConstants::SCREEN_PAIR_TYPES.keys.join(', ').to_s + ')'
|
|
50
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
51
|
-
|
|
52
|
-
next #skip if not a valid key since we are not going to check value
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
#Skip checking if nil, being nice
|
|
56
|
-
next if sub_screen_value == nil
|
|
57
|
-
|
|
58
|
-
#Check sub screen value
|
|
59
|
-
unless sub_screen_value.is_a?(KeyValueConstants::SCREEN_PAIR_TYPES[sub_screen_key])
|
|
60
|
-
if modal_name == false
|
|
61
|
-
error_message = "(screens) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
62
|
-
else
|
|
63
|
-
error_message = "(screens/#{screen_name}/modals) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
error_message << 'has an invalid value type, expected: ('
|
|
67
|
-
error_message << KeyValueConstants::SCREEN_PAIR_TYPES[sub_screen_key].to_s
|
|
68
|
-
error_message << "), got: (#{sub_screen_value.class.to_s})"
|
|
69
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
70
|
-
|
|
71
|
-
next #Skip any additional validation on this
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
#More complex validation
|
|
75
|
-
case sub_screen_key
|
|
76
|
-
when 'included_views'
|
|
77
|
-
sub_screen_value.each { |included_view|
|
|
78
|
-
unless self.view_exists?(included_view)
|
|
79
|
-
if modal_name == false
|
|
80
|
-
error_message = "(screens) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
81
|
-
else
|
|
82
|
-
error_message = "(screens/#{screen_name}/modals) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
error_message << "included_view (#{included_view}) does not exist. Available views ("
|
|
86
|
-
error_message << self.get_views.join(', ')
|
|
87
|
-
error_message << ')'
|
|
88
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
89
|
-
end
|
|
90
|
-
}
|
|
91
|
-
when 'automatic_screen_changes'
|
|
92
|
-
sub_screen_value.each { |automatic_screen_change|
|
|
93
|
-
unless self.screen_exists?(automatic_screen_change)
|
|
94
|
-
error_message = "(screens) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
95
|
-
error_message << "screen (#{automatic_screen_change}) does not exist. Available screens ("
|
|
96
|
-
error_message << self.get_screens.join(', ')
|
|
97
|
-
error_message << ')'
|
|
98
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
99
|
-
|
|
100
|
-
next
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
unless self.screen_has_live?(automatic_screen_change)
|
|
104
|
-
error_message = "(screens) level key (#{screen_name}) sub key (#{sub_screen_key}) "
|
|
105
|
-
error_message << "screen (#{automatic_screen_change}) does not have live? configuration. "
|
|
106
|
-
error_message << 'Automatic screen changes need to have associated live? configurations.'
|
|
107
|
-
error_messages.push(FormattedErrors::format_message(error_message))
|
|
108
|
-
|
|
109
|
-
next
|
|
110
|
-
end
|
|
111
|
-
}
|
|
112
|
-
end
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return error_messages
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module BluePrintValidation
|
|
3
|
-
module ScreenValidation
|
|
4
|
-
include ScreenModalCommonMethods
|
|
5
|
-
|
|
6
|
-
def validate_screens
|
|
7
|
-
error_messages = Array.new
|
|
8
|
-
return error_messages unless self.has_key?('screens')
|
|
9
|
-
return error_messages unless self['screens'].class == Hash
|
|
10
|
-
|
|
11
|
-
error_messages = Array.new
|
|
12
|
-
|
|
13
|
-
self['screens'].each { |screen_name, screen_configuration|
|
|
14
|
-
error_messages += self.validate_screen_modal(screen_name, screen_configuration)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return error_messages
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module BluePrintValidation
|
|
3
|
-
class ValidationObject < Hash
|
|
4
|
-
include CommonMethods
|
|
5
|
-
include BaseValidation
|
|
6
|
-
include ScreenValidation
|
|
7
|
-
include ModalValidation
|
|
8
|
-
include ElementValidation
|
|
9
|
-
include HookValidation
|
|
10
|
-
|
|
11
|
-
def initialize(blue_print_object)
|
|
12
|
-
#Figured on cloning the Hash Object, probably not needed
|
|
13
|
-
blue_print_object_cloned = blue_print_object.clone
|
|
14
|
-
|
|
15
|
-
blue_print_object_cloned.each { |key, value|
|
|
16
|
-
self[key] = value
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
error_messages = Array.new
|
|
20
|
-
error_messages += self.validate_base #BaseValidation Module
|
|
21
|
-
error_messages += self.validate_screens #ScreenValidation Module
|
|
22
|
-
error_messages += self.validate_modals
|
|
23
|
-
error_messages += self.validate_elements
|
|
24
|
-
error_messages += self.validate_hooks
|
|
25
|
-
|
|
26
|
-
if error_messages.length > 0
|
|
27
|
-
raise FormattedErrors::array_to_message(error_messages)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
module Driver
|
|
3
|
-
class Anonymous
|
|
4
|
-
def initialize(driver_object, object)
|
|
5
|
-
@driver_object = driver_object
|
|
6
|
-
@object = object
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def respond_to?(method_symbol, include_private = false)
|
|
10
|
-
@driver_object.mutex_object.synchronize do
|
|
11
|
-
return @object.respond_to?(method_symbol, include_private)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def method_missing(method_symbol, *arguments, &block)
|
|
16
|
-
start_time = Time.new.to_f
|
|
17
|
-
|
|
18
|
-
@driver_object.mutex_object.synchronize do
|
|
19
|
-
object_return = @object.send(method_symbol, *arguments, &block)
|
|
20
|
-
|
|
21
|
-
total_time_taken = (Time.new.to_f-start_time)
|
|
22
|
-
return object_return
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
module AutomationObject
|
|
2
|
-
class Element
|
|
3
|
-
include EventEmitter
|
|
4
|
-
include AutomationObject::ElementHelpers
|
|
5
|
-
|
|
6
|
-
WINDOW_CHECK_ON_METHOD = [:click, :drag_to_element]
|
|
7
|
-
SCROLL_TO_VIEW_ON_METHOD = [:click, :drag_to_element, :send_keys]
|
|
8
|
-
|
|
9
|
-
attr_accessor :framework_object, :driver_object,
|
|
10
|
-
:framework_location,
|
|
11
|
-
:screen_object, :element_object,
|
|
12
|
-
:screen_name, :element_name,
|
|
13
|
-
:element_methods_object
|
|
14
|
-
|
|
15
|
-
attr_accessor :configuration
|
|
16
|
-
|
|
17
|
-
def initialize(params)
|
|
18
|
-
#Set params to properties
|
|
19
|
-
self.framework_object = params[:framework_object] || raise(ArgumentError, 'framework_object is required in params')
|
|
20
|
-
|
|
21
|
-
self.screen_object = params[:screen_object] || raise(ArgumentError, 'screen_object is required in params')
|
|
22
|
-
self.driver_object = params[:driver_object] || raise(ArgumentError, 'driver_object is required in params')
|
|
23
|
-
#Clone configuration, this will allow edit/deletes on different levels
|
|
24
|
-
self.configuration = params[:blue_prints].clone || raise(ArgumentError, 'configuration is required in params')
|
|
25
|
-
|
|
26
|
-
self.screen_name = params[:screen_name] || raise(ArgumentError, 'screen_name is required in params')
|
|
27
|
-
self.element_name = params[:element_name] || raise(ArgumentError, 'elements_name is required in params')
|
|
28
|
-
|
|
29
|
-
#Set element object if requested
|
|
30
|
-
self.element_object = params[:element_object] if params[:element_object]
|
|
31
|
-
|
|
32
|
-
#Validate properties
|
|
33
|
-
raise ArgumentError, 'framework_object should be an Automation Object' unless self.framework_object.is_a? Framework
|
|
34
|
-
raise ArgumentError, 'screen_object should be an Screen Object' unless self.screen_object.is_a? Screen
|
|
35
|
-
raise ArgumentError, 'configuration should be a Hash Object' unless self.configuration.is_a? Hash
|
|
36
|
-
raise ArgumentError, 'screen_name should be a String Object' unless self.screen_name.is_a? String
|
|
37
|
-
raise ArgumentError, 'elements_name should be a String Object' unless self.element_name.is_a? String
|
|
38
|
-
|
|
39
|
-
#This can stay alive, will reset object internally when issued to this class
|
|
40
|
-
#ElementMethod Object will have the available methods for elements, while
|
|
41
|
-
#allowing for thread locking on this level
|
|
42
|
-
#Pass self into it, so it can hit above levels without much issue
|
|
43
|
-
self.element_methods_object = ElementMethods.new(self)
|
|
44
|
-
|
|
45
|
-
self.framework_location = self.screen_object.framework_location + ".#{self.element_name}"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def respond_to?(method_symbol, include_private = false)
|
|
49
|
-
#If this Element class has the method then return true
|
|
50
|
-
return true if super
|
|
51
|
-
|
|
52
|
-
#Check ElementMethods respond_to?, need to wrap in driver mutex object
|
|
53
|
-
return self.element_methods_object.respond_to?(method_symbol, include_private)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
#Avoid deadlocking on resets
|
|
57
|
-
def reset_element
|
|
58
|
-
self.element_methods_object.reset_element
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def check_new_window?(method_symbol)
|
|
62
|
-
return false unless self.framework_object.is_browser?
|
|
63
|
-
WINDOW_CHECK_ON_METHOD.include?(method_symbol)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def scroll_to_view?(method_symbol)
|
|
67
|
-
return false unless self.framework_object.is_browser?
|
|
68
|
-
SCROLL_TO_VIEW_ON_METHOD.include?(method_symbol)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def method_missing(method_symbol, *arguments, &block)
|
|
72
|
-
method_string = method_symbol.to_s
|
|
73
|
-
created_window_handle = false
|
|
74
|
-
em_object_return = nil
|
|
75
|
-
|
|
76
|
-
AutomationObject::Logger::add("Calling method #{method_symbol} on element", [self.framework_location])
|
|
77
|
-
|
|
78
|
-
#Run any before hooks
|
|
79
|
-
self.hook(method_string, 'before')
|
|
80
|
-
|
|
81
|
-
#Deal with iFrames
|
|
82
|
-
if self.framework_object.is_browser?
|
|
83
|
-
if self.in_iframe?
|
|
84
|
-
self.screen_object.switch_to_iframe(self.element_name)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
#Check for difference in window handles if needed
|
|
89
|
-
if self.check_new_window?(method_symbol)
|
|
90
|
-
before_window_handles = self.framework_object.get_window_handles
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
begin
|
|
95
|
-
#Use automation object level mutex object which will lock any element operations will complete
|
|
96
|
-
begin
|
|
97
|
-
AutomationObject::Logger::add("Executing method #{method_symbol} on element", [self.framework_location])
|
|
98
|
-
em_object_return = self.element_methods_object.send(method_symbol, *arguments, &block)
|
|
99
|
-
rescue Selenium::WebDriver::Error::ElementNotVisibleError, Selenium::WebDriver::Error::UnknownError => e
|
|
100
|
-
raise e
|
|
101
|
-
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
|
102
|
-
sleep(2)
|
|
103
|
-
AutomationObject::Logger::add("Stale element error, retrying method #{method_symbol} on element", [self.framework_location])
|
|
104
|
-
em_object_return = self.element_methods_object.send(method_symbol, *arguments, &block)
|
|
105
|
-
rescue Selenium::WebDriver::Error::InvalidElementStateError
|
|
106
|
-
sleep(2)
|
|
107
|
-
AutomationObject::Logger::add("Invalid element state error, retrying method #{method_symbol} on element", [self.framework_location])
|
|
108
|
-
self.element_methods_object.find_element
|
|
109
|
-
em_object_return = self.element_methods_object.send(method_symbol, *arguments, &block)
|
|
110
|
-
end
|
|
111
|
-
rescue
|
|
112
|
-
raise $!, "#{self.framework_location} #{$!}", $!.backtrace
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
if self.check_new_window?(method_symbol)
|
|
116
|
-
after_window_handles = self.framework_object.get_window_handles
|
|
117
|
-
window_handle_difference = after_window_handles - before_window_handles
|
|
118
|
-
if window_handle_difference.length > 1
|
|
119
|
-
raise "Click on element (#{self.element_name}) in screen (#{self.screen_name}) has opened more than one window."
|
|
120
|
-
end
|
|
121
|
-
created_window_handle = window_handle_difference.shift
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
self.hook(method_string, 'after', created_window_handle)
|
|
125
|
-
return em_object_return
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def hook(action, timing, created_window_handle = false)
|
|
129
|
-
self.before_mutex_lock if action == 'before'
|
|
130
|
-
|
|
131
|
-
#Return out if it doesn't meet the given requirements
|
|
132
|
-
return unless self.configuration.class == Hash
|
|
133
|
-
return unless self.configuration[action].class == Hash
|
|
134
|
-
return unless self.configuration[action][timing].class == Hash
|
|
135
|
-
|
|
136
|
-
hook_configuration = self.configuration[action][timing].clone
|
|
137
|
-
self.emit :hook, {
|
|
138
|
-
:configuration => hook_configuration,
|
|
139
|
-
:created_window_handle => created_window_handle
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
self.after_mutex_lock if action == 'after'
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
end
|