friendly-cukes 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/DETAILED_DESCRIPTION.md +235 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +108 -0
- data/Rakefile +2 -0
- data/bin/build-extractor +69 -0
- data/bin/friendly-cukes +48 -0
- data/friendly-cukes.gemspec +41 -0
- data/lib/friendly/build_extractor.rb +647 -0
- data/lib/friendly/cukes.rb +29 -0
- data/lib/friendly/cukes/framework/Gemfile +16 -0
- data/lib/friendly/cukes/framework/Gemfile.lock +113 -0
- data/lib/friendly/cukes/framework/Rakefile.rb +19 -0
- data/lib/friendly/cukes/framework/config/config.yml +87 -0
- data/lib/friendly/cukes/framework/config/cucumber.yml +49 -0
- data/lib/friendly/cukes/framework/coverage/.last_run.json +5 -0
- data/lib/friendly/cukes/framework/coverage/.resultset.json +3519 -0
- data/lib/friendly/cukes/framework/coverage/.resultset.json.lock +0 -0
- data/lib/friendly/cukes/framework/coverage/rcov/assets/0.2.3/jquery-1.3.2.min.js +19 -0
- data/lib/friendly/cukes/framework/coverage/rcov/assets/0.2.3/jquery.tablesorter.min.js +15 -0
- data/lib/friendly/cukes/framework/coverage/rcov/assets/0.2.3/print.css +12 -0
- data/lib/friendly/cukes/framework/coverage/rcov/assets/0.2.3/rcov.js +42 -0
- data/lib/friendly/cukes/framework/coverage/rcov/assets/0.2.3/screen.css +270 -0
- data/lib/friendly/cukes/framework/coverage/rcov/index.html +392 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-app_init-app_driver_rb.html +98 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-app_utils-data_file_names_rb.html +65 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-app_utils-page_utils_rb.html +533 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-create_log_rb.html +521 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-custom_html_report_rb.html +2522 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-datetime_library_rb.html +296 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-file_library_rb.html +995 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-performance_report_rb.html +1613 -0
- data/lib/friendly/cukes/framework/coverage/rcov/library-generic-read_from_yml_rb.html +944 -0
- data/lib/friendly/cukes/framework/coverage/rcov/object_repository-desktop-gem_search_rb.html +773 -0
- data/lib/friendly/cukes/framework/coverage/rcov/object_repository-desktop-google_search_rb.html +230 -0
- data/lib/friendly/cukes/framework/coverage/rcov/object_repository-mobile-mobile_google_search_rb.html +230 -0
- data/lib/friendly/cukes/framework/coverage/rcov/step_definitions-desktop-gem_search_rb.html +188 -0
- data/lib/friendly/cukes/framework/coverage/rcov/step_definitions-desktop-google_search_steps_rb.html +167 -0
- data/lib/friendly/cukes/framework/coverage/rcov/step_definitions-mobile-mobile_google_search_steps_rb.html +167 -0
- data/lib/friendly/cukes/framework/coverage/rcov/support-browser_settings_rb.html +851 -0
- data/lib/friendly/cukes/framework/coverage/rcov/support-env_rb.html +242 -0
- data/lib/friendly/cukes/framework/coverage/rcov/support-hooks_rb.html +878 -0
- data/lib/friendly/cukes/framework/coverage/rcov/support-html_formatter_rb.html +230 -0
- data/lib/friendly/cukes/framework/features/desktop/google_search/google_search.feature +19 -0
- data/lib/friendly/cukes/framework/features/desktop/rubygems_search/gem_name_tc_04.yml +2 -0
- data/lib/friendly/cukes/framework/features/desktop/rubygems_search/gem_search.feature +37 -0
- data/lib/friendly/cukes/framework/features/desktop/test_data/gem_name.yml +2 -0
- data/lib/friendly/cukes/framework/features/mobile/google_search/mobile_google_search.feature +19 -0
- data/lib/friendly/cukes/framework/library/app_init/app_init.rb +13 -0
- data/lib/friendly/cukes/framework/library/app_utils/data_file_names.rb +2 -0
- data/lib/friendly/cukes/framework/library/app_utils/page_utils.rb +157 -0
- data/lib/friendly/cukes/framework/library/generic/app_logo_1.png +0 -0
- data/lib/friendly/cukes/framework/library/generic/create_log.rb +154 -0
- data/lib/friendly/cukes/framework/library/generic/custom_html_report.rb +852 -0
- data/lib/friendly/cukes/framework/library/generic/datetime_library.rb +79 -0
- data/lib/friendly/cukes/framework/library/generic/file_library.rb +311 -0
- data/lib/friendly/cukes/framework/library/generic/performance_report.rb +518 -0
- data/lib/friendly/cukes/framework/library/generic/read_from_yml.rb +294 -0
- data/lib/friendly/cukes/framework/object_repository/desktop/desktop_web_object_repo.rb +50 -0
- data/lib/friendly/cukes/framework/object_repository/mobile/mobile_web_object_repo.rb +22 -0
- data/lib/friendly/cukes/framework/page_objects/desktop/gem_search.rb +213 -0
- data/lib/friendly/cukes/framework/page_objects/desktop/google_search.rb +53 -0
- data/lib/friendly/cukes/framework/page_objects/mobile/mobile_google_search.rb +53 -0
- data/lib/friendly/cukes/framework/step_definitions/desktop/gem_search.rb +43 -0
- data/lib/friendly/cukes/framework/step_definitions/desktop/google_search_steps.rb +36 -0
- data/lib/friendly/cukes/framework/step_definitions/mobile/mobile_google_search_steps.rb +36 -0
- data/lib/friendly/cukes/framework/support/browser_settings.rb +264 -0
- data/lib/friendly/cukes/framework/support/env.rb +65 -0
- data/lib/friendly/cukes/framework/support/hooks.rb +274 -0
- data/lib/friendly/cukes/framework/support/html_formatter.rb +57 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/app_env.log +15 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/custom_report/detailed_report/app_logo_1.png +0 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/custom_report/detailed_report/desktop_gem_search.html +647 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/custom_report/detailed_report/desktop_google_search.html +590 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/custom_report/report_home.html +593 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/desktop_rubygems_search.log +84 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/report_21_05_2015-11_04_54.html +472 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_33/report_21_05_2015-11_04_54.json +299 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_37/app_env.log +15 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_37/desktop_google_search.log +22 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_37/report_21_05_2015-11_03_49.html +472 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-11_03_37/report_21_05_2015-11_03_49.json +155 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-17_28_10/app_env.log +15 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-17_28_10/mobile_google_search.log +22 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-17_28_10/report_21_05_2015-17_29_26.html +472 -0
- data/lib/friendly/cukes/framework/test_result/test_report_21_05_2015-17_28_10/report_21_05_2015-17_29_26.json +143 -0
- data/lib/friendly/cukes/version.rb +61 -0
- metadata +309 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
*Name : Read_From_YML
|
|
3
|
+
*Description : class definition for reading data value from yml file
|
|
4
|
+
*Author : Chandra sekaran
|
|
5
|
+
*Creation Date : 23/08/2014
|
|
6
|
+
*Updation Date :
|
|
7
|
+
=end
|
|
8
|
+
|
|
9
|
+
module CUKES
|
|
10
|
+
class Read_From_YML
|
|
11
|
+
include FileLibrary # module that define methods for all file manipulations
|
|
12
|
+
|
|
13
|
+
# Description : opens the yml file
|
|
14
|
+
# Author : Chandra sekaran
|
|
15
|
+
# Arguments :
|
|
16
|
+
# str_file_path : relative path of the yml file
|
|
17
|
+
#
|
|
18
|
+
def initialize(str_file_path = "")
|
|
19
|
+
raise "Exception : ReadFromYML instance cannot be created with filename" if str_file_path.nil?
|
|
20
|
+
raise "Exception : file does not exists #{str_file_path}" if !is_file_exists(str_file_path)
|
|
21
|
+
@yml = open_yml_file(str_file_path)
|
|
22
|
+
@yml_file_path = str_file_path
|
|
23
|
+
rescue Exception => ex
|
|
24
|
+
$log.error("Error in opening file '#{str_file_path}' : #{ex}")
|
|
25
|
+
exit
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Description : returns the value for the given input ypath
|
|
29
|
+
# Author : Chandra sekaran
|
|
30
|
+
# Arguments :
|
|
31
|
+
# str_ypath : ypath of the key element
|
|
32
|
+
# Return value :
|
|
33
|
+
# req_val : value of the key element
|
|
34
|
+
#
|
|
35
|
+
def get_value(str_ypath = "")
|
|
36
|
+
raise "Exception : ReadFromYML - ypath cannot be empty" if str_ypath.nil?
|
|
37
|
+
req_val = traverse_yml(str_ypath)
|
|
38
|
+
return req_val
|
|
39
|
+
rescue Exception => ex
|
|
40
|
+
$log.error("Error in getting value for ypath '#{str_ypath}' : #{ex}")
|
|
41
|
+
exit
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Description : returns the hash value for the given unique key
|
|
45
|
+
# Author : Chandra sekaran
|
|
46
|
+
# Arguments :
|
|
47
|
+
# str_key : name of the unique key
|
|
48
|
+
# Return value :
|
|
49
|
+
# @req_hash : hash value of the unique key element
|
|
50
|
+
#
|
|
51
|
+
def get_values(str_key)
|
|
52
|
+
raise "Exception : ReadFromYML - key cannot be empty" if str_key.nil?
|
|
53
|
+
@yml.each do |key, value|
|
|
54
|
+
@req_hash = ''
|
|
55
|
+
if key == str_key
|
|
56
|
+
@req_hash = value
|
|
57
|
+
break
|
|
58
|
+
else
|
|
59
|
+
if value.size >= 1 and value.class.to_s == "Hash"
|
|
60
|
+
@req_hash = traverse_hash(value, str_key)
|
|
61
|
+
return @req_hash if @req_hash.class.to_s == "Hash"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
rescue Exception => ex
|
|
66
|
+
$log.error("Error in getting value for '#{str_key}' : #{ex}")
|
|
67
|
+
exit
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Description : returns the hash from the given input hash that matches the given key
|
|
71
|
+
# Author : Chandra sekaran
|
|
72
|
+
# Arguments :
|
|
73
|
+
# hash_val : hash element
|
|
74
|
+
# req_key : key to be found inside the hash element
|
|
75
|
+
# Return value :
|
|
76
|
+
# @hash_value : value of the key element
|
|
77
|
+
#
|
|
78
|
+
def traverse_hash(hash_val, req_key)
|
|
79
|
+
hash_val.each do |key, value|
|
|
80
|
+
traverse_hash(value, req_key) if !value.nil? and value.size >= 1 and value.class.to_s == "Hash"
|
|
81
|
+
if key == req_key
|
|
82
|
+
@hash_value = value
|
|
83
|
+
break
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
return @hash_value
|
|
87
|
+
rescue Exception => ex
|
|
88
|
+
$log.error("Error in traversing hash '#{hash_val}' for '#{req_key}' : #{ex}")
|
|
89
|
+
exit
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Description : traverses the yml file and gets the value for the given input ypath
|
|
93
|
+
# Author : Chandra sekaran
|
|
94
|
+
# Arguments :
|
|
95
|
+
# str_ypath : ypath of the key element
|
|
96
|
+
# Return value :
|
|
97
|
+
# str_value : value of the key element
|
|
98
|
+
#
|
|
99
|
+
def traverse_yml(str_ypath)
|
|
100
|
+
str_value = ''
|
|
101
|
+
arr_key = str_ypath.split('/')
|
|
102
|
+
num_level = arr_key.size
|
|
103
|
+
|
|
104
|
+
case num_level
|
|
105
|
+
when 1
|
|
106
|
+
str_value = @yml[arr_key[0]]
|
|
107
|
+
when 2
|
|
108
|
+
str_value = @yml[arr_key[0]][arr_key[1]]
|
|
109
|
+
when 3
|
|
110
|
+
str_value = @yml[arr_key[0]][arr_key[1]][arr_key[2]]
|
|
111
|
+
when 4
|
|
112
|
+
str_value = @yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]]
|
|
113
|
+
when 5
|
|
114
|
+
str_value = @yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]]
|
|
115
|
+
when 6
|
|
116
|
+
str_value = @yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]][arr_key[5]]
|
|
117
|
+
when 7
|
|
118
|
+
str_value = @yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]][arr_key[5]][arr_key[6]]
|
|
119
|
+
else
|
|
120
|
+
raise "Given YML path cannot be traversed"
|
|
121
|
+
end
|
|
122
|
+
return str_value
|
|
123
|
+
rescue Exception => ex
|
|
124
|
+
$log.error("Error in traverse_yml '#{str_ypath}' : #{ex}")
|
|
125
|
+
exit
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Description : returns the profile name that is currently available
|
|
129
|
+
# Author : Chandra sekaran
|
|
130
|
+
# Arguments :
|
|
131
|
+
# str_box : profile name whether development/test
|
|
132
|
+
# Return value :
|
|
133
|
+
# str_key : key name of the profile
|
|
134
|
+
#
|
|
135
|
+
def get_specific_profile(str_box)
|
|
136
|
+
str_key = ""
|
|
137
|
+
# iterates through the @yml content to find the BOX key and reads the value of :in_use key and returns the key
|
|
138
|
+
# if its value is "no"
|
|
139
|
+
@yml.each do |key, value|
|
|
140
|
+
value.each do |k, v|
|
|
141
|
+
if k.downcase == BOX.downcase
|
|
142
|
+
v.each do |k1, v1|
|
|
143
|
+
if k1.downcase.include? str_box.downcase
|
|
144
|
+
v1.each do |k2, v2|
|
|
145
|
+
if k2.downcase.include? "in_use"
|
|
146
|
+
if v2.downcase == "no"
|
|
147
|
+
str_key = k1
|
|
148
|
+
set_value("application/#{BOX}/#{str_key}/in_use", "yes") # updates the key values to "yes"
|
|
149
|
+
change_execution_count("environment/parallel_execution_count", get_value("application/#{BOX}/#{str_key}/in_use"))
|
|
150
|
+
break
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
break if str_key != ""
|
|
155
|
+
end
|
|
156
|
+
break if str_key != ""
|
|
157
|
+
end
|
|
158
|
+
break if str_key != ""
|
|
159
|
+
end
|
|
160
|
+
break if str_key != ""
|
|
161
|
+
end
|
|
162
|
+
break if str_key != ""
|
|
163
|
+
end
|
|
164
|
+
raise "All the profiles (for Login credentials) are in use and hence stopping the execution for #{BOX}/#{str_box}" if str_key == ""
|
|
165
|
+
$log.info("Currently using '#{str_key}' under '#{str_box}' profile under '#{BOX}' box")
|
|
166
|
+
str_key
|
|
167
|
+
rescue Exception => ex
|
|
168
|
+
$log.error("Error in getting free BOX config values : #{ex}")
|
|
169
|
+
exit
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Description : returns the box and profile names that is currently available
|
|
173
|
+
# Author : Chandra sekaran
|
|
174
|
+
# Arguments :
|
|
175
|
+
# str_box : profile name whether development/test
|
|
176
|
+
# Return value :
|
|
177
|
+
# str_box : key name of the box
|
|
178
|
+
# str_key : key name of the profile
|
|
179
|
+
#
|
|
180
|
+
def get_any_profile(str_box)
|
|
181
|
+
str_key = ""
|
|
182
|
+
str_box_avail = ""
|
|
183
|
+
# iterates through the @yml content to find the BOX key and reads the value of :in_use key and returns the key
|
|
184
|
+
# if its value is "no"
|
|
185
|
+
@yml.each do |key, value|
|
|
186
|
+
value.each do |k, v|
|
|
187
|
+
str_box_avail = k
|
|
188
|
+
v.each do |k1, v1|
|
|
189
|
+
if k1.downcase.include? str_box.downcase
|
|
190
|
+
v1.each do |k2, v2|
|
|
191
|
+
if k2.downcase.include? "in_use"
|
|
192
|
+
if v2.downcase == "no"
|
|
193
|
+
str_key = k1
|
|
194
|
+
set_value("application/#{str_box_avail}/#{str_key}/in_use", "yes") # updates the key values to "yes"
|
|
195
|
+
change_execution_count("environment/parallel_execution_count", get_value("application/#{str_box_avail}/#{str_key}/in_use"))
|
|
196
|
+
break
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
break if str_key != ""
|
|
200
|
+
end
|
|
201
|
+
#break if str_key != ""
|
|
202
|
+
end
|
|
203
|
+
break if str_key != ""
|
|
204
|
+
end
|
|
205
|
+
break if str_key != ""
|
|
206
|
+
end
|
|
207
|
+
break if str_key != ""
|
|
208
|
+
end
|
|
209
|
+
raise "All the profiles (for Login credentials) are in use and hence stopping the execution for #{str_box}" if str_key == ""
|
|
210
|
+
$log.info("Currently using '#{str_key}' under '#{str_box}' profile under '#{str_box_avail}' box")
|
|
211
|
+
return str_box_avail, str_key
|
|
212
|
+
rescue Exception => ex
|
|
213
|
+
$log.error("Error in getting free PROFILE config values : #{ex}")
|
|
214
|
+
exit
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Description : updates the parallel execution counter in config.yml file
|
|
218
|
+
# Author : Gomathi
|
|
219
|
+
# Arguments :
|
|
220
|
+
# str_ypath : ypath of yml content
|
|
221
|
+
# str_value : boolean value to update the counter
|
|
222
|
+
#
|
|
223
|
+
def change_execution_count(str_ypath, str_value)
|
|
224
|
+
if str_value.downcase == "yes"
|
|
225
|
+
set_value(str_ypath, get_value(str_ypath) + 1)
|
|
226
|
+
else
|
|
227
|
+
set_value(str_ypath, get_value(str_ypath) - 1)
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Description : sets the value for the given ypath
|
|
232
|
+
# Author : Chandra sekaran
|
|
233
|
+
# Arguments :
|
|
234
|
+
# str_ypath : ypath of yml content
|
|
235
|
+
# Return value :
|
|
236
|
+
# str_value : value to be set for ypath
|
|
237
|
+
#
|
|
238
|
+
def set_value(str_ypath, str_value = "")
|
|
239
|
+
raise "Exception : ReadFromYML - ypath cannot be empty" if str_ypath.nil?
|
|
240
|
+
|
|
241
|
+
@yml = open_yml_file(@yml_file_path)
|
|
242
|
+
|
|
243
|
+
arr_key = str_ypath.split('/')
|
|
244
|
+
num_level = arr_key.size
|
|
245
|
+
|
|
246
|
+
case num_level
|
|
247
|
+
when 1
|
|
248
|
+
@yml[arr_key[0]] = str_value
|
|
249
|
+
when 2
|
|
250
|
+
@yml[arr_key[0]][arr_key[1]] = str_value
|
|
251
|
+
when 3
|
|
252
|
+
@yml[arr_key[0]][arr_key[1]][arr_key[2]] = str_value
|
|
253
|
+
when 4
|
|
254
|
+
@yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]] = str_value
|
|
255
|
+
when 5
|
|
256
|
+
@yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]] = str_value
|
|
257
|
+
when 6
|
|
258
|
+
@yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]][arr_key[5]] = str_value
|
|
259
|
+
when 7
|
|
260
|
+
@yml[arr_key[0]][arr_key[1]][arr_key[2]][arr_key[3]][arr_key[4]][arr_key[5]][arr_key[6]] = str_value
|
|
261
|
+
else
|
|
262
|
+
raise "Given YML path cannot be traversed"
|
|
263
|
+
end
|
|
264
|
+
File.open(@yml_file_path, 'w') { |h| h.write @yml.to_yaml } # updates the yml file content with the updated hash
|
|
265
|
+
@yml = open_yml_file(@yml_file_path)
|
|
266
|
+
rescue Exception => ex
|
|
267
|
+
$log.error("Error in setting value for ypath '#{str_ypath}' : #{ex}")
|
|
268
|
+
exit
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Description : resets all the unused profiles
|
|
272
|
+
# Author : Chandra sekaran
|
|
273
|
+
#
|
|
274
|
+
def release_all_profiles
|
|
275
|
+
@yml.each do |key, value|
|
|
276
|
+
if key.downcase == "application"
|
|
277
|
+
value.each do |k, v|
|
|
278
|
+
v.each do |k1, v1|
|
|
279
|
+
v1.each do |k2, v2|
|
|
280
|
+
if k2.downcase.include? "in_use"
|
|
281
|
+
set_value("#{key}/#{k}/#{k1}/#{k2}", "no") if v2.downcase == "yes" # set "no" to in_use key for all profiles
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
rescue Exception => ex
|
|
289
|
+
$log.error("Error in releasing all profiles : #{ex}")
|
|
290
|
+
exit
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
end
|
|
294
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
*Name : ObjectRepository
|
|
3
|
+
*Description : module that holds the desktop web page object definitions
|
|
4
|
+
*Author : Chandra sekaran
|
|
5
|
+
*Creation Date : 08/05/2015
|
|
6
|
+
*Modification Date:
|
|
7
|
+
=end
|
|
8
|
+
|
|
9
|
+
module CUKES
|
|
10
|
+
module ObjectRepository
|
|
11
|
+
|
|
12
|
+
# object repository for desktop Google page
|
|
13
|
+
module OR_DesktopGoogle
|
|
14
|
+
include PageObject
|
|
15
|
+
|
|
16
|
+
text_field(:textfield_search, :name => "q")
|
|
17
|
+
button(:button_search, :name => "btnG")
|
|
18
|
+
div(:div_result, :id => "search")
|
|
19
|
+
link(:link_bet365, :href => "http://www.bet365.com/")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# object repository for desktop Rubygems page
|
|
23
|
+
module OR_RubyGems
|
|
24
|
+
include PageObject
|
|
25
|
+
|
|
26
|
+
# home page objects
|
|
27
|
+
div(:div_header_image, :xpath => "html/body/div/div[1]")
|
|
28
|
+
|
|
29
|
+
link(:link_signin, :href => "/sign_in")
|
|
30
|
+
text_field(:textfield_email, :id => "session_who")
|
|
31
|
+
text_field(:textfield_password, :id => "session_password")
|
|
32
|
+
button(:button_sign_in, :class => "form__submit")
|
|
33
|
+
link(:link_menu, :class => "header__popup-link")
|
|
34
|
+
link(:link_signout, :href => "/sign_out")
|
|
35
|
+
text_field(:input_search, :id => "query")
|
|
36
|
+
|
|
37
|
+
# gem list page objects
|
|
38
|
+
h1(:h1_title, :xpath => "//h1[contains(@class,'page__heading')]")
|
|
39
|
+
div(:div_search_result, :class => "l-wrap--b")
|
|
40
|
+
|
|
41
|
+
# gem description page objects
|
|
42
|
+
text_fields(:textfield_gem_install, :xpath => "//div[@class='gem__code-wrap']/input")
|
|
43
|
+
pre(:pre_gemfile, :xpath => "//div[@class='bundler']/pre")
|
|
44
|
+
div(:div_gem_version, :class => "versions")
|
|
45
|
+
div(:div_gem_runtime_dependencies, :id => "runtime_dependencies")
|
|
46
|
+
div(:div_gem_ruby_dependencies, :id => "ruby_dependency")
|
|
47
|
+
div(:div_gem_development_dependencies, :id => "development_dependencies")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
*Name : ObjectRepository
|
|
3
|
+
*Description : module that holds the mobile web page object definitions
|
|
4
|
+
*Author : Chandra sekaran
|
|
5
|
+
*Creation Date : 08/05/2015
|
|
6
|
+
*Modification Date:
|
|
7
|
+
=end
|
|
8
|
+
|
|
9
|
+
module CUKES
|
|
10
|
+
module ObjectRepository
|
|
11
|
+
|
|
12
|
+
# object repository for mobile Google page
|
|
13
|
+
module OR_MobileGoogle
|
|
14
|
+
include PageObject
|
|
15
|
+
|
|
16
|
+
text_field(:textfield_search, :name => "q")
|
|
17
|
+
button(:button_search, :name => "btnG")
|
|
18
|
+
div(:div_result, :id => "main")
|
|
19
|
+
link(:link_rubygems, :href => "https://rubygems.org/")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
*Name : Gem Search
|
|
3
|
+
*Description : class that holds the Gem page objects and method definitions
|
|
4
|
+
*Author : Chandra sekaran
|
|
5
|
+
*Creation Date : 24/04/2015
|
|
6
|
+
*Modification Date:
|
|
7
|
+
=end
|
|
8
|
+
|
|
9
|
+
module CUKES
|
|
10
|
+
class RubyGems
|
|
11
|
+
include PageObject
|
|
12
|
+
include PageUtils
|
|
13
|
+
include FileLibrary
|
|
14
|
+
include ObjectRepository::OR_RubyGems
|
|
15
|
+
|
|
16
|
+
# Description : invoked automatically when the page class object is created
|
|
17
|
+
# Author : Chandra sekaran
|
|
18
|
+
#
|
|
19
|
+
def initialize_page
|
|
20
|
+
wait_for_page_load
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Description : sign into the application
|
|
24
|
+
# Author : Chandra sekaran
|
|
25
|
+
#
|
|
26
|
+
def sign_in
|
|
27
|
+
click_on(link_signin_element)
|
|
28
|
+
wait_for_object(textfield_email_element, "Could not find textfield Email")
|
|
29
|
+
self.textfield_email = USER_NAME # "profchan2k15@gmail.com"
|
|
30
|
+
self.textfield_password = PASSWORD # "chan123@1"
|
|
31
|
+
click_on(button_sign_in_element)
|
|
32
|
+
wait_for_page_load
|
|
33
|
+
#raise "Error in sign in" if !is_text_present(self, "CHAN90", 120)
|
|
34
|
+
$log.success("Sign in successful")
|
|
35
|
+
rescue Exception => ex
|
|
36
|
+
$log.error("Failure while signing in : #{ex}")
|
|
37
|
+
exit
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Description : sign out from the application
|
|
41
|
+
# Author : Chandra sekaran
|
|
42
|
+
#
|
|
43
|
+
def sign_out
|
|
44
|
+
click_on(link_menu_element)
|
|
45
|
+
click_on(link_signout_element)
|
|
46
|
+
#raise "Error in sign out" if !is_text_present(self, "Sign in", 120)
|
|
47
|
+
$log.success("Sign out successful")
|
|
48
|
+
rescue Exception => ex
|
|
49
|
+
$log.error("Failure while signing out : #{ex}")
|
|
50
|
+
exit
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Description : searches for the given input gem name
|
|
54
|
+
# Author : Chandra sekaran
|
|
55
|
+
# Arguments :
|
|
56
|
+
# gem_name : name of the gem
|
|
57
|
+
# str_data_node : test data root node name
|
|
58
|
+
#
|
|
59
|
+
def search_for_gem(gem_name = "", str_data_node = "gems")
|
|
60
|
+
if gem_name == ""
|
|
61
|
+
# the set_scenario_based_datafile method sets the test data content from the given input file name
|
|
62
|
+
# present in library/app_specific/datafile_names.rb
|
|
63
|
+
# the yml file can be :
|
|
64
|
+
# * a local data file - inside the current feature name directory
|
|
65
|
+
# * a global data file - inside desktop directory
|
|
66
|
+
hash_gem_name = set_scenario_based_datafile(GEM_NAME)
|
|
67
|
+
gem_name = hash_gem_name[str_data_node]["gem_name"]
|
|
68
|
+
end
|
|
69
|
+
wait_for_object(input_search_element, "Could not find search textbox")
|
|
70
|
+
self.input_search = gem_name
|
|
71
|
+
input_search_element.send_keys(:enter)
|
|
72
|
+
rescue Exception => ex
|
|
73
|
+
$log.error("Failure while searching for gem '#{gem_name}' : #{ex}")
|
|
74
|
+
exit
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Description : compares the gem header name
|
|
78
|
+
# Author : Chandra sekaran
|
|
79
|
+
# Argument :
|
|
80
|
+
# gem_name : name of the gem
|
|
81
|
+
#
|
|
82
|
+
def compare_heading(gem_name)
|
|
83
|
+
wait_for_object(h1_title_element)
|
|
84
|
+
expected_heading = "search for #{gem_name}"
|
|
85
|
+
actual_heading = h1_title_element.text
|
|
86
|
+
raise "The expected heading is #{expected_heading} but actual heading is #{actual_heading}" if actual_heading != expected_heading
|
|
87
|
+
wait_for_object(div_search_result_element, "Could not find gem result list")
|
|
88
|
+
raise "No gems found for the given gem" if div_search_result_element.text.include?("No gems found")
|
|
89
|
+
rescue Exception => ex
|
|
90
|
+
$log.error("Failure while comparing Gem header for gem '#{gem_name}' : #{ex}")
|
|
91
|
+
exit
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Description : searches for the specific gem and selects it
|
|
95
|
+
# Author : Chandra sekaran
|
|
96
|
+
#
|
|
97
|
+
def fetch_desired_gem
|
|
98
|
+
gem_object = ""
|
|
99
|
+
gem_name = ""
|
|
100
|
+
max = 0
|
|
101
|
+
div_search_result_element.link_elements(:xpath => "./a").each do |parent|
|
|
102
|
+
current = parent.paragraph_element(:xpath => "./p").text
|
|
103
|
+
current = current.gsub!(',','').to_i if current.include?(',')
|
|
104
|
+
if max < current.to_i
|
|
105
|
+
max = current.to_i
|
|
106
|
+
gem_object = parent.strong_element(:xpath => "./div/h2")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
gem_name = gem_object.text
|
|
110
|
+
gem_object.click
|
|
111
|
+
gem_name
|
|
112
|
+
rescue Exception => ex
|
|
113
|
+
$log.error("Failure while getting desired gem : #{ex}")
|
|
114
|
+
exit
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Description : fetches the gem details
|
|
118
|
+
# Author : Chandra sekaran
|
|
119
|
+
# Argument :
|
|
120
|
+
# gem : name of the gem
|
|
121
|
+
#
|
|
122
|
+
def fetch_gem_details(gem)
|
|
123
|
+
wait_for_object(h1_title_element)
|
|
124
|
+
|
|
125
|
+
gem_name, gem_version = split_gem_and_version(gem)
|
|
126
|
+
gem_heading = gem_name + " " + gem_version
|
|
127
|
+
raise "The expected value is '#{gem_heading}' but the actual value is '#{h1_title_element.text}'" if h1_title_element.text != gem_heading
|
|
128
|
+
|
|
129
|
+
$log.info "Gem Description"
|
|
130
|
+
$log.info "\tGem Name : #{h1_title_element.text}"
|
|
131
|
+
$log.info "\tGem install : #{textfield_gem_install_elements.last.value}"
|
|
132
|
+
$log.info "\tGemfile : #{textfield_gem_install_elements.first.value}"
|
|
133
|
+
|
|
134
|
+
fetch_gem_versions
|
|
135
|
+
fetch_gem_runtime_dependencies
|
|
136
|
+
fetch_gem_ruby_dependencies
|
|
137
|
+
fetch_gem_development_dependencies
|
|
138
|
+
rescue Exception => ex
|
|
139
|
+
$log.error("Failure while fetching Gem details for gem '#{gem_name}' : #{ex}")
|
|
140
|
+
exit
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Description : fetches the gem version
|
|
144
|
+
# Author : Chandra sekaran
|
|
145
|
+
#
|
|
146
|
+
def fetch_gem_versions
|
|
147
|
+
$log.info "Versions"
|
|
148
|
+
fetch_list_items(div_gem_version_element)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Description : fetches the gem runtime dependencies
|
|
152
|
+
# Author : Chandra sekaran
|
|
153
|
+
#
|
|
154
|
+
def fetch_gem_runtime_dependencies
|
|
155
|
+
$log.info "Runtime Dependencies"
|
|
156
|
+
fetch_list_items(div_gem_runtime_dependencies_element)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Description : fetches the gem ruby dependencies
|
|
160
|
+
# Author : Chandra sekaran
|
|
161
|
+
#
|
|
162
|
+
def fetch_gem_ruby_dependencies
|
|
163
|
+
$log.info "Ruby Dependency"
|
|
164
|
+
fetch_list_items(div_gem_ruby_dependencies_element)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Description : fetches the gem development dependencies
|
|
168
|
+
# Author : Chandra sekaran
|
|
169
|
+
#
|
|
170
|
+
def fetch_gem_development_dependencies
|
|
171
|
+
$log.info "Ruby Dependency"
|
|
172
|
+
fetch_list_items(div_gem_development_dependencies_element)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Description : fetches the text under list of elements
|
|
176
|
+
# Author : Chandra sekaran
|
|
177
|
+
# Argument :
|
|
178
|
+
# parent_element : parent element object
|
|
179
|
+
#
|
|
180
|
+
def fetch_list_items(parent_element)
|
|
181
|
+
if parent_element.exists? && parent_element.visible?
|
|
182
|
+
list_elements = ""
|
|
183
|
+
if parent_element.div_element(:xpath => "./div[@class='t-list__items']").exists?
|
|
184
|
+
list_elements = parent_element.link_elements(:xpath => "./div[@class='t-list__items']/a")
|
|
185
|
+
elsif parent_element.ordered_list_element(:xpath => "./ol").exists?
|
|
186
|
+
list_elements = parent_element.list_item_elements(:xpath => "./ol/li")
|
|
187
|
+
end
|
|
188
|
+
list_elements.each do |list|
|
|
189
|
+
$log.info "\t #{list.text}"
|
|
190
|
+
end
|
|
191
|
+
else
|
|
192
|
+
$log.info "\t No data found"
|
|
193
|
+
end
|
|
194
|
+
rescue Exception => ex
|
|
195
|
+
$log.error("Failure while fetching gem list items : #{ex}")
|
|
196
|
+
exit
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Description : splits gem name and its version from given input string
|
|
200
|
+
# Author : Chandra sekaran
|
|
201
|
+
# Argument :
|
|
202
|
+
# gem : gem name string with version
|
|
203
|
+
# Return Arguments :
|
|
204
|
+
# gem_name : gem name
|
|
205
|
+
# gem_version : gem version
|
|
206
|
+
#
|
|
207
|
+
def split_gem_and_version(gem)
|
|
208
|
+
gem_name = gem.split(" ").first
|
|
209
|
+
gem_version = gem.split(" ").last
|
|
210
|
+
return gem_name, gem_version
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|