itms_automation 2.6.6 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/installation.md +1 -1
- data/features-skeleton/my_first.feature +19 -10
- data/features-skeleton/step_definitions/input_steps.rb +3 -3
- data/features-skeleton/step_definitions/my_first_steps.rb +14 -0
- data/features-skeleton/step_definitions/repositories/project_object.yml +1 -1
- data/features-skeleton/support/env.rb +17 -88
- data/lib/itms_automation/input_steps.rb +1 -1
- data/lib/itms_automation/methods/assertion_methods.rb +26 -77
- data/lib/itms_automation/methods/click_elements_methods.rb +13 -6
- data/lib/itms_automation/methods/condition_methods.rb +13 -0
- data/lib/itms_automation/methods/configuration_methods.rb +8 -4
- data/lib/itms_automation/methods/input_methods.rb +17 -14
- data/lib/itms_automation/methods/javascript_handling_methods.rb +1 -1
- data/lib/itms_automation/methods/misc_methods.rb +2 -2
- data/lib/itms_automation/methods/navigate_methods.rb +52 -45
- data/lib/itms_automation/methods/progress_methods.rb +1 -1
- data/lib/itms_automation/version.rb +1 -1
- metadata +39 -40
- data/example/android/android_app/android_app_calculator.zip +0 -0
- data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
- data/example/android/android_app/android_app_calculator/features/calculator.feature +0 -36
- data/example/android/android_app/android_app_calculator/features/my_first.feature +0 -13
- data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
- data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +0 -5
- data/example/android/android_app/android_app_calculator/features/support/env.rb +0 -52
- data/example/android/android_app/android_app_calculator/features/support/hooks.rb +0 -26
- data/example/android/android_web/android_web_gmail_login.zip +0 -0
- data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +0 -12
- data/example/android/android_web/android_web_gmail_login/features/my_first.feature +0 -1
- data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
- data/example/android/android_web/android_web_gmail_login/features/support/env.rb +0 -51
- data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +0 -27
- data/example/desktop web/desktop_web_gmail_login.zip +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +0 -9
- data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +0 -21
- data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +0 -1
- data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
- data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +0 -106
- data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +0 -38
@@ -1,15 +1,21 @@
|
|
1
1
|
require_relative 'required_files'
|
2
2
|
|
3
3
|
# method to enter text into textfield
|
4
|
-
def
|
4
|
+
def type(element, text)
|
5
5
|
foundElement = find_object(element)
|
6
|
-
|
6
|
+
foundElement.send_keys(text)
|
7
7
|
end
|
8
8
|
|
9
|
-
# method to
|
10
|
-
def
|
9
|
+
# method to send keys
|
10
|
+
def send_keys(element, key)
|
11
|
+
keys_support = ["KEY_LEFT", "KEY_UP", "KEY_RIGHT", "KEY_DOWN", "KEY_PAGE_UP", "KEY_PAGE_DOWN", "KEY_BACKSPACE", "KEY_DELETE", "KEY_ENTER", "KEY_TAB"]
|
11
12
|
foundElement = find_object(element)
|
12
|
-
|
13
|
+
if key
|
14
|
+
get_key = key.strip[/^\$\{(.*?)\}$/, 1]
|
15
|
+
raise TestCaseFailed, "${get_key} key is not supported. Supported keys: KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, KEY_PAGE_UP, KEY_PAGE_DOWN, KEY_BACKSPACE, KEY_DELETE, KEY_ENTER, KEY_TAB" unless keys_support.include?(get_key)
|
16
|
+
key_convert = get_key[/^KEY_(.*?)$/, 1].downcase.to_sym
|
17
|
+
foundElement.send_keys(key_convert)
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
# method to select option from dropdwon list
|
@@ -34,21 +40,18 @@ def unselect_all_option_from_multiselect_dropdown(element)
|
|
34
40
|
end
|
35
41
|
|
36
42
|
# method to check checkbox
|
37
|
-
def
|
38
|
-
checkbox =
|
43
|
+
def check(element)
|
44
|
+
checkbox = find_object(element)
|
39
45
|
checkbox.click unless checkbox.selected?
|
40
46
|
end
|
41
47
|
|
42
48
|
# method to uncheck checkbox
|
43
|
-
def
|
44
|
-
checkbox =
|
45
|
-
|
46
|
-
if checkbox.selected?
|
47
|
-
checkbox.click
|
48
|
-
end
|
49
|
+
def uncheck(element)
|
50
|
+
checkbox = find_object(element)
|
51
|
+
checkbox.click if checkbox.selected?
|
49
52
|
end
|
50
53
|
|
51
|
-
# method to
|
54
|
+
# method to toggle checkbox checked
|
52
55
|
def toggle_checkbox(element)
|
53
56
|
WAIT.until { find_object(element) }.click
|
54
57
|
end
|
@@ -9,7 +9,7 @@ WAIT = Selenium::WebDriver::Wait.new(:timeout => 30)
|
|
9
9
|
|
10
10
|
# method to validate locator
|
11
11
|
def valid_locator_type? type
|
12
|
-
%w(id class css name xpath).include? type
|
12
|
+
%w(id class css name xpath class_name link link_text partial_link_text).include? type
|
13
13
|
end
|
14
14
|
|
15
15
|
def validate_locator type
|
@@ -59,6 +59,6 @@ def loadYAMLfile(filename)
|
|
59
59
|
begin
|
60
60
|
return YAML.load_file(filename)
|
61
61
|
rescue Psych::SyntaxError => ex
|
62
|
-
raise "
|
62
|
+
raise "Syntax error when reading file: #{ex}"
|
63
63
|
end
|
64
64
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
require_relative 'required_files'
|
2
2
|
|
3
3
|
# method to open link
|
4
|
-
def
|
4
|
+
def open(link)
|
5
5
|
$driver.get link
|
6
6
|
end
|
7
7
|
|
8
8
|
# method to navigate back & forward
|
9
9
|
def navigate(direction)
|
10
10
|
if direction == 'back'
|
11
|
-
|
11
|
+
$driver.navigate.back
|
12
12
|
else
|
13
13
|
$driver.navigate.forward
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def close
|
18
|
+
$drive.close
|
19
|
+
end
|
20
|
+
|
17
21
|
# method to quite webdriver instance
|
18
|
-
def
|
22
|
+
def quit
|
19
23
|
$driver.quit
|
20
24
|
end
|
21
25
|
|
@@ -39,7 +43,7 @@ end
|
|
39
43
|
# Method to zoom in/out web page until web element dislays
|
40
44
|
def zoom_in_out_till_element_display(element, in_out)
|
41
45
|
while true
|
42
|
-
if
|
46
|
+
if find_object(element).displayed?
|
43
47
|
break
|
44
48
|
else
|
45
49
|
$driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
|
@@ -48,8 +52,10 @@ def zoom_in_out_till_element_display(element, in_out)
|
|
48
52
|
end
|
49
53
|
|
50
54
|
# Method to resize browser
|
51
|
-
def
|
52
|
-
|
55
|
+
def set_window_size(resolution)
|
56
|
+
raise TestCaseFailed, 'Wrong format of resolution. (e.g., 1280x800)' unless resolution.match(/^\d+x\d+$/)
|
57
|
+
width, height = resolution.split("x")
|
58
|
+
$driver.manage.resize_to(width, heigth)
|
53
59
|
end
|
54
60
|
|
55
61
|
# Method to maximize browser
|
@@ -63,14 +69,50 @@ def refresh_page
|
|
63
69
|
end
|
64
70
|
|
65
71
|
# Method to hover on element
|
66
|
-
def
|
67
|
-
element =
|
68
|
-
$driver.action.
|
72
|
+
def mouse_over(element)
|
73
|
+
element = find_object(element)
|
74
|
+
$driver.action.move_to_element(element).perform
|
75
|
+
end
|
76
|
+
|
77
|
+
# mouse_down
|
78
|
+
def mouse_down(element)
|
79
|
+
element = find_object(element)
|
80
|
+
$driver.action.move_to_element(element).click_and_hold.perform
|
81
|
+
end
|
82
|
+
|
83
|
+
# mouse_down_at
|
84
|
+
def mouse_down_at(element, location)
|
85
|
+
element = find_object(element)
|
86
|
+
$driver.action.move_to_element(element).click_and_hold.perform
|
87
|
+
end
|
88
|
+
|
89
|
+
# mouse_out
|
90
|
+
def mouse_out
|
91
|
+
element = $driver.find_element(By.CSS_SELECTOR, 'body')
|
92
|
+
$driver.action.move_to_element(element, 0, 0).perform
|
93
|
+
end
|
94
|
+
|
95
|
+
#mouse_up
|
96
|
+
def mouse_up(element)
|
97
|
+
element = find_object(element)
|
98
|
+
$driver.action.move_to_element(element).release.perform
|
99
|
+
end
|
100
|
+
|
101
|
+
#mouse_up_at
|
102
|
+
def mouse_up_at
|
103
|
+
element = find_object(element)
|
104
|
+
$driver.action.move_to_element(element).release.perform
|
105
|
+
end
|
106
|
+
|
107
|
+
#mouse_move_at
|
108
|
+
def mouse_move_at
|
109
|
+
element = find_object(element)
|
110
|
+
$driver.action.move_to_element(element).perform
|
69
111
|
end
|
70
112
|
|
71
113
|
# Method to scroll page to perticular element
|
72
114
|
def scroll_to_element(element)
|
73
|
-
ele_scroll =
|
115
|
+
ele_scroll = find_object(element)
|
74
116
|
ele_scroll.location_once_scrolled_into_view
|
75
117
|
end
|
76
118
|
|
@@ -84,38 +126,3 @@ def scroll_page(to)
|
|
84
126
|
raise "Exception : Invalid Direction (only scroll \"top\" or \"end\")"
|
85
127
|
end
|
86
128
|
end
|
87
|
-
|
88
|
-
$old_win = nil
|
89
|
-
|
90
|
-
# Method to switch to new window
|
91
|
-
def switch_to_new_window
|
92
|
-
$old_win = $driver.window_handle
|
93
|
-
$driver.switch_to.window($driver.window_handles[1])
|
94
|
-
end
|
95
|
-
|
96
|
-
# Method to switch to old window
|
97
|
-
def switch_to_old_window
|
98
|
-
$driver.switch_to.window($old_win)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Method to close new window
|
102
|
-
def close_new_window
|
103
|
-
$driver.close
|
104
|
-
end
|
105
|
-
|
106
|
-
=begin
|
107
|
-
def switch_to_new_window
|
108
|
-
win_handles = $driver.window_handles
|
109
|
-
|
110
|
-
puts $driver.title
|
111
|
-
puts win_handles.length
|
112
|
-
|
113
|
-
$driver.switch_to.window($driver.window_handles[1])
|
114
|
-
puts $driver.window_handles[1]
|
115
|
-
puts $driver.title
|
116
|
-
|
117
|
-
$driver.switch_to.window($driver.window_handles[2])
|
118
|
-
puts $driver.window_handles[2]
|
119
|
-
puts $driver.title
|
120
|
-
end
|
121
|
-
=end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itms_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- INFOdation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -16,40 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.2.0
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 5.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.2.0
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 5.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: webdrivers
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '3.14'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: 4.4.1
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 4.4.1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '3.14'
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
49
|
+
version: 4.4.1
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 4.4.1
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: appium_lib_core
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +110,26 @@ dependencies:
|
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '1.8'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.5'
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '3.5'
|
123
|
+
type: :runtime
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '3.5'
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '3.5'
|
113
133
|
description: Behavior driven development (BDD) approach to write automation test script
|
114
134
|
to test Web and Android applications.
|
115
135
|
email: anh.pham@infodation.vn
|
@@ -124,29 +144,6 @@ files:
|
|
124
144
|
- doc/installation.md
|
125
145
|
- doc/itms-automation-API.md
|
126
146
|
- doc/itms-automation-help.md
|
127
|
-
- example/android/android_app/android_app_calculator.zip
|
128
|
-
- example/android/android_app/android_app_calculator/AndroidCalculator.apk
|
129
|
-
- example/android/android_app/android_app_calculator/features/calculator.feature
|
130
|
-
- example/android/android_app/android_app_calculator/features/my_first.feature
|
131
|
-
- example/android/android_app/android_app_calculator/features/screenshots/test.png
|
132
|
-
- example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb
|
133
|
-
- example/android/android_app/android_app_calculator/features/support/env.rb
|
134
|
-
- example/android/android_app/android_app_calculator/features/support/hooks.rb
|
135
|
-
- example/android/android_web/android_web_gmail_login.zip
|
136
|
-
- example/android/android_web/android_web_gmail_login/features/gmail_login.feature
|
137
|
-
- example/android/android_web/android_web_gmail_login/features/my_first.feature
|
138
|
-
- example/android/android_web/android_web_gmail_login/features/screenshots/test.png
|
139
|
-
- example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb
|
140
|
-
- example/android/android_web/android_web_gmail_login/features/support/env.rb
|
141
|
-
- example/android/android_web/android_web_gmail_login/features/support/hooks.rb
|
142
|
-
- example/desktop web/desktop_web_gmail_login.zip
|
143
|
-
- example/desktop web/desktop_web_gmail_login/features/gmail_login.feature
|
144
|
-
- example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature
|
145
|
-
- example/desktop web/desktop_web_gmail_login/features/my_first.feature
|
146
|
-
- example/desktop web/desktop_web_gmail_login/features/screenshots/test.png
|
147
|
-
- example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb
|
148
|
-
- example/desktop web/desktop_web_gmail_login/features/support/env.rb
|
149
|
-
- example/desktop web/desktop_web_gmail_login/features/support/hooks.rb
|
150
147
|
- features-skeleton/Gemfile
|
151
148
|
- features-skeleton/Gemfile.lock
|
152
149
|
- features-skeleton/README.md
|
@@ -158,6 +155,7 @@ files:
|
|
158
155
|
- features-skeleton/step_definitions/configuration_steps.rb
|
159
156
|
- features-skeleton/step_definitions/input_steps.rb
|
160
157
|
- features-skeleton/step_definitions/javascript_handling_steps.rb
|
158
|
+
- features-skeleton/step_definitions/my_first_steps.rb
|
161
159
|
- features-skeleton/step_definitions/navigation_steps.rb
|
162
160
|
- features-skeleton/step_definitions/progress_steps.rb
|
163
161
|
- features-skeleton/step_definitions/repositories/project_object.yml
|
@@ -171,6 +169,7 @@ files:
|
|
171
169
|
- lib/itms_automation/javascript_handling_steps.rb
|
172
170
|
- lib/itms_automation/methods/assertion_methods.rb
|
173
171
|
- lib/itms_automation/methods/click_elements_methods.rb
|
172
|
+
- lib/itms_automation/methods/condition_methods.rb
|
174
173
|
- lib/itms_automation/methods/configuration_methods.rb
|
175
174
|
- lib/itms_automation/methods/error_handling_methods.rb
|
176
175
|
- lib/itms_automation/methods/input_methods.rb
|
@@ -196,14 +195,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
195
|
requirements:
|
197
196
|
- - ">="
|
198
197
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
198
|
+
version: 2.0.0
|
200
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
200
|
requirements:
|
202
201
|
- - ">="
|
203
202
|
- !ruby/object:Gem::Version
|
204
203
|
version: '0'
|
205
204
|
requirements: []
|
206
|
-
rubygems_version: 3.0.
|
205
|
+
rubygems_version: 3.0.3
|
207
206
|
signing_key:
|
208
207
|
specification_version: 4
|
209
208
|
summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
|
Binary file
|
Binary file
|
@@ -1,36 +0,0 @@
|
|
1
|
-
Feature: Verify Calculator functionalities
|
2
|
-
|
3
|
-
Scenario: Click on OK button
|
4
|
-
Then I click on element having id "com.android2.calculator3:id/cling_dismiss"
|
5
|
-
|
6
|
-
Scenario: Addirion
|
7
|
-
Then I click on element having id "com.android2.calculator3:id/digit5"
|
8
|
-
Then I click on element having id "com.android2.calculator3:id/plus"
|
9
|
-
Then I click on element having id "com.android2.calculator3:id/digit9"
|
10
|
-
When I click on element having id "com.android2.calculator3:id/equal"
|
11
|
-
Then element having xpath "//android.widget.EditText[@index=0]" should have text as "14"
|
12
|
-
|
13
|
-
|
14
|
-
Scenario: Substraction
|
15
|
-
Then I click on element having id "com.android2.calculator3:id/digit9"
|
16
|
-
Then I click on element having id "com.android2.calculator3:id/minus"
|
17
|
-
Then I click on element having id "com.android2.calculator3:id/digit5"
|
18
|
-
When I click on element having id "com.android2.calculator3:id/equal"
|
19
|
-
Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
|
20
|
-
|
21
|
-
Scenario: Multiplication
|
22
|
-
Then I click on element having id "com.android2.calculator3:id/digit9"
|
23
|
-
Then I click on element having id "com.android2.calculator3:id/mul"
|
24
|
-
Then I click on element having id "com.android2.calculator3:id/digit5"
|
25
|
-
When I click on element having id "com.android2.calculator3:id/equal"
|
26
|
-
Then element having xpath "//android.widget.EditText[@index=0]" should have text as "45"
|
27
|
-
|
28
|
-
Scenario: Division
|
29
|
-
Then I click on element having id "com.android2.calculator3:id/digit8"
|
30
|
-
Then I click on element having id "com.android2.calculator3:id/div"
|
31
|
-
Then I click on element having id "com.android2.calculator3:id/digit2"
|
32
|
-
When I click on element having id "com.android2.calculator3:id/equal"
|
33
|
-
Then element having xpath "//android.widget.EditText[@index=0]" should have text as "4"
|
34
|
-
|
35
|
-
Scenario: Clear output
|
36
|
-
Then I click on element having id "com.android2.calculator3:id/clear"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#Scenario: Division
|
2
|
-
# Then I click on element having id "com.android2.calculator3:id/digit8"
|
3
|
-
# Then I click on element having id "com.android2.calculator3:id/div"
|
4
|
-
# Then I click on element having id "com.android2.calculator3:id/digit4"
|
5
|
-
# When I click on element having id "com.android2.calculator3:id/equal"
|
6
|
-
# Then element having xpath "//android.widget.EditText[@index=0]" should have text as "2"
|
7
|
-
|
8
|
-
# Scenario: Multiplication
|
9
|
-
# Then I click on element having id "com.android2.calculator3:id/digit6"
|
10
|
-
# Then I click on element having id "com.android2.calculator3:id/mul"
|
11
|
-
# Then I click on element having id "com.android2.calculator3:id/digit5"
|
12
|
-
# When I click on element having id "com.android2.calculator3:id/equal"
|
13
|
-
# Then element having xpath "//android.widget.EditText[@index=0]" should have text as "30"
|