automation_object 0.8.3 → 0.8.4
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/driver/appium_adapter/driver.rb +11 -5
- data/lib/automation_object/step_definitions/element.rb +6 -6
- data/lib/automation_object/step_definitions/element_array.rb +1 -1
- data/lib/automation_object/step_definitions/element_hash.rb +8 -8
- data/lib/automation_object/step_definitions/modal.rb +4 -4
- data/lib/automation_object/step_definitions/screen.rb +12 -12
- data/lib/automation_object/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aa261db30eff742f7b64bfc49ad6705c7252a63
|
4
|
+
data.tar.gz: 6cc9d4758ff4c9860a88e8b06e7485f7a97c78af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3ef8890e86847eb1f95ecda5b30814a8eb1f5852a727cfe0b50b9549d2c890c0bc051919ed4d91e04672737761a18dd3697031dad45bd1b12f433c42a24abd5
|
7
|
+
data.tar.gz: c758af0cbd9f4c70581d854c0374b99de7e3d5f284d8455c3653463b0512f533c18ebf3cf03ac0341fc7cb9b4e71f08bfa6df93c50afbc25ec609ec575574b37
|
@@ -84,21 +84,27 @@ module AutomationObject
|
|
84
84
|
@subject.alert_dismiss
|
85
85
|
end
|
86
86
|
|
87
|
+
# @return [Boolean]
|
88
|
+
attr_accessor :browser
|
89
|
+
|
90
|
+
undef :browser if defined? :browser
|
91
|
+
# @return [Boolean]
|
92
|
+
def browser
|
93
|
+
@browser ||= false
|
94
|
+
end
|
95
|
+
|
87
96
|
# @return [Boolean] whether or not browser is being used
|
88
97
|
def browser?
|
89
|
-
return @browser if defined? @browser
|
90
|
-
@browser = false
|
91
|
-
|
92
98
|
# Now we need to check Appium's contexts to see if WEBVIEW is in available_contexts
|
93
99
|
available_contexts = @subject.available_contexts
|
94
100
|
available_contexts.each do |context|
|
95
101
|
if context =~ /^WEBVIEW_\d+$/
|
96
|
-
|
102
|
+
self.browser = true
|
97
103
|
break
|
98
104
|
end
|
99
105
|
end
|
100
106
|
|
101
|
-
|
107
|
+
browser
|
102
108
|
end
|
103
109
|
|
104
110
|
# Window Handles Override
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative 'support/parse'
|
3
3
|
|
4
|
-
# Description:
|
4
|
+
# Description: Use the following step definitions to interact with or test elements
|
5
5
|
|
6
6
|
# Call an element method
|
7
7
|
# Examples:
|
@@ -14,7 +14,7 @@ When(%r(^I (\w+|%\{\w+\}) ?(?: on| over)? (?:the )?"(\w+|%\{\w+\})"\s*"?(\w+|%\{
|
|
14
14
|
AutomationObject::Framework.get.screen(screen).modal(modal).element(element).send(method)
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# Type into element field
|
18
18
|
# Examples:
|
19
19
|
# - I type "blah" into the "home_screen" "text_field" element
|
20
20
|
# - I type "test" in the "home_screen" "text_field" element
|
@@ -25,7 +25,7 @@ When(%r(^I type "([^"]+|%\{\w+\})" in(?:to)? (?:the )?"(\w+|%\{\w+\})"\s*"?(\w+|
|
|
25
25
|
AutomationObject::Framework.get.screen(screen).modal(modal).element(element).send_keys(text)
|
26
26
|
end
|
27
27
|
|
28
|
-
#
|
28
|
+
# Scroll element into focus
|
29
29
|
# Examples:
|
30
30
|
# - I scroll to the "home_screen" "logo_button" element
|
31
31
|
# - I focus to the "home_screen" "logo_button" element
|
@@ -36,7 +36,7 @@ When(%r(^I (?:scroll |focus )to (?:the )?"(\w+|%\{\w+\})"\s*"?(\w+|%\{\w+\})?"?\
|
|
36
36
|
AutomationObject::Framework.get.screen(screen).modal(modal).element(element).scroll_into_view
|
37
37
|
end
|
38
38
|
|
39
|
-
#
|
39
|
+
# Save value from element for use later
|
40
40
|
# Examples:
|
41
41
|
# - I save "text" as "unique_value" from the "home_screen" "logo_button" element
|
42
42
|
# - I save "id" as "unique_value" from "home_screen" "logo_button" element
|
@@ -48,7 +48,7 @@ When(%r(^I save "(\w+|%\{\w+\})" as "(\w+)" from (?:the )?"(\w+|%\{\w+\})"\s*"?(
|
|
48
48
|
AutomationObject::StepDefinitions::Cache.set(key, value)
|
49
49
|
end
|
50
50
|
|
51
|
-
#
|
51
|
+
# Test if the element exists or not
|
52
52
|
# Examples:
|
53
53
|
# - the "home_screen" "title" element should exist
|
54
54
|
# - the "home_screen" "title" element shouldn't exist
|
@@ -65,7 +65,7 @@ Then(%r(^(?:the )?"(\w+|%\{\w+\})"\s*"?(\w+|%\{\w+\})?"?\s*"(\w+|%\{\w+\})" elem
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
#
|
68
|
+
# Test if the element method value equals a given value
|
69
69
|
# Examples:
|
70
70
|
# - the "home_screen" "title" element "text" should equal "Home"
|
71
71
|
# - "home_screen" "title" element "text" should not equal "About"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require_relative 'support/parse'
|
3
3
|
require_relative 'support/element_array'
|
4
4
|
|
5
|
-
# Description:
|
5
|
+
# Description: Use the following step definitions to interact with or test element arrays
|
6
6
|
|
7
7
|
# For: Call an element array method
|
8
8
|
# Examples:
|
@@ -2,9 +2,9 @@
|
|
2
2
|
require_relative 'support/parse'
|
3
3
|
require_relative 'support/element_hash'
|
4
4
|
|
5
|
-
# Description:
|
5
|
+
# Description: Use the following step definitions to interact with or test element hashes
|
6
6
|
|
7
|
-
#
|
7
|
+
# Call an element hash method
|
8
8
|
# Examples:
|
9
9
|
# - I click on the first "home_screen" "about_button" element hash
|
10
10
|
# - I click on the first "home_screen" "menu_modal" "about_button" element hash
|
@@ -18,7 +18,7 @@ When(%r(^I (\w+|%\{\w+\})?(?: on| over)?(?: the| a)? (%\{\w+\}|all|random|last|f
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
#
|
21
|
+
# Type into element hash field
|
22
22
|
# Examples:
|
23
23
|
# - I type "blah" into the first "home_screen" "text_field" element hash
|
24
24
|
# - I type "blah" into the first "home_screen" "menu_modal" "text_field" element hash
|
@@ -32,7 +32,7 @@ When(%r(^I type "([\w\s]+|%\{\w+\})" in(?:to| to)? (?:the )?(%\{\w+\}|random|las
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
#
|
35
|
+
# Scroll element hash item(s) into focus
|
36
36
|
# Examples:
|
37
37
|
# - I scroll to the first "home_screen" "logo_button" element hash
|
38
38
|
# - I scroll to the first "home_screen" "menu_modal" "logo_button" element hash
|
@@ -44,7 +44,7 @@ When(%r(^I (?:scroll |focus )(?:to |through )(?:the )?(%\{\w+\}|all|random|last|
|
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
47
|
-
#
|
47
|
+
# Save value from element hash for use later
|
48
48
|
# Examples:
|
49
49
|
# - I save "text" as "unique_value" from the first "home_screen" "logo_button" element hash
|
50
50
|
# - I save "text" as "unique_value" from the first "home_screen" "menu_modal" "logo_button" element hash
|
@@ -59,7 +59,7 @@ When(%r(^I save "(\w+|%\{\w+\})" as "(\w+)" from (?:the )?(%\{\w+\}|random|last|
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
#
|
62
|
+
# Test the element hashes size
|
63
63
|
# Examples:
|
64
64
|
# - the "home_screen" "title" element hash should be greater than 0
|
65
65
|
# - the "home_screen" "menu_modal" "title" element hash should be greater than 0
|
@@ -90,7 +90,7 @@ Then(%r(^(?:the )?"(\w+|%\{\w+\})"\s*"?(\w+|%\{\w+\})?"?\s*"(\w+|%\{\w+\})" elem
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
#
|
93
|
+
# Test if the element hash value equals a given value
|
94
94
|
# Examples:
|
95
95
|
# - the first "home_screen" "title" element hash "text" should equal "Home"
|
96
96
|
# - the first "home_screen" "menu_modal" "title" element hash "text" should equal "Home"
|
@@ -110,7 +110,7 @@ Then(%r(^(?:the )?(%\{\w+\}|random|last|first|(\d+)\.\.(\d+)) "(\w+|%\{\w+\})"\s
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
#
|
113
|
+
# Test if the element hash is unique
|
114
114
|
# Examples:
|
115
115
|
# - the "home_screen" "title" element hash "text" should be unique
|
116
116
|
# - the "home_screen" "menu_modal" "title" element hash "text" should be unique
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative 'support/parse'
|
3
3
|
|
4
|
-
# Description:
|
4
|
+
# Description: Use the following step definitions to interact with or test modals
|
5
5
|
|
6
|
-
#
|
6
|
+
# Automatically navigate to the modal
|
7
7
|
# Examples:
|
8
8
|
# - I go to the "home_screen" "test_modal" modal
|
9
9
|
# - I go to "login_screen" "test_modal" modal
|
10
|
-
|
10
|
+
When(%r(^I go to (?:the |)"([\w\s]+|%\{\w+\})" "([\w\s]+|%\{\w+\})" modal$)) do |*args|
|
11
11
|
screen, modal = AutomationObject::StepDefinitions::Parse.new(args).get
|
12
12
|
|
13
13
|
success = AutomationObject::Framework.get.screen(screen).modal(modal).go
|
14
14
|
expect(success).to eq(true)
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# Test if modal is currently active
|
18
18
|
# Examples:
|
19
19
|
# - the "home_screen" "test_modal" modal should be active
|
20
20
|
# - the "login_screen" "test_modal" modal shouldn't be active
|
@@ -1,25 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative 'support/parse'
|
3
3
|
|
4
|
-
# Description:
|
4
|
+
# Description: Use the following step definitions to interact with or test screens
|
5
5
|
|
6
|
-
#
|
6
|
+
# Automatically navigate to the screen
|
7
7
|
# Examples:
|
8
8
|
# - I go to the "home_screen" screen
|
9
9
|
# - I go to "login_screen" screen
|
10
|
-
|
10
|
+
When(%r(^I go to (?:the |)"([\w\s]+|%\{\w+\})" screen)) do |*args|
|
11
11
|
screen = AutomationObject::StepDefinitions::Parse.new(args).get
|
12
12
|
|
13
13
|
success = AutomationObject::Framework.get.screen(screen).go
|
14
14
|
expect(success).to eq(true)
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# Close the current screen or given screen
|
18
18
|
# Examples:
|
19
19
|
# - I close the "contact" screen
|
20
20
|
# - I close the screen
|
21
21
|
# - I destroy the screen
|
22
|
-
|
22
|
+
When(%r(^I (?:close|destroy) the ("([\w\s]+|%\{\w+\})")? ?screen$)) do |*args|
|
23
23
|
_unparsed_name, name = AutomationObject::StepDefinitions::Parse.new(args).get
|
24
24
|
|
25
25
|
if name
|
@@ -29,11 +29,11 @@ Then(%r(^I (?:close|destroy) the ("([\w\s]+|%\{\w+\})")? ?screen$)) do |*args|
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
#
|
32
|
+
# Navigate back on a given or current screen
|
33
33
|
# Examples:
|
34
34
|
# - I navigate back on the screen
|
35
35
|
# - I navigate back on the "contact" screen
|
36
|
-
|
36
|
+
When(%r(^I (?:navigate|go) back (?:on )?(?:the )?("([\w\s]+|%\{\w+\})")? ?screen$)) do
|
37
37
|
_unparsed_name, name = AutomationObject::StepDefinitions::Parse.new(args).get
|
38
38
|
|
39
39
|
if name
|
@@ -43,22 +43,22 @@ Then(%r(^I (?:navigate|go) back (?:on )?(?:the )?("([\w\s]+|%\{\w+\})")? ?screen
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
46
|
+
# Switch/Focus screen
|
47
47
|
# Examples:
|
48
48
|
# - I switch to the "home" screen
|
49
49
|
# - I focus the "contact" screen
|
50
|
-
|
50
|
+
When(%r(^I (?:switch|focus) (?:to )?(?:the )?"([\w\s]+|%\{\w+\})" screen$)) do |*args|
|
51
51
|
screen = AutomationObject::StepDefinitions::Parse.new(args).get
|
52
52
|
AutomationObject::Framework.get.focus(screen)
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# Setting the current screen's width or given screen
|
56
56
|
# Examples:
|
57
57
|
# - I set the screen size to 1000x2000
|
58
58
|
# - I set the "home" screen size to 1000x2000
|
59
59
|
# - I set the screen width to 1000
|
60
60
|
# - I set the screen height to 2000
|
61
|
-
|
61
|
+
When(%r(^I set the ("([\w\s]+|%\{\w+\})")? ?screen (size|width|height) to (\d+|(\d+)x(\d+))$)) do |*args|
|
62
62
|
_unparsed_screen, screen, dimension, size, width, height = AutomationObject::StepDefinitions::Parse.new(args).get
|
63
63
|
|
64
64
|
screen = if screen
|
@@ -72,7 +72,7 @@ Then(%r(^I set the ("([\w\s]+|%\{\w+\})")? ?screen (size|width|height) to (\d+|(
|
|
72
72
|
screen.height(size) if dimension == 'height' && size
|
73
73
|
end
|
74
74
|
|
75
|
-
#
|
75
|
+
# Test if screen is currently active
|
76
76
|
# Examples:
|
77
77
|
# - the "home" screen should be active
|
78
78
|
# - the "login" screen shouldn't be active
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automation_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Blatter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|