oct-automation-utilities 0.0.0 → 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 +4 -4
- data/lib/oct-automation-utilities.rb +13 -42
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af63360234d3b62463c6a1fffa0e72c64256a6a7
|
4
|
+
data.tar.gz: 6b4cf766e2e2c559f2e20861505959a2af884cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec919a858700cffd69219979d5c2798b9db1733944d34f3397b10ad5a3929cdd89894fd2cd622df0523f1022a61db55f53e677833a754412506b96673a7be822
|
7
|
+
data.tar.gz: 0a96d0a558a20b414d80c43c69b4de5ba76b376f4c42ba4f3bc353097bedc957981c45d04eba95e7f4b999e1ea310835f0e0f437b9a20c7b5e1916b359f088b8
|
@@ -72,18 +72,18 @@ module OctAutomationUtilities
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def create_results_folder
|
75
|
-
|
76
|
-
#Dir.mkdir("#{self.project_directory}/results")
|
75
|
+
Dir.mkdir("#{self.project_directory}/results")
|
77
76
|
end
|
78
77
|
|
79
78
|
def create_test_folder(test_name)
|
80
|
-
|
79
|
+
puts "create_test_folder #{self.project_directory}/results/#{test_name}"
|
80
|
+
Dir.mkdir("#{self.project_directory}/results/#{test_name}")
|
81
81
|
end
|
82
82
|
|
83
83
|
def create_time_results_folder(test_name)
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
unless File.exists?("#{self.project_directory}/results/#{test_name}/#{self.test_time}")
|
85
|
+
Dir.mkdir("#{self.project_directory}/results/#{test_name}/#{self.test_time}")
|
86
|
+
end
|
87
87
|
end
|
88
88
|
|
89
89
|
def get_time
|
@@ -107,10 +107,10 @@ module OctAutomationUtilities
|
|
107
107
|
msgx = "#{$test}/#{$step_num.to_s}-#{msg.to_s}"
|
108
108
|
if status == 'fail'
|
109
109
|
self.log "failed screenshot name: #{msgx}", "fatal"
|
110
|
-
|
110
|
+
page.driver.save_screenshot("#{msgx[0,101].to_s}-#{status}.png")
|
111
111
|
else
|
112
112
|
self.log "screenshot name: #{msgx}", "debug"
|
113
|
-
|
113
|
+
page.driver.save_screenshot("#{msgx[0,101].to_s}.png")
|
114
114
|
end
|
115
115
|
$step_num = ($step_num + 1)
|
116
116
|
end
|
@@ -146,9 +146,9 @@ module OctAutomationUtilities
|
|
146
146
|
def close_all_windows
|
147
147
|
current_windows = page.driver.browser.window_handles
|
148
148
|
current_windows.each do |window_name|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
page.within_window window_name do
|
150
|
+
page.execute_script "window.close()"
|
151
|
+
end
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
@@ -157,7 +157,7 @@ module OctAutomationUtilities
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def get_project_directory
|
160
|
-
File.expand_path('../../../',
|
160
|
+
File.expand_path('../../../', __FILE__)
|
161
161
|
end
|
162
162
|
|
163
163
|
def unique_id
|
@@ -168,14 +168,10 @@ module OctAutomationUtilities
|
|
168
168
|
dat
|
169
169
|
end
|
170
170
|
|
171
|
-
#Author : Venkat
|
172
|
-
#Description: To click_ok_message
|
173
171
|
def click_ok_msgbox
|
174
172
|
page.driver.browser.switch_to.alert.accept
|
175
|
-
#@utilities.capture_screen_shot('Clicked Ok Confirm message box')
|
176
173
|
end
|
177
174
|
|
178
|
-
#Author: Murali Kunda
|
179
175
|
#Description: retrieve row number for the given text in a column
|
180
176
|
def retrieve_row_number(table_index,column='',text_to_verify)
|
181
177
|
row_number = 1
|
@@ -183,11 +179,6 @@ module OctAutomationUtilities
|
|
183
179
|
source = page.evaluate_script("document.getElementsByTagName('table')[#{table_index}].innerHTML")
|
184
180
|
doc = Nokogiri::HTML(source)
|
185
181
|
doc.css('tr').each do |row|
|
186
|
-
#row_content=row.xpath("./td[#{column.to_i}]").text
|
187
|
-
#row_content=row_content.gsub(/\s+/,'').squeeze('').strip
|
188
|
-
#row_content=row_content.squish
|
189
|
-
|
190
|
-
# if row.xpath("./td[#{column.to_i}]").text.gsub(/\s+/,'').squeeze('').strip == text_to_verify
|
191
182
|
if row.xpath("./td[#{column.to_i}]").text == text_to_verify
|
192
183
|
text_check = true
|
193
184
|
break
|
@@ -202,7 +193,6 @@ module OctAutomationUtilities
|
|
202
193
|
|
203
194
|
end
|
204
195
|
|
205
|
-
#Author: Murali Kunda
|
206
196
|
#Description: retrieve row text of a given row and column, row number starts from 0
|
207
197
|
def retrieve_cell_content(table_index,column,row_num)
|
208
198
|
row_number = 0
|
@@ -225,7 +215,6 @@ module OctAutomationUtilities
|
|
225
215
|
end
|
226
216
|
end
|
227
217
|
|
228
|
-
#Author: Murali Kunda
|
229
218
|
def browser_launch(bro, url)
|
230
219
|
if bro.upcase =='IE'
|
231
220
|
Capybara.register_driver :ie do |app|
|
@@ -247,19 +236,16 @@ module OctAutomationUtilities
|
|
247
236
|
self.log("Browser #{bro} launched with url #{url}", 'info')
|
248
237
|
end
|
249
238
|
|
250
|
-
#Author: Aravind
|
251
239
|
#Description: waits until given text appears on the page
|
252
240
|
def wait_until_text_appears(content)
|
253
241
|
page.has_content?(content)
|
254
242
|
end
|
255
243
|
|
256
|
-
#Author:Venkat
|
257
244
|
#Desc:moves the scroll bar position
|
258
245
|
def scroll(scroll_position)
|
259
246
|
page.execute_script "window.scrollBy(0,#{scroll_position})"
|
260
247
|
end
|
261
248
|
|
262
|
-
#Author: Nick Robertson
|
263
249
|
#Confirm pop up contains proper message
|
264
250
|
def confirm_popup_message(message, response = 'no')
|
265
251
|
a = page.driver.browser.switch_to.alert.text
|
@@ -276,12 +262,11 @@ module OctAutomationUtilities
|
|
276
262
|
end
|
277
263
|
end
|
278
264
|
|
279
|
-
#
|
265
|
+
#Description : Click on OK button on pop-up
|
280
266
|
def click_on_ok_popup
|
281
267
|
page.driver.browser.switch_to.alert.accept
|
282
268
|
end
|
283
269
|
|
284
|
-
#Author: Murali Kunda
|
285
270
|
#Desc: Verifies content of the text and returns true or false. This method is different from Verify_page_content. Verify_page_content fails and exits test if
|
286
271
|
#expected content is not visible. This method returns false when content is not visible and continue to the next step
|
287
272
|
def is_content_visible(content)
|
@@ -291,7 +276,6 @@ module OctAutomationUtilities
|
|
291
276
|
return page.has_content?(self.obj_expected_page_content)
|
292
277
|
end
|
293
278
|
|
294
|
-
#Author: Murali Kunda
|
295
279
|
def is_checked(attribute = 'name', obj)
|
296
280
|
if page.all("[#{attribute}^='#{obj}'][checked]").count > 0
|
297
281
|
return true
|
@@ -312,7 +296,6 @@ module OctAutomationUtilities
|
|
312
296
|
end
|
313
297
|
end
|
314
298
|
|
315
|
-
#Author:venkat
|
316
299
|
#Desc:changed the default wait time(2) to the wait time passing through parameter
|
317
300
|
def set_default_wait_time(wait_time)
|
318
301
|
if wait_time !=''
|
@@ -320,7 +303,6 @@ module OctAutomationUtilities
|
|
320
303
|
end
|
321
304
|
end
|
322
305
|
|
323
|
-
#Author: Murali Kunda
|
324
306
|
def read_servers(app_name)
|
325
307
|
#loading milestones objects yaml file
|
326
308
|
objs = YAML.load(File.read('servers_map.yml'))
|
@@ -342,9 +324,6 @@ module OctAutomationUtilities
|
|
342
324
|
end
|
343
325
|
end
|
344
326
|
|
345
|
-
|
346
|
-
|
347
|
-
# Author: Mike Nelson
|
348
327
|
# compare_strings compares two strings, as when verifying on-screen content.
|
349
328
|
# Logs results, throws exception when false.
|
350
329
|
# Returns true when strings match, false when they do not.
|
@@ -367,42 +346,36 @@ module OctAutomationUtilities
|
|
367
346
|
end
|
368
347
|
end
|
369
348
|
|
370
|
-
# Author: Aaron Tracy
|
371
349
|
# Verify the text passed in is located on the page.
|
372
350
|
def verify_page_contains_text(text_to_verify)
|
373
351
|
log("Verify page has text: #{text_to_verify}")
|
374
352
|
page.has_xpath?(".//*[contains(*," + 34.chr + text_to_verify + 34.chr + ")]") ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{text_to_verify} on the page.")
|
375
353
|
end
|
376
354
|
|
377
|
-
# Author: Aaron Tracy
|
378
355
|
# Verify the text passed in is located on the page.
|
379
356
|
def verify_page_contains_link(text_to_verify)
|
380
357
|
log("Verify page has link: #{text_to_verify}")
|
381
358
|
page.has_link?(text_to_verify) ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{text_to_verify} link on the page.")
|
382
359
|
end
|
383
360
|
|
384
|
-
# Author: Aaron Tracy
|
385
361
|
# Verify the text passed in is located on the page.
|
386
362
|
def verify_page_contains_button(text_to_verify)
|
387
363
|
log("Verify page has button: #{text_to_verify}")
|
388
364
|
page.has_button?(text_to_verify) ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{text_to_verify} button on the page.")
|
389
365
|
end
|
390
366
|
|
391
|
-
# Author: Aaron Tracy
|
392
367
|
# Verify the text passed in is located on the page.
|
393
368
|
def verify_page_contains_xpath(text_to_verify, description)
|
394
369
|
log("Verify page has xpath for: #{description}")
|
395
370
|
page.has_xpath?(text_to_verify) ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{description} on the page.")
|
396
371
|
end
|
397
372
|
|
398
|
-
# Author: Aaron Tracy
|
399
373
|
# Verify the text passed in is located on the page.
|
400
374
|
def verify_page_contains_xpath_with_text(xpath, text_to_verify)
|
401
375
|
log("Verify page has xpath for: #{text_to_verify}")
|
402
376
|
page.has_xpath?(xpath, :text => text_to_verify) ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{text_to_verify} on the page.")
|
403
377
|
end
|
404
378
|
|
405
|
-
# Author: Aaron Tracy
|
406
379
|
# Verify the field exists and contains the text. Description is simply the label of the control
|
407
380
|
def verify_page_contains_field(id_name_label, text, description)
|
408
381
|
log("Verify page has field for: #{description}")
|
@@ -410,7 +383,6 @@ module OctAutomationUtilities
|
|
410
383
|
#page.has_field?(id_name_label) ? true : raise(Capybara::ExpectationNotMet, "Couldn't locate #{description} on the page.")
|
411
384
|
end
|
412
385
|
|
413
|
-
# Author: Mike Nelson
|
414
386
|
# set_checkbox checks or unchecks a checkbox using its ID, name, or label text. It logs its results, and
|
415
387
|
# does not care whether the box is initially checked or unchecked.
|
416
388
|
# Logs results. Returns true when
|
@@ -445,7 +417,6 @@ module OctAutomationUtilities
|
|
445
417
|
return(true)
|
446
418
|
end
|
447
419
|
|
448
|
-
# Author: Mike Nelson
|
449
420
|
# string_is_numeric? returns true if the string only contains digits,
|
450
421
|
# or false if there is anything else in the string, even + or -, or a decimal.
|
451
422
|
# It uses regular expression evaluation. I ripped this off from this web site:
|