itms_automation 2.6.0 → 2.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features-skeleton/Gemfile +3 -0
- data/features-skeleton/Gemfile.lock +63 -0
- data/features-skeleton/README.md +194 -0
- data/features-skeleton/cucumber.yml +4 -0
- data/features-skeleton/my_first.feature +9 -4
- data/features-skeleton/step_definitions/assertion_steps.rb +69 -0
- data/features-skeleton/step_definitions/click_elements_steps.rb +25 -0
- data/features-skeleton/step_definitions/configuration_steps.rb +8 -0
- data/features-skeleton/step_definitions/input_steps.rb +60 -0
- data/features-skeleton/step_definitions/javascript_handling_steps.rb +11 -0
- data/features-skeleton/step_definitions/navigation_steps.rb +80 -0
- data/features-skeleton/step_definitions/progress_steps.rb +18 -0
- data/features-skeleton/support/env.rb +21 -19
- data/lib/itms_automation/methods/assertion_methods.rb +15 -15
- data/lib/itms_automation/methods/click_elements_methods.rb +0 -1
- data/lib/itms_automation/methods/misc_methods.rb +1 -0
- data/lib/itms_automation/methods/navigate_methods.rb +2 -4
- data/lib/itms_automation/version.rb +1 -1
- metadata +34 -24
- data/features-skeleton/step_definitions/custom_steps.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0debb622483ecc8f743af4f964ac19b076602ae62a0ecf149b4b85284bd5bd9
|
4
|
+
data.tar.gz: a3d0dad052dd905099398484e92cb6a4e41a08f075bb69491cf9a374bf96104c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da38039d36ea506eb94609c605eb05a84da8f182e4a555ac8734bcdf2b4cd065ac2c07084626a5551e2f48049a7715bca2a5de7e67a1c5e4bec3643be7d28714
|
7
|
+
data.tar.gz: f52d41f0474e7d606891093536673b5c108a00d4f7f3e8063e4a8fbb6dfbbd22699374a6daebb13be4fd058933d8fbf1bbbd5c5ca1361eac4cb9458a91e67734
|
@@ -0,0 +1,63 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
appium_lib_core (3.10.1)
|
5
|
+
faye-websocket (~> 0.10.0)
|
6
|
+
selenium-webdriver (~> 3.14, >= 3.14.1)
|
7
|
+
backports (3.18.1)
|
8
|
+
builder (3.2.4)
|
9
|
+
childprocess (3.0.0)
|
10
|
+
cucumber (3.1.2)
|
11
|
+
builder (>= 2.1.2)
|
12
|
+
cucumber-core (~> 3.2.0)
|
13
|
+
cucumber-expressions (~> 6.0.1)
|
14
|
+
cucumber-wire (~> 0.0.1)
|
15
|
+
diff-lcs (~> 1.3)
|
16
|
+
gherkin (~> 5.1.0)
|
17
|
+
multi_json (>= 1.7.5, < 2.0)
|
18
|
+
multi_test (>= 0.1.2)
|
19
|
+
cucumber-core (3.2.1)
|
20
|
+
backports (>= 3.8.0)
|
21
|
+
cucumber-tag_expressions (~> 1.1.0)
|
22
|
+
gherkin (~> 5.0)
|
23
|
+
cucumber-expressions (6.0.1)
|
24
|
+
cucumber-tag_expressions (1.1.1)
|
25
|
+
cucumber-wire (0.0.1)
|
26
|
+
diff-lcs (1.4.4)
|
27
|
+
eventmachine (1.2.7)
|
28
|
+
faye-websocket (0.10.9)
|
29
|
+
eventmachine (>= 0.12.0)
|
30
|
+
websocket-driver (>= 0.5.1)
|
31
|
+
gherkin (5.1.0)
|
32
|
+
httparty (0.13.7)
|
33
|
+
json (~> 1.8)
|
34
|
+
multi_xml (>= 0.5.2)
|
35
|
+
itms_automation (2.6.1)
|
36
|
+
appium_lib_core (~> 3.10.1, >= 3.10.1)
|
37
|
+
cucumber (~> 3.1.2, >= 3.1.2)
|
38
|
+
httparty (~> 0.13.7, >= 0.13.7)
|
39
|
+
report_builder (~> 1.8, >= 1.8)
|
40
|
+
selenium-webdriver (~> 3.14, >= 3.14.1)
|
41
|
+
json (1.8.6)
|
42
|
+
multi_json (1.14.1)
|
43
|
+
multi_test (0.1.2)
|
44
|
+
multi_xml (0.6.0)
|
45
|
+
report_builder (1.8)
|
46
|
+
json (>= 1.8.1)
|
47
|
+
rubyzip (2.3.0)
|
48
|
+
selenium-webdriver (3.142.7)
|
49
|
+
childprocess (>= 0.5, < 4.0)
|
50
|
+
rubyzip (>= 1.2.2)
|
51
|
+
websocket-driver (0.7.2)
|
52
|
+
websocket-extensions (>= 0.1.0)
|
53
|
+
websocket-extensions (0.1.5)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
itms_automation
|
60
|
+
report_builder
|
61
|
+
|
62
|
+
BUNDLED WITH
|
63
|
+
2.0.2
|
@@ -0,0 +1,194 @@
|
|
1
|
+
Welcome to itms_automation
|
2
|
+
=================
|
3
|
+
|
4
|
+
itms_automation : Automation Tesing Using Ruby
|
5
|
+
|
6
|
+
itms_automation is a behavior driven development (BDD) approach to write automation test script to test Web and Android Apps.
|
7
|
+
It enables you to write and execute automated acceptance/unit tests.
|
8
|
+
It is cross-platform, open source and free.
|
9
|
+
Automate your test cases with minimal coding.
|
10
|
+
|
11
|
+
itms_automation Ruby API's
|
12
|
+
============================
|
13
|
+
|
14
|
+
If you are writing code for your custom steps you can use the following methods :
|
15
|
+
|
16
|
+
Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
|
17
|
+
|
18
|
+
Navigation API's
|
19
|
+
----------------
|
20
|
+
# method to open link
|
21
|
+
navigate_to("link")
|
22
|
+
# method to navigate back & forward
|
23
|
+
navigate(direction) # direction => "back" / "forward"
|
24
|
+
# method to quite webdriver instance
|
25
|
+
close_driver()
|
26
|
+
# method to return key by os wise
|
27
|
+
get_key()
|
28
|
+
# Method to zoom in/out page
|
29
|
+
zoom_in_out(in_out) # in_out => "in" / "out"
|
30
|
+
# Method to zoom in/out web page until web element dislays
|
31
|
+
zoom_in_out_till_element_display(element, in_out)
|
32
|
+
# Method to resize browser
|
33
|
+
resize_browser(width, heigth)
|
34
|
+
# Method to maximize browser
|
35
|
+
maximize_browser
|
36
|
+
# Method to refresh page
|
37
|
+
refresh_page
|
38
|
+
# Method to hover on element
|
39
|
+
hover_over_element(element)
|
40
|
+
# Method to scroll page to perticular element
|
41
|
+
scroll_to_element(element)
|
42
|
+
# method to scroll page to top or end
|
43
|
+
scroll_page(to)
|
44
|
+
# Method to switch to new window
|
45
|
+
switch_to_new_window
|
46
|
+
# Method to switch to old window
|
47
|
+
switch_to_old_window
|
48
|
+
# Method to close new window
|
49
|
+
close_new_window
|
50
|
+
|
51
|
+
Input API's
|
52
|
+
-------------------------
|
53
|
+
|
54
|
+
# method to enter text into textfield
|
55
|
+
enter_text(element, text)
|
56
|
+
# method to clear text from textfield
|
57
|
+
clear_text(element)
|
58
|
+
# method to select option from dropdwon list
|
59
|
+
select_option_from_dropdown(element, by, option)
|
60
|
+
# method to select all option from dropdwon list
|
61
|
+
select_all_option_from_multiselect_dropdown(element)
|
62
|
+
# method to unselect all option from dropdwon list
|
63
|
+
unselect_all_option_from_multiselect_dropdown(element)
|
64
|
+
# method to check checkbox
|
65
|
+
check_checkbox(element)
|
66
|
+
# method to uncheck checkbox
|
67
|
+
uncheck_checkbox(element)
|
68
|
+
# method to select radio button
|
69
|
+
toggle_checkbox(element)
|
70
|
+
# method to select radio button
|
71
|
+
select_radio_button(element)
|
72
|
+
# method to select option from radio button group
|
73
|
+
select_option_from_radio_button_group(element, by, option)
|
74
|
+
|
75
|
+
Click API's
|
76
|
+
------------
|
77
|
+
# method to click on an element
|
78
|
+
click(element)
|
79
|
+
# method to double-click on an element
|
80
|
+
double_click(element)
|
81
|
+
# method to forcefully click on an element
|
82
|
+
click_forcefully(element)
|
83
|
+
|
84
|
+
Javascript Handling API
|
85
|
+
-----------------------
|
86
|
+
# method to interact with alert
|
87
|
+
handle_alert(decision) # decision => "accept" / "dismiss"
|
88
|
+
|
89
|
+
Progress API's
|
90
|
+
--------------
|
91
|
+
# method to wait with second
|
92
|
+
wait(time_in_sec)
|
93
|
+
# method to wait for the element display
|
94
|
+
wait_for_element_to_display(element, duration)
|
95
|
+
# method to wait for the element enable
|
96
|
+
wait_for_element_to_enable(element, duration)
|
97
|
+
|
98
|
+
Screenshot API's
|
99
|
+
--------------
|
100
|
+
# method to take screenshot and save in screenshot folder
|
101
|
+
take_screenshots
|
102
|
+
|
103
|
+
Configuration API's
|
104
|
+
-----------------
|
105
|
+
# method to print configuration
|
106
|
+
print_congifugartion
|
107
|
+
# method to print desktop configuration
|
108
|
+
print_desktop_configuration
|
109
|
+
# method to print mobile configuration
|
110
|
+
print_mobile_configuration
|
111
|
+
|
112
|
+
Assertion API's
|
113
|
+
-----------------
|
114
|
+
# Method to return page title
|
115
|
+
get_page_title
|
116
|
+
# Method to verify title
|
117
|
+
# param 1 : String : expected title
|
118
|
+
# param 2 : Boolean : test case [true or flase]
|
119
|
+
check_title(title, test_case)
|
120
|
+
# Method to verify partial title
|
121
|
+
# param 1 : String : partial title string
|
122
|
+
# param 2 : Boolean : test case [true or flase]
|
123
|
+
check_partial_title(partial_text_title, test_case)
|
124
|
+
# Method to get element text
|
125
|
+
# param : String
|
126
|
+
get_element_text(element)
|
127
|
+
# Method to check element text
|
128
|
+
# param 1 : String : Element
|
129
|
+
# param 2 : String : Expected element text
|
130
|
+
# param 3 : Boolean : test case [true or flase]
|
131
|
+
check_element_text(element, expected_value, test_case)
|
132
|
+
# Method to check partial element text
|
133
|
+
# param 1 : String : Element
|
134
|
+
# param 2 : String : Expected element partial text
|
135
|
+
# param 3 : Boolean : test case [true or flase]
|
136
|
+
check_element_partial_text(element, expected_value, test_case)
|
137
|
+
# Method to return element status - enabled?
|
138
|
+
# param : String : Element
|
139
|
+
is_element_enabled(element)
|
140
|
+
# method to check element status - enabled?
|
141
|
+
# param 1 : String : Element
|
142
|
+
# param 2 : Boolean : test case [true or flase]
|
143
|
+
check_element_enable(element, test_case)
|
144
|
+
# method to get attribute value
|
145
|
+
# param 1 : String : Element
|
146
|
+
# param 2 : String : atrribute name
|
147
|
+
get_element_attribute(element, attribute_name)
|
148
|
+
# method to check attribute value
|
149
|
+
# param 1 : String : Element
|
150
|
+
# param 2 : String : atrribute name
|
151
|
+
# param 3 : String : atrribute value
|
152
|
+
# param 4 : Boolean : test case [true or flase]
|
153
|
+
check_element_attribute(element, attribute_name, attribute_value, test_case)
|
154
|
+
# method to get element status - displayed?
|
155
|
+
# param : String : Element
|
156
|
+
is_element_displayed(element)
|
157
|
+
# method to check element presence
|
158
|
+
# param 1 : String : Element
|
159
|
+
# param 2 : Boolean : test case [true or flase]
|
160
|
+
check_element_presence(element, test_case)
|
161
|
+
# method to assert checkbox check/uncheck
|
162
|
+
# param 1 : String : Element
|
163
|
+
# param 2 : Boolean : test case [true or flase]
|
164
|
+
is_checkbox_checked(element, should_be_checked = true)
|
165
|
+
# method to assert radio button selected/unselected
|
166
|
+
# param 1 : String : Element
|
167
|
+
# param 2 : Boolean : test case [true or flase]
|
168
|
+
is_radio_button_selected(element, should_be_selected = true)
|
169
|
+
# method to assert option from radio button group is selected/unselected
|
170
|
+
is_option_from_radio_button_group_selected(element, by, option, should_be_selected = true)
|
171
|
+
# method to get javascript pop-up alert text
|
172
|
+
get_alert_text
|
173
|
+
# method to check javascript pop-up alert text
|
174
|
+
check_alert_text(text)
|
175
|
+
# method to check dropdown status -> selected
|
176
|
+
is_option_from_dropdown_selected(element, by, option, should_be_selected=true)
|
177
|
+
|
178
|
+
Usage: itms_automation <command-name> [parameters] [options]
|
179
|
+
|
180
|
+
<command-name> can be one of
|
181
|
+
help
|
182
|
+
gen
|
183
|
+
version
|
184
|
+
|
185
|
+
Commands:
|
186
|
+
help : prints more detailed help information.
|
187
|
+
|
188
|
+
gen : creates a skeleton features dir. This is usually used once when
|
189
|
+
setting up selnium-cucumber to ensure that the features folder contains
|
190
|
+
the right step definitions and environment to run with cucumber.
|
191
|
+
|
192
|
+
version : prints the gem version
|
193
|
+
|
194
|
+
Options: -v, --verbose Turns on verbose logging
|
@@ -1,5 +1,10 @@
|
|
1
|
-
Feature:
|
1
|
+
# Feature: Addition
|
2
|
+
# As a math idiot
|
3
|
+
# In order to not feel silly
|
4
|
+
# I add two numbers
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
+
# Scenario: Adding a and b
|
7
|
+
# Given I have variable a
|
8
|
+
# And I have variable b
|
9
|
+
# When I add a and b
|
10
|
+
# Then I display the sum
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# # page title checking
|
6
|
+
# Then(/^I should\s*((?:not)?)\s+see page title as "(.*?)"$/) do |present, title|
|
7
|
+
# check_title(title, present.empty?)
|
8
|
+
# end
|
9
|
+
|
10
|
+
# Then(/^I should\s*((?:not)?)\s+see page title having partial text as "(.*?)"$/) do |present, partial_text_title|
|
11
|
+
# check_partial_title(partial_text_title, present.empty?)
|
12
|
+
# end
|
13
|
+
|
14
|
+
# # step to check element text
|
15
|
+
# Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have text as "(.*?)"$/) do |element, present, value |
|
16
|
+
# check_element_text(element, value, present.empty?)
|
17
|
+
# end
|
18
|
+
|
19
|
+
# # step to check element partial text
|
20
|
+
# Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have partial text as "(.*?)"$/) do |element, present, value |
|
21
|
+
# check_element_partial_text(element, value, present.empty?)
|
22
|
+
# end
|
23
|
+
|
24
|
+
# # step to check attribute value
|
25
|
+
# Then(/^element "([^\"]*)" should\s*((?:not)?)\s+have attribute "(.*?)" with value "(.*?)"$/) do |element, present, attrb, value|
|
26
|
+
# check_element_attribute(element, attrb, value, present.empty?)
|
27
|
+
# end
|
28
|
+
|
29
|
+
# # step to check element enabled or not
|
30
|
+
# Then(/^element "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |element, present, state|
|
31
|
+
# flag = state == 'enabled'
|
32
|
+
# flag = !flag unless present.empty?
|
33
|
+
# check_element_enable(element, flag)
|
34
|
+
# end
|
35
|
+
|
36
|
+
# # step to check element present or not
|
37
|
+
# Then(/^element "(.*?)" should\s*((?:not)?)\s+be present$/) do |element, present|
|
38
|
+
# check_element_presence(element, present.empty?)
|
39
|
+
# end
|
40
|
+
|
41
|
+
# # step to assert checkbox is checked or unchecked
|
42
|
+
# Then(/^checkbox "(.*?)" should be (checked|unchecked)$/) do |element, state|
|
43
|
+
# flag = state == 'checked'
|
44
|
+
# is_checkbox_checked(element, flag)
|
45
|
+
# end
|
46
|
+
|
47
|
+
# # steps to assert radio button checked or unchecked
|
48
|
+
# Then(/^radio button"(.*?)" should be (selected|unselected)$/) do |element, state|
|
49
|
+
# flag = state == 'selected'
|
50
|
+
# is_radio_button_selected(element, flag)
|
51
|
+
# end
|
52
|
+
|
53
|
+
# # steps to assert option by text from radio button group selected/unselected
|
54
|
+
# Then(/^option "(.*?)" by (.+) from radio button group "(.*?)" should be (selected|unselected)$/) do |option, attrb, element, state|
|
55
|
+
# flag = state == 'selected'
|
56
|
+
# is_option_from_radio_button_group_selected(element, attrb, option, flag)
|
57
|
+
# end
|
58
|
+
|
59
|
+
# # step to assert javascript pop-up alert text
|
60
|
+
# Then(/^I should see alert text as "(.*?)"$/) do |actual_value|
|
61
|
+
# check_alert_text(actual_value)
|
62
|
+
# end
|
63
|
+
|
64
|
+
# # step to assert dropdown list
|
65
|
+
# Then(/^option "(.*?)" by (.+) from dropdown "(.*?)" should be (selected|unselected)$/) do |option, by, element, state|
|
66
|
+
# flag = state == 'selected'
|
67
|
+
# is_option_from_dropdown_selected(element, by, option, state)
|
68
|
+
# end
|
69
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# # click on web element
|
6
|
+
# When(/^I click on element"(.*?)"$/) do |element|
|
7
|
+
# click(element)
|
8
|
+
# end
|
9
|
+
|
10
|
+
# Then(/^I forcefully click on element "(.*?)"$/) do |element|
|
11
|
+
# click_forcefully(element)
|
12
|
+
# end
|
13
|
+
|
14
|
+
# # double click on web element
|
15
|
+
# Then(/^I double click on element "(.*?)"$/) do |element|
|
16
|
+
# double_click(element)
|
17
|
+
# end
|
18
|
+
|
19
|
+
# When(/^I tap on element"(.*?)"$/) do |element|
|
20
|
+
# click(element)
|
21
|
+
# end
|
22
|
+
|
23
|
+
# Then(/^I long press on element "(.*?)"$/) do |element|
|
24
|
+
# long_press(element, duration)
|
25
|
+
# end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# # enter text into input field steps
|
6
|
+
# Then(/^I enter "([^\"]*)" into element "(.*?)"$/) do |text, element|
|
7
|
+
# enter_text(type, element)
|
8
|
+
# end
|
9
|
+
|
10
|
+
# # clear input field steps
|
11
|
+
# Then(/^I clear input element "(.*?)"$/) do |type, element|
|
12
|
+
# clear_text(type, element)
|
13
|
+
# end
|
14
|
+
|
15
|
+
# # select option by text/value from dropdown/multiselect
|
16
|
+
# Then(/^I select "(.*?)" option by (.+) from\s*((?:multiselect)?)\sdropdown "(.*?)"$/) do |option, option_by, present, element|
|
17
|
+
# validate_option_by option_by
|
18
|
+
# select_option_from_dropdown(element, option_by, option)
|
19
|
+
# end
|
20
|
+
|
21
|
+
# # select option by index from dropdown/multiselect
|
22
|
+
# Then(/^I select (\d+) option by index from\s*((?:multiselect)?)\sdropdown "(.*?)"$/) do |option, present, element|
|
23
|
+
# select_option_from_dropdown(element, 'index', (option.to_i) -1)
|
24
|
+
# end
|
25
|
+
|
26
|
+
# # step to select option from mutliselect dropdown list
|
27
|
+
# Then(/^I select all options from multiselect dropdown "(.*?)"$/) do |element|
|
28
|
+
# select_all_option_from_multiselect_dropdown(element)
|
29
|
+
# end
|
30
|
+
|
31
|
+
# # step to unselect option from mutliselect dropdown list
|
32
|
+
# Then(/^I unselect all options from multiselect dropdown "(.*?)"$/) do |element|
|
33
|
+
# unselect_all_option_from_multiselect_dropdown(element)
|
34
|
+
# end
|
35
|
+
|
36
|
+
# # check checkbox steps
|
37
|
+
# Then(/^I check the checkbox "(.*?)"$/) do |element|
|
38
|
+
# check_checkbox(element)
|
39
|
+
# end
|
40
|
+
|
41
|
+
# # uncheck checkbox steps
|
42
|
+
# Then(/^I uncheck the checkbox "(.*?)"$/) do |element|
|
43
|
+
# uncheck_checkbox(element)
|
44
|
+
# end
|
45
|
+
|
46
|
+
# # steps to toggle checkbox
|
47
|
+
# Then(/^I toggle checkbox "(.*?)"$/) do |element|
|
48
|
+
# toggle_checkbox(element)
|
49
|
+
# end
|
50
|
+
|
51
|
+
# # step to select radio button
|
52
|
+
# Then(/^I select radio button "(.*?)"$/) do |element|
|
53
|
+
# select_radio_button(element)
|
54
|
+
# end
|
55
|
+
|
56
|
+
# # steps to select option by text from radio button group
|
57
|
+
# Then(/^I select "(.*?)" option by (.+) from radio button group "(.*?)"$/) do |option, option_by, element|
|
58
|
+
# validate_option_by option_by
|
59
|
+
# select_option_from_radio_button_group(element, option_by, option)
|
60
|
+
# end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# Then(/^I accept alert$/) do
|
6
|
+
# handle_alert('accept')
|
7
|
+
# end
|
8
|
+
|
9
|
+
# Then(/^I dismiss alert$/) do
|
10
|
+
# handle_alert('dismiss')
|
11
|
+
# end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# Then(/^I navigate to "([^\"]*)"$/)do |link|
|
6
|
+
# navigate_to(link)
|
7
|
+
# end
|
8
|
+
|
9
|
+
# Then(/^I navigate forward/) do
|
10
|
+
# navigate('forward')
|
11
|
+
# end
|
12
|
+
|
13
|
+
# Then(/^I navigate back/) do
|
14
|
+
# navigate('back')
|
15
|
+
# end
|
16
|
+
|
17
|
+
# Then(/^I close browser$/) do
|
18
|
+
# close_driver
|
19
|
+
# end
|
20
|
+
|
21
|
+
# # step to resize browser
|
22
|
+
# Then(/^I resize browser window size to width (\d+) and height (\d+)$/) do |width, heigth|
|
23
|
+
# resize_browser(width, heigth)
|
24
|
+
# end
|
25
|
+
|
26
|
+
# # step to maximize browser
|
27
|
+
# Then(/^I maximize browser window$/) do
|
28
|
+
# maximize_browser
|
29
|
+
# end
|
30
|
+
|
31
|
+
# # steps to refresh page
|
32
|
+
# Then(/^I refresh page$/) do
|
33
|
+
# refresh_page
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Then(/^I switch to new window$/) do
|
37
|
+
# switch_to_new_window
|
38
|
+
# end
|
39
|
+
|
40
|
+
# Then(/^I switch to previous window$/) do
|
41
|
+
# switch_to_old_window
|
42
|
+
# end
|
43
|
+
|
44
|
+
# Then(/^I close new window$/) do
|
45
|
+
# close_new_window
|
46
|
+
# end
|
47
|
+
|
48
|
+
# # steps to scroll to element
|
49
|
+
# Then(/^I scroll to element "(.*?)"$/) do |type, element|
|
50
|
+
# scroll_to_element(type, element)
|
51
|
+
# end
|
52
|
+
|
53
|
+
# # steps to scroll web page to top or end
|
54
|
+
# Then(/^I scroll to (top|end) of page$/) do |to|
|
55
|
+
# scroll_page(to)
|
56
|
+
# end
|
57
|
+
|
58
|
+
# # step to hover over a element Note: Doesn't work on Windows firefox
|
59
|
+
# When(/^I hover over element having (.+) "(.*?)"$/) do |type, element|
|
60
|
+
# hover_over_element(type, element)
|
61
|
+
# end
|
62
|
+
|
63
|
+
# # steps to zoom in page
|
64
|
+
# Then(/^I zoom in page$/) do
|
65
|
+
# zoom_in_out('add')
|
66
|
+
# end
|
67
|
+
|
68
|
+
# # steps to zoom out page
|
69
|
+
# Then(/^I zoom out page$/) do
|
70
|
+
# zoom_in_out('subtract')
|
71
|
+
# end
|
72
|
+
|
73
|
+
# # steps to zoom out till element displays
|
74
|
+
# Then(/^I zoom out page till I see element "(.*?)"$/) do |type, element|
|
75
|
+
# zoom_in_out_till_element_display(type, 'subtract', element)
|
76
|
+
# end
|
77
|
+
|
78
|
+
# Then(/^I reset page view$/) do
|
79
|
+
# zoom_in_out('numpad0')
|
80
|
+
# end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Do Not Remove This File
|
2
|
+
# Please adjust the below steps as your needed
|
3
|
+
# $driver is instance of webdriver use this instance to write your custom code
|
4
|
+
|
5
|
+
# # wait for specific period of time
|
6
|
+
# Then(/^I wait for (\d+) sec$/) do |time|
|
7
|
+
# wait(time)
|
8
|
+
# end
|
9
|
+
|
10
|
+
# # wait for specific element to display for specific period of time
|
11
|
+
# Then(/^I wait (\d+) seconds for element "(.*?)" to display$/) do |duration, element|
|
12
|
+
# wait_for_element_to_display(element, duration)
|
13
|
+
# end
|
14
|
+
|
15
|
+
# # wait for specific element to enable for specific period of time
|
16
|
+
# Then(/^I wait (\d+) seconds for element "(.*?)" to enable$/) do |duration, element|
|
17
|
+
# wait_for_element_to_enable(element, duration)
|
18
|
+
# end
|
@@ -73,34 +73,36 @@ if $platform == "android" or $platform == "iOS"
|
|
73
73
|
else # else create driver instance for desktop browser
|
74
74
|
begin
|
75
75
|
$driver = case $browser_type
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
76
|
+
when "chrome"
|
77
|
+
Selenium::WebDriver.for(:chrome)
|
78
|
+
when "safari"
|
79
|
+
Selenium::WebDriver.for(:safari)
|
80
|
+
when "internet_explorer"
|
81
|
+
Selenium::WebDriver.for(:internet_explorer)
|
82
|
+
when "chrome_headless"
|
83
|
+
Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
|
84
|
+
when "remote"
|
85
|
+
if ENV["SERVER_URL"].nil? || ENV["REMOTE_BROWSER"].nil?
|
86
|
+
puts "\nMissing SERVER_URL : SERVER_URL=http://SERVER_URL:4444/wd/hub"
|
87
|
+
puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
|
88
|
+
Process.exit(0)
|
89
|
+
else
|
90
|
+
if ENV['SERVER_URL'].nil? || ENV['REMOTE_BROWSER'].nil?
|
86
91
|
puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
|
87
92
|
puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
|
88
93
|
Process.exit(0)
|
89
94
|
else
|
90
95
|
caps = Selenium::WebDriver::Remote::Capabilities.new
|
91
96
|
caps["browserName"] = ENV["REMOTE_BROWSER"]
|
97
|
+
caps["enableVNC"] = true
|
98
|
+
caps["enableVideo"] = true
|
99
|
+
caps["resolution"] = ENV["resolution"] unless ENV["resolution"]
|
92
100
|
Selenium::WebDriver.for(:remote, :url => ENV["SERVER_URL"], :desired_capabilities => caps)
|
93
|
-
end
|
94
|
-
else
|
95
|
-
Selenium::WebDriver.for(:firefox)
|
96
|
-
end
|
97
|
-
$driver.manage().window().maximize()
|
98
|
-
if ENV["UPDATE_SESSION_ID_API"]
|
99
|
-
begin
|
100
|
-
HTTParty.post(ENV["UPDATE_SESSION_ID_API"], body: { session_id: $driver.session_id })
|
101
|
-
rescue => exception
|
102
101
|
end
|
102
|
+
else
|
103
|
+
Selenium::WebDriver.for(:firefox)
|
103
104
|
end
|
105
|
+
$driver.manage().window().maximize()
|
104
106
|
rescue Exception => e
|
105
107
|
puts e.message
|
106
108
|
Process.exit(0)
|
@@ -50,16 +50,16 @@ end
|
|
50
50
|
# param 1 : String : Element
|
51
51
|
# param 2 : String : Expected element text
|
52
52
|
# param 3 : Boolean : test case [true or flase]
|
53
|
-
def check_element_text(element,
|
53
|
+
def check_element_text(element, expected_value, test_case)
|
54
54
|
element_text = get_element_text(element)
|
55
55
|
|
56
56
|
if test_case
|
57
|
-
if element_text !=
|
58
|
-
raise TestCaseFailed,
|
57
|
+
if element_text != expected_value
|
58
|
+
raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
|
59
59
|
end
|
60
60
|
else
|
61
|
-
if element_text ==
|
62
|
-
raise TestCaseFailed,
|
61
|
+
if element_text == expected_value
|
62
|
+
raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -68,27 +68,27 @@ end
|
|
68
68
|
# param 1 : String : Element
|
69
69
|
# param 2 : String : Expected element partial text
|
70
70
|
# param 3 : Boolean : test case [true or flase]
|
71
|
-
def check_element_partial_text(element,
|
71
|
+
def check_element_partial_text(element, expected_value, test_case)
|
72
72
|
element_text = get_element_text(element)
|
73
73
|
|
74
74
|
if test_case
|
75
|
-
if not element_text.include? "#{
|
76
|
-
raise TestCaseFailed,
|
75
|
+
if not element_text.include? "#{expected_value}"
|
76
|
+
raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
|
77
77
|
end
|
78
78
|
else
|
79
|
-
if element_text.include? "#{
|
80
|
-
raise TestCaseFailed,
|
79
|
+
if element_text.include? "#{expected_value}"
|
80
|
+
raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
#
|
85
|
+
# method to return element status - enabled?
|
86
86
|
# param : String : Element
|
87
87
|
def is_element_enabled(element)
|
88
88
|
WAIT.until{ find_object(element) }.enabled?
|
89
89
|
end
|
90
90
|
|
91
|
-
#
|
91
|
+
# method to check element status - enabled?
|
92
92
|
# param 1 : String : Element
|
93
93
|
# param 2 : Boolean : test case [true or flase]
|
94
94
|
def check_element_enable(element, test_case)
|
@@ -119,11 +119,11 @@ def check_element_attribute(element, attribute_name, attribute_value, test_case)
|
|
119
119
|
|
120
120
|
if test_case
|
121
121
|
if attr_val != attribute_value
|
122
|
-
raise TestCaseFailed,
|
122
|
+
raise TestCaseFailed, "Attribute Value Not Matched. Actual Value :#{attr_val}"
|
123
123
|
end
|
124
124
|
else
|
125
125
|
if attr_val == attribute_value
|
126
|
-
raise TestCaseFailed,
|
126
|
+
raise TestCaseFailed, "Attribute Value Matched. Actual Value :#{attr_val}"
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -204,7 +204,7 @@ end
|
|
204
204
|
# method to check javascript pop-up alert text
|
205
205
|
def check_alert_text(text)
|
206
206
|
if get_alert_text != text
|
207
|
-
raise TestCaseFailed,
|
207
|
+
raise TestCaseFailed, "Text on alert pop up not matched. Actual Value :#{get_alert_text}"
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
@@ -13,7 +13,6 @@ def double_click(element)
|
|
13
13
|
$driver.action.double_click(found_element).perform
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
def long_press( element, duration)
|
18
17
|
found_element = WAIT.until { find_object(element) }
|
19
18
|
parameters = { "element" => "#{found_element}", "duration" => "#{duration}" }
|
@@ -5,7 +5,7 @@ def navigate_to(link)
|
|
5
5
|
$driver.get link
|
6
6
|
end
|
7
7
|
|
8
|
-
# method to navigate back &
|
8
|
+
# method to navigate back & forward
|
9
9
|
def navigate(direction)
|
10
10
|
if direction == 'back'
|
11
11
|
$driver.navigate.back
|
@@ -36,7 +36,7 @@ def zoom_in_out(in_out)
|
|
36
36
|
$driver.action.key_down(:"#{get_key}").send_keys(:"#{in_out}").key_up(:"#{get_key}").perform
|
37
37
|
end
|
38
38
|
|
39
|
-
# Method to zoom in/out web page until web element
|
39
|
+
# Method to zoom in/out web page until web element dislays
|
40
40
|
def zoom_in_out_till_element_display(element, in_out)
|
41
41
|
while true
|
42
42
|
if WAIT.until { find_object(element) }.displayed?
|
@@ -88,13 +88,11 @@ end
|
|
88
88
|
$old_win = nil
|
89
89
|
|
90
90
|
# Method to switch to new window
|
91
|
-
|
92
91
|
def switch_to_new_window
|
93
92
|
$old_win = $driver.window_handle
|
94
93
|
$driver.switch_to.window($driver.window_handles[1])
|
95
94
|
end
|
96
95
|
|
97
|
-
|
98
96
|
# Method to switch to old window
|
99
97
|
def switch_to_old_window
|
100
98
|
$driver.switch_to.window($old_win)
|
metadata
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itms_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- INFOdation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.1.2
|
20
|
-
- - "
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.1.2
|
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
29
|
version: 3.1.2
|
30
|
-
- - "
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 3.1.2
|
33
33
|
- !ruby/object:Gem::Dependency
|
@@ -54,60 +54,60 @@ dependencies:
|
|
54
54
|
name: appium_lib_core
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 3.10.1
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 3.10.1
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 3.10.1
|
70
|
-
- - "
|
70
|
+
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 3.10.1
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: httparty
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 0.13.7
|
80
77
|
- - ">="
|
81
78
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
79
|
+
version: 0.18.1
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.18.1
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.13.7
|
90
87
|
- - ">="
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version: 0.
|
89
|
+
version: 0.18.1
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.18.1
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: report_builder
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '1.8'
|
100
|
-
- - "
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '1.8'
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '1.8'
|
110
|
-
- - "
|
110
|
+
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '1.8'
|
113
113
|
description: Behavior driven development (BDD) approach to write automation test script
|
@@ -147,9 +147,19 @@ files:
|
|
147
147
|
- example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb
|
148
148
|
- example/desktop web/desktop_web_gmail_login/features/support/env.rb
|
149
149
|
- example/desktop web/desktop_web_gmail_login/features/support/hooks.rb
|
150
|
+
- features-skeleton/Gemfile
|
151
|
+
- features-skeleton/Gemfile.lock
|
152
|
+
- features-skeleton/README.md
|
153
|
+
- features-skeleton/cucumber.yml
|
150
154
|
- features-skeleton/my_first.feature
|
151
155
|
- features-skeleton/screenshots/test.png
|
152
|
-
- features-skeleton/step_definitions/
|
156
|
+
- features-skeleton/step_definitions/assertion_steps.rb
|
157
|
+
- features-skeleton/step_definitions/click_elements_steps.rb
|
158
|
+
- features-skeleton/step_definitions/configuration_steps.rb
|
159
|
+
- features-skeleton/step_definitions/input_steps.rb
|
160
|
+
- features-skeleton/step_definitions/javascript_handling_steps.rb
|
161
|
+
- features-skeleton/step_definitions/navigation_steps.rb
|
162
|
+
- features-skeleton/step_definitions/progress_steps.rb
|
153
163
|
- features-skeleton/step_definitions/repositories/project_object.yml
|
154
164
|
- features-skeleton/support/env.rb
|
155
165
|
- features-skeleton/support/hooks.rb
|
@@ -193,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
203
|
- !ruby/object:Gem::Version
|
194
204
|
version: '0'
|
195
205
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
206
|
+
rubygems_version: 3.0.6
|
197
207
|
signing_key:
|
198
208
|
specification_version: 4
|
199
209
|
summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
|