awetestlib 0.1.29-x86-mingw32 → 0.1.30pre1-x86-mingw32
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.
- data/.gitignore +1 -0
- data/bin/awetestlib +18 -3
- data/bin/awetestlib-helpers.rb +19 -0
- data/images/netbeans1.jpg +0 -0
- data/images/netbeans2.jpg +0 -0
- data/images/netbeans3.jpg +0 -0
- data/images/netbeans4.jpg +0 -0
- data/images/netbeans5.jpg +0 -0
- data/images/rubymine1.jpg +0 -0
- data/images/rubymine2.jpg +0 -0
- data/images/rubymine3.jpg +0 -0
- data/images/rubymine4.jpg +0 -0
- data/images/scripting1.png +0 -0
- data/images/scripting2.png +0 -0
- data/images/scripting3.png +0 -0
- data/images/scripting4.png +0 -0
- data/lib/awetestlib.rb +5 -5
- data/lib/awetestlib/html_report.rb +74 -43
- data/lib/awetestlib/logging.rb +6 -6
- data/lib/awetestlib/regression/browser.rb +37 -30
- data/lib/awetestlib/regression/drag_and_drop.rb +4 -3
- data/lib/awetestlib/regression/runner.rb +44 -44
- data/lib/awetestlib/regression/tables.rb +17 -9
- data/lib/awetestlib/regression/user_input.rb +1 -1
- data/lib/awetestlib/regression/utilities.rb +69 -11
- data/lib/awetestlib/regression/validations.rb +84 -65
- data/lib/awetestlib/runner.rb +1 -1
- data/lib/version.rb +2 -2
- data/netbeans_setup.md +6 -6
- data/rubymine_setup.md +5 -5
- data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +1 -1
- data/test/demo_wwd.rb +7 -0
- metadata +27 -9
@@ -2,7 +2,7 @@ module Awetestlib
|
|
2
2
|
module Regression
|
3
3
|
# Methods for moving and resizing elements, manipulating the mouse, and checking for relative positioning of elements,
|
4
4
|
# including overlap, overlay, etc.
|
5
|
-
# @note Still experimental. Works with IE but not fully tested with Firefox or Chrome in Windows.
|
5
|
+
# @note Still experimental. Works with IE but not fully tested with Firefox or Chrome in Windows using Watir-webdriver.
|
6
6
|
# Not compatible with Mac
|
7
7
|
# Rdoc is work in progress
|
8
8
|
module DragAndDrop
|
@@ -284,8 +284,9 @@ module Awetestlib
|
|
284
284
|
[x, y, w, h]
|
285
285
|
end
|
286
286
|
|
287
|
-
def
|
287
|
+
def drag_and_drop_div(browser, how, what, delta_x, delta_y, desc = '')
|
288
288
|
#TODO: webdriver
|
289
|
+
#TODO: assumes element is div
|
289
290
|
msg = "Drag and drop element :#{how}=>#{what} by x=>#{delta_x} y=>#{delta_y}."
|
290
291
|
msg << " #{desc}" if desc.length > 0
|
291
292
|
drag_me = browser.div(how, what)
|
@@ -293,7 +294,7 @@ module Awetestlib
|
|
293
294
|
passed_to_log(msg)
|
294
295
|
true
|
295
296
|
rescue
|
296
|
-
failed_to_log(
|
297
|
+
failed_to_log(unable_to)
|
297
298
|
end
|
298
299
|
|
299
300
|
def drag_and_drop(x1, y1, dx, dy, speed=nil)
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require 'awetestlib/regression/browser'
|
2
|
-
require 'awetestlib/regression/find'
|
3
|
-
require 'awetestlib/regression/user_input'
|
4
|
-
require 'awetestlib/regression/waits'
|
5
|
-
require 'awetestlib/regression/tables'
|
6
|
-
require 'awetestlib/regression/page_data'
|
7
|
-
require 'awetestlib/regression/drag_and_drop'
|
8
|
-
require 'awetestlib/regression/utilities'
|
9
|
-
require 'awetestlib/regression/legacy'
|
10
|
-
require 'awetestlib/logging'
|
11
|
-
require 'awetestlib/regression/validations'
|
12
|
-
require 'awetestlib/html_report'
|
13
|
-
#require 'rbconfig'
|
14
|
-
require 'ostruct'
|
15
|
-
require 'active_support'
|
16
|
-
require 'active_support/inflector'
|
17
|
-
require 'sys/uname'
|
1
|
+
require 'awetestlib/regression/browser' #; load_time
|
2
|
+
require 'awetestlib/regression/find' #; load_time
|
3
|
+
require 'awetestlib/regression/user_input' #; load_time
|
4
|
+
require 'awetestlib/regression/waits' #; load_time
|
5
|
+
require 'awetestlib/regression/tables' #; load_time
|
6
|
+
require 'awetestlib/regression/page_data' #; load_time
|
7
|
+
require 'awetestlib/regression/drag_and_drop' #; load_time
|
8
|
+
require 'awetestlib/regression/utilities' #; load_time
|
9
|
+
require 'awetestlib/regression/legacy' #; load_time
|
10
|
+
require 'awetestlib/logging' #; load_time
|
11
|
+
require 'awetestlib/regression/validations' #; load_time
|
12
|
+
require 'awetestlib/html_report' #; load_time
|
13
|
+
#require 'rbconfig' #; load_time
|
14
|
+
require 'ostruct' #; load_time
|
15
|
+
require 'active_support' #; load_time
|
16
|
+
require 'active_support/inflector' #; load_time
|
17
|
+
require 'sys/uname' #; load_time
|
18
18
|
|
19
19
|
module Awetestlib
|
20
20
|
module Regression
|
@@ -22,19 +22,19 @@ module Awetestlib
|
|
22
22
|
class Runner < Awetestlib::Runner
|
23
23
|
|
24
24
|
# order matters here
|
25
|
-
include Sys
|
26
|
-
include ActiveSupport::Inflector
|
27
|
-
include Awetestlib::Logging
|
28
|
-
include Awetestlib::Regression::Utilities
|
29
|
-
include Awetestlib::Regression::Browser
|
30
|
-
include Awetestlib::Regression::Find
|
31
|
-
include Awetestlib::Regression::UserInput
|
32
|
-
include Awetestlib::Regression::Waits
|
33
|
-
include Awetestlib::Regression::Tables
|
34
|
-
include Awetestlib::Regression::PageData
|
35
|
-
include Awetestlib::Regression::DragAndDrop
|
36
|
-
include Awetestlib::Regression::Validations
|
37
|
-
include Awetestlib::Regression::Legacy
|
25
|
+
include Sys #; load_time('include Sys')
|
26
|
+
include ActiveSupport::Inflector #; load_time('include ActiveSupport::Inflector')
|
27
|
+
include Awetestlib::Logging #; load_time('include Awetestlib::Logging')
|
28
|
+
include Awetestlib::Regression::Utilities #; load_time('include Awetestlib::Regression::Utilities')
|
29
|
+
include Awetestlib::Regression::Browser #; load_time('include Awetestlib::Regression::Browser')
|
30
|
+
include Awetestlib::Regression::Find #; load_time('include Awetestlib::Regression::Find')
|
31
|
+
include Awetestlib::Regression::UserInput #; load_time('include Awetestlib::Regression::UserInput')
|
32
|
+
include Awetestlib::Regression::Waits #; load_time('include Awetestlib::Regression::Waits')
|
33
|
+
include Awetestlib::Regression::Tables #; load_time('include Awetestlib::Regression::Tables')
|
34
|
+
include Awetestlib::Regression::PageData #; load_time('include Awetestlib::Regression::PageData')
|
35
|
+
include Awetestlib::Regression::DragAndDrop #; load_time('include Awetestlib::Regression::DragAndDrop')
|
36
|
+
include Awetestlib::Regression::Validations #; load_time('include Awetestlib::Regression::Validations')
|
37
|
+
include Awetestlib::Regression::Legacy #; load_time('include Awetestlib::Regression::Legacy')
|
38
38
|
|
39
39
|
::DEBUG = 0
|
40
40
|
::INFO = 1
|
@@ -59,7 +59,7 @@ module Awetestlib
|
|
59
59
|
:environment, :environment_name, :environment_url, :environment_nodename,
|
60
60
|
:cycle, :browser_sequence,
|
61
61
|
:output_to_log, :log_path_subdir, :report_all_test_refs,
|
62
|
-
:timeout
|
62
|
+
:timeout, :classic_watir, :capture_load_times
|
63
63
|
|
64
64
|
#def self.build(options)
|
65
65
|
# #build_class = "Awetestlib::#{script_module_for options[:script_type]}::Runner".constantize
|
@@ -222,31 +222,31 @@ module Awetestlib
|
|
222
222
|
|
223
223
|
when 'IE'
|
224
224
|
if $watir_script
|
225
|
-
require 'watir/ie'
|
226
|
-
require 'watir'
|
227
|
-
require 'watir/process'
|
228
|
-
require 'watirloo'
|
229
|
-
require 'patches/watir'
|
225
|
+
require 'watir/ie' #; load_time
|
226
|
+
require 'watir' #; load_time
|
227
|
+
require 'watir/process' #; load_time
|
228
|
+
require 'watirloo' #; load_time
|
229
|
+
require 'patches/watir' #; load_time
|
230
230
|
Watir::IE.visible = true
|
231
231
|
else
|
232
|
-
require 'watir-webdriver'
|
232
|
+
require 'watir-webdriver' #; load_time
|
233
233
|
end
|
234
234
|
when 'FF'
|
235
|
-
require 'watir-webdriver'
|
235
|
+
require 'watir-webdriver' #; load_time
|
236
236
|
when 'S'
|
237
|
-
require 'watir-webdriver'
|
237
|
+
require 'watir-webdriver' #; load_time
|
238
238
|
|
239
239
|
when 'C', 'GC'
|
240
|
-
require 'watir-webdriver'
|
240
|
+
require 'watir-webdriver' #; load_time
|
241
241
|
|
242
242
|
# when 'CL'
|
243
|
-
# require 'celerity'
|
244
|
-
# require 'watir-webdriver'
|
243
|
+
# require 'celerity' #; load_time
|
244
|
+
# require 'watir-webdriver' #; load_timerequi
|
245
245
|
|
246
246
|
end
|
247
247
|
|
248
248
|
if USING_WINDOWS
|
249
|
-
require 'watir/win32ole'
|
249
|
+
require 'watir/win32ole' #; load_time
|
250
250
|
@ai = ::WIN32OLE.new('AutoItX3.Control')
|
251
251
|
else
|
252
252
|
# TODO: Need alternative for Mac?
|
@@ -254,7 +254,7 @@ module Awetestlib
|
|
254
254
|
end
|
255
255
|
|
256
256
|
if @xls_path
|
257
|
-
require 'roo'
|
257
|
+
require 'roo' #; load_time
|
258
258
|
end
|
259
259
|
|
260
260
|
end
|
@@ -112,8 +112,10 @@ module Awetestlib
|
|
112
112
|
# @param [Fixnum] column_index A number indicating which rows the column to focus the search in.
|
113
113
|
# When not supplied, the entire row is searched for *strg*.
|
114
114
|
# @param [Boolean] fail_if_found If true log a failure if *strg* _is_ found.
|
115
|
+
# @param [Fixnum] after_index Forces method to accept hit on *strg* only if it occurs
|
116
|
+
# after the row indicated by this argument. When omitted, the first hit is accepted.
|
115
117
|
# @return [Fixnum] the index of the row containing *strg*
|
116
|
-
def get_index_of_row_with_text(table, strg, column_index = nil, fail_if_found = false)
|
118
|
+
def get_index_of_row_with_text(table, strg, column_index = nil, fail_if_found = false, after_index = nil)
|
117
119
|
debug_to_log("#{__method__}: #{get_callers(5)}")
|
118
120
|
if fail_if_found
|
119
121
|
msg = 'No '
|
@@ -140,8 +142,13 @@ module Awetestlib
|
|
140
142
|
end
|
141
143
|
dbg << "\n#{index}. [#{text}]"
|
142
144
|
if text =~ /#{strg}/
|
143
|
-
|
144
|
-
|
145
|
+
if after_index and index > after_index
|
146
|
+
found = true
|
147
|
+
break
|
148
|
+
else
|
149
|
+
found = true
|
150
|
+
break
|
151
|
+
end
|
145
152
|
end
|
146
153
|
end
|
147
154
|
debug_to_log(dbg)
|
@@ -329,17 +336,18 @@ module Awetestlib
|
|
329
336
|
hit
|
330
337
|
end
|
331
338
|
|
332
|
-
def fetch_array_for_table_column(
|
333
|
-
ary
|
334
|
-
|
339
|
+
def fetch_array_for_table_column(table, column_index, start_row = 2)
|
340
|
+
ary = []
|
341
|
+
row_count = 0
|
342
|
+
table.each do |row|
|
343
|
+
row_count += 1
|
335
344
|
if get_cell_count(row) >= column_index
|
336
|
-
|
337
|
-
if row[1].text =~ /\d+/
|
345
|
+
if row_count >= start_row
|
338
346
|
ary << row[column_index].text
|
339
347
|
end
|
340
348
|
end
|
341
349
|
end
|
342
|
-
|
350
|
+
ary
|
343
351
|
end
|
344
352
|
|
345
353
|
def fetch_hash_for_table_column(table, column_index, start_row = 2)
|
@@ -487,7 +487,7 @@ module Awetestlib
|
|
487
487
|
# @param [String] desc Contains a message or description intended to appear in the log and/or report output. Required in this method.
|
488
488
|
# @param [String] valid_value The expected value of the text field, e.g., following reformatting.
|
489
489
|
# @return (see #click)
|
490
|
-
def set_text_field_and_validate(browser, how, what, value,
|
490
|
+
def set_text_field_and_validate(browser, how, what, value, valid_value = nil, desc ='')
|
491
491
|
#NOTE: use when value and valid_value differ as with dollar reformatting
|
492
492
|
if set_text_field(browser, how, what, value, desc, true)
|
493
493
|
expected = valid_value ? valid_value : value
|
@@ -59,6 +59,31 @@ module Awetestlib
|
|
59
59
|
msg
|
60
60
|
end
|
61
61
|
|
62
|
+
def get_date_names(date = Date.today)
|
63
|
+
this_month = date.month
|
64
|
+
if this_month == 12
|
65
|
+
next_month = 1
|
66
|
+
else
|
67
|
+
next_month = this_month + 1
|
68
|
+
end
|
69
|
+
if this_month == 1
|
70
|
+
prev_month = 12
|
71
|
+
else
|
72
|
+
prev_month = this_month - 1
|
73
|
+
end
|
74
|
+
|
75
|
+
month_arr = ['', 'January', 'February', 'March', 'April', 'May', 'June',
|
76
|
+
'July', 'August', 'September', 'October', 'November', 'December']
|
77
|
+
|
78
|
+
this_month_name = month_arr[this_month]
|
79
|
+
next_month_name = month_arr[next_month]
|
80
|
+
prev_month_name = month_arr[prev_month]
|
81
|
+
|
82
|
+
arr = [date.year, date.day, this_month_name, next_month_name, prev_month_name]
|
83
|
+
debug_to_log("#{__method__} #{nice_array(arr)}")
|
84
|
+
arr
|
85
|
+
end
|
86
|
+
|
62
87
|
def get_trace(lnbr)
|
63
88
|
callertrace = "\nCaller trace: (#{lnbr})\n"
|
64
89
|
Kernel.caller.each_index do |x|
|
@@ -286,14 +311,41 @@ module Awetestlib
|
|
286
311
|
else
|
287
312
|
new_arr = arr
|
288
313
|
end
|
289
|
-
"['#{new_arr.join("','")}']"
|
314
|
+
"['#{new_arr.join("', '")}']"
|
315
|
+
end
|
316
|
+
|
317
|
+
def nice_number(number, decimals = 0, dollars = false)
|
318
|
+
number.to_s.gsub!(/[,\$]/, '')
|
319
|
+
ptrn = "%0.#{decimals}f"
|
320
|
+
ptrn = '$' + ptrn if dollars
|
321
|
+
sprintf(ptrn, number).gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
|
290
322
|
end
|
291
323
|
|
324
|
+
def pad_date(dt)
|
325
|
+
if dt and dt.length > 0
|
326
|
+
a, d1, b, d2, c = dt.split(/([\/\.-])/)
|
327
|
+
a = a.rjust(2, '0') unless a and a.length > 1
|
328
|
+
b = b.rjust(2, '0') unless b and b.length > 1
|
329
|
+
c = c.rjust(2, '0') unless c and c.length > 1
|
330
|
+
a + d1 + b + d2 + c
|
331
|
+
else
|
332
|
+
''
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
292
336
|
def string_count_in_string(strg, substrg)
|
293
337
|
count = strg.scan(substrg).length
|
294
338
|
count
|
295
339
|
end
|
296
340
|
|
341
|
+
def strip_regex_mix(strg)
|
342
|
+
rslt = strg.dup
|
343
|
+
while match = rslt.match(/(\(\?-mix:(.+)\))/)
|
344
|
+
rslt.sub!(match[1], "/#{match[2]}/")
|
345
|
+
end
|
346
|
+
rslt
|
347
|
+
end
|
348
|
+
|
297
349
|
def rescue_me(e, me = nil, what = nil, where = nil, who = nil)
|
298
350
|
#TODO: these are rescues from exceptions raised in Watir/Firewatir
|
299
351
|
debug_to_log("#{__method__}: Begin rescue")
|
@@ -834,14 +886,10 @@ module Awetestlib
|
|
834
886
|
#method for handling file upload dialog
|
835
887
|
#use click_no_wait on the action that triggers the save dialog
|
836
888
|
# TODO need version for Firefox
|
837
|
-
def file_upload(filepath
|
838
|
-
|
839
|
-
title
|
840
|
-
text
|
841
|
-
button = "&Open"
|
842
|
-
control = "Edit1"
|
843
|
-
side = 'primary'
|
844
|
-
msg = "Window title=#{title} button='#{button}' text='#{text}' side='#{side}':"
|
889
|
+
def file_upload(filepath, title = 'Choose File', text = '', button = '&Open',
|
890
|
+
control = 'Edit1', side = 'primary')
|
891
|
+
title = translate_popup_title(title)
|
892
|
+
msg = "Window title=#{title} button='#{button}' text='#{text}' side='#{side}':"
|
845
893
|
begin
|
846
894
|
if @ai.WinWait(title, text, WAIT)
|
847
895
|
passed_to_log("#{msg} found.")
|
@@ -852,7 +900,10 @@ module Awetestlib
|
|
852
900
|
passed_to_log("#{msg} #{control} command sent.")
|
853
901
|
sleep_for 1
|
854
902
|
if @ai.ControlClick(title, text, button, "primary")
|
903
|
+
|
855
904
|
passed_to_log("#{msg} Upload of #{filepath} succeeded.")
|
905
|
+
|
906
|
+
|
856
907
|
else
|
857
908
|
failed_to_log("#{msg} Upload of #{filepath} failed. (#{__LINE__})")
|
858
909
|
end
|
@@ -938,10 +989,12 @@ module Awetestlib
|
|
938
989
|
debug_to_log("#{__method__}: #{method} #{$!}")
|
939
990
|
end
|
940
991
|
|
941
|
-
def unable_to(message = '', no_dolbang = false)
|
992
|
+
def unable_to(message = '', no_dolbang = false, verify_that = false)
|
942
993
|
call_arr = get_call_array()
|
943
994
|
call_script, call_line, call_meth = parse_caller(call_arr[1])
|
944
|
-
strg = "Unable to
|
995
|
+
strg = "Unable to"
|
996
|
+
strg << " verify" if verify_that
|
997
|
+
strg << " #{call_meth.titleize}:"
|
945
998
|
strg << " #{message}" if message.length > 0
|
946
999
|
strg << " '#{$!}'" unless no_dolbang
|
947
1000
|
strg
|
@@ -982,6 +1035,11 @@ module Awetestlib
|
|
982
1035
|
[arr.length, arr]
|
983
1036
|
end
|
984
1037
|
|
1038
|
+
def awetestlib?
|
1039
|
+
not Awetestlib::Runner.nil?
|
1040
|
+
rescue
|
1041
|
+
return false
|
1042
|
+
end
|
985
1043
|
|
986
1044
|
def get_os
|
987
1045
|
@os = OpenStruct.new(
|
@@ -23,18 +23,18 @@ module Awetestlib
|
|
23
23
|
msg = build_message("Expected Style #{type} value '#{expected}' in #{element} with #{how} = #{what}", desc)
|
24
24
|
case element
|
25
25
|
when :link
|
26
|
-
actual = browser.link(how
|
26
|
+
actual = browser.link(how, what).style type
|
27
27
|
when :button
|
28
|
-
actual = browser.button(how
|
28
|
+
actual = browser.button(how, what).style type
|
29
29
|
when :image
|
30
|
-
actual = browser.image(how
|
30
|
+
actual = browser.image(how, what).style type
|
31
31
|
when :span
|
32
|
-
actual = browser.span(how
|
32
|
+
actual = browser.span(how, what).style type
|
33
33
|
when :div
|
34
|
-
actual = browser.div(how
|
34
|
+
actual = browser.div(how, what).style type
|
35
35
|
else
|
36
|
-
if browser.element(how
|
37
|
-
actual = browser.element(how
|
36
|
+
if browser.element(how, what).responds_to?("style")
|
37
|
+
actual = browser.element(how, what).style type
|
38
38
|
else
|
39
39
|
failed_to_log("#{msg}: Element #{element} does not repond to style command.")
|
40
40
|
end
|
@@ -46,23 +46,23 @@ module Awetestlib
|
|
46
46
|
failed_to_log(msg)
|
47
47
|
end
|
48
48
|
rescue
|
49
|
-
failed_to_log(
|
49
|
+
failed_to_log(unable_to(msg, false, true))
|
50
50
|
end
|
51
51
|
|
52
52
|
def validate_style_greater_than_value(browser, element, how, what, type, value, desc = '')
|
53
53
|
case element
|
54
54
|
when :link
|
55
|
-
actual_value = browser.link(how
|
55
|
+
actual_value = browser.link(how, what).style type
|
56
56
|
when :button
|
57
|
-
actual_value = browser.button(how
|
57
|
+
actual_value = browser.button(how, what).style type
|
58
58
|
when :image
|
59
|
-
actual_value = browser.image(how
|
59
|
+
actual_value = browser.image(how, what).style type
|
60
60
|
when :span
|
61
|
-
actual_value = browser.span(how
|
61
|
+
actual_value = browser.span(how, what).style type
|
62
62
|
when :div
|
63
|
-
actual_value = browser.div(how
|
63
|
+
actual_value = browser.div(how, what).style type
|
64
64
|
else
|
65
|
-
actual_value = browser.element(how
|
65
|
+
actual_value = browser.element(how, what).style type
|
66
66
|
end
|
67
67
|
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
68
68
|
|
@@ -74,7 +74,7 @@ module Awetestlib
|
|
74
74
|
failed_to_log(msg)
|
75
75
|
end
|
76
76
|
rescue
|
77
|
-
|
77
|
+
failed_to_log(unable_to(msg, false, true))
|
78
78
|
# sleep_for(1)
|
79
79
|
end
|
80
80
|
|
@@ -83,17 +83,17 @@ module Awetestlib
|
|
83
83
|
def validate_style_less_than_value(browser, element, how, what, type, value, desc = '')
|
84
84
|
case element
|
85
85
|
when :link
|
86
|
-
actual_value = browser.link(how
|
86
|
+
actual_value = browser.link(how, what).style type
|
87
87
|
when :button
|
88
|
-
actual_value = browser.button(how
|
88
|
+
actual_value = browser.button(how, what).style type
|
89
89
|
when :image
|
90
|
-
actual_value = browser.image(how
|
90
|
+
actual_value = browser.image(how, what).style type
|
91
91
|
when :span
|
92
|
-
actual_value = browser.span(how
|
92
|
+
actual_value = browser.span(how, what).style type
|
93
93
|
when :div
|
94
|
-
actual_value = browser.div(how
|
94
|
+
actual_value = browser.div(how, what).style type
|
95
95
|
else
|
96
|
-
actual_value = browser.element(how
|
96
|
+
actual_value = browser.element(how, what).style type
|
97
97
|
end
|
98
98
|
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
99
99
|
|
@@ -105,7 +105,7 @@ module Awetestlib
|
|
105
105
|
failed_to_log(msg)
|
106
106
|
end
|
107
107
|
rescue
|
108
|
-
|
108
|
+
failed_to_log(unable_to(msg, false, true))
|
109
109
|
# sleep_for(1)
|
110
110
|
end
|
111
111
|
|
@@ -155,7 +155,7 @@ module Awetestlib
|
|
155
155
|
end
|
156
156
|
rtrn
|
157
157
|
rescue
|
158
|
-
failed_to_log(
|
158
|
+
failed_to_log(unable_to(msg, false, true))
|
159
159
|
end
|
160
160
|
|
161
161
|
alias validate_enabled enabled?
|
@@ -189,7 +189,7 @@ module Awetestlib
|
|
189
189
|
end
|
190
190
|
rtrn
|
191
191
|
rescue
|
192
|
-
failed_to_log(
|
192
|
+
failed_to_log(unable_to(msg, false, true))
|
193
193
|
end
|
194
194
|
|
195
195
|
alias validate_not_enabled disabled?
|
@@ -220,7 +220,7 @@ module Awetestlib
|
|
220
220
|
end
|
221
221
|
rtrn
|
222
222
|
rescue
|
223
|
-
failed_to_log(
|
223
|
+
failed_to_log(unable_to(msg, false, true))
|
224
224
|
end
|
225
225
|
|
226
226
|
alias validate_visible visible?
|
@@ -250,7 +250,7 @@ module Awetestlib
|
|
250
250
|
end
|
251
251
|
rtrn
|
252
252
|
rescue
|
253
|
-
failed_to_log(
|
253
|
+
failed_to_log(unable_to(msg, false, true))
|
254
254
|
end
|
255
255
|
|
256
256
|
alias validate_not_visible not_visible?
|
@@ -273,7 +273,7 @@ module Awetestlib
|
|
273
273
|
failed_to_log(msg)
|
274
274
|
end
|
275
275
|
rescue
|
276
|
-
failed_to_log(
|
276
|
+
failed_to_log(unable_to(msg, false, true))
|
277
277
|
end
|
278
278
|
|
279
279
|
alias checkbox_checked? checked?
|
@@ -292,7 +292,7 @@ module Awetestlib
|
|
292
292
|
failed_to_log(msg)
|
293
293
|
end
|
294
294
|
rescue
|
295
|
-
failed_to_log(
|
295
|
+
failed_to_log(unable_to(msg, false, true))
|
296
296
|
end
|
297
297
|
|
298
298
|
alias checkbox_checked? checked?
|
@@ -323,7 +323,7 @@ module Awetestlib
|
|
323
323
|
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
324
324
|
end
|
325
325
|
rescue
|
326
|
-
failed_to_log(
|
326
|
+
failed_to_log(unable_to(msg, false, true))
|
327
327
|
end
|
328
328
|
|
329
329
|
# Verify that a DOM element does not exist on the page.
|
@@ -345,7 +345,7 @@ module Awetestlib
|
|
345
345
|
true
|
346
346
|
end
|
347
347
|
rescue
|
348
|
-
failed_to_log(
|
348
|
+
failed_to_log(unable_to(msg, false, true))
|
349
349
|
end
|
350
350
|
|
351
351
|
alias not_exist? does_not_exist?
|
@@ -355,19 +355,19 @@ module Awetestlib
|
|
355
355
|
# @return [Boolean] Returns true if the radio button is set.
|
356
356
|
def set?(browser, how, what, desc = '', no_fail = false)
|
357
357
|
#TODO: handle identification of element with value as well as other attribute. see radio_with_value_set?
|
358
|
-
msg = build_message("Radio #{how}=>#{what} is
|
358
|
+
msg = build_message("Radio #{how}=>#{what} is set.", desc)
|
359
359
|
if browser.radio(how, what).set?
|
360
360
|
passed_to_log(msg)
|
361
361
|
true
|
362
362
|
else
|
363
363
|
if no_fail
|
364
|
-
passed_to_log("
|
364
|
+
passed_to_log("#{msg}. (Fail suppressed)")
|
365
365
|
else
|
366
366
|
failed_to_log(msg)
|
367
367
|
end
|
368
368
|
end
|
369
369
|
rescue
|
370
|
-
failed_to_log(
|
370
|
+
failed_to_log(unable_to(msg, false, true))
|
371
371
|
end
|
372
372
|
|
373
373
|
alias radio_set? set?
|
@@ -379,19 +379,19 @@ module Awetestlib
|
|
379
379
|
# @return [Boolean] Returns true if the radio button is not set.
|
380
380
|
def not_set?(browser, how, what, desc = '', no_fail = false)
|
381
381
|
#TODO: handle identification of element with value as well as other attribute. see radio_with_value_set?
|
382
|
-
msg = build_message("Radio #{how}=>#{what} is not
|
382
|
+
msg = build_message("Radio #{how}=>#{what} is not set.", desc)
|
383
383
|
if not browser.radio(how, what).set?
|
384
384
|
passed_to_log(msg)
|
385
385
|
true
|
386
386
|
else
|
387
387
|
if no_fail
|
388
|
-
passed_to_log("
|
388
|
+
passed_to_log("#{msg} (Fail suppressed")
|
389
389
|
else
|
390
390
|
failed_to_log(msg)
|
391
391
|
end
|
392
392
|
end
|
393
393
|
rescue
|
394
|
-
failed_to_log(
|
394
|
+
failed_to_log(unable_to(msg, false, true))
|
395
395
|
end
|
396
396
|
|
397
397
|
alias radio_not_set? not_set?
|
@@ -491,7 +491,7 @@ module Awetestlib
|
|
491
491
|
failed_to_log("#{msg}")
|
492
492
|
end
|
493
493
|
rescue
|
494
|
-
failed_to_log("Unable to #{msg}. #{$!}")
|
494
|
+
failed_to_log("Unable to verify #{msg}. #{$!}")
|
495
495
|
end
|
496
496
|
|
497
497
|
alias validate_string_equal string_equals?
|
@@ -585,6 +585,7 @@ module Awetestlib
|
|
585
585
|
# Verify that a DOM element is ready, i.e., both exists and is enabled.
|
586
586
|
# @param (see #exists?)
|
587
587
|
# @return [Boolean] Returns true if the element is ready.
|
588
|
+
#TODO: Watir-webdriver support
|
588
589
|
def ready?(browser, element, how, what, value = '', desc = '')
|
589
590
|
msg2 = "and value=>'#{value}' " if value
|
590
591
|
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'exists and is enabled.', desc)
|
@@ -633,7 +634,7 @@ module Awetestlib
|
|
633
634
|
end
|
634
635
|
end
|
635
636
|
rescue
|
636
|
-
failed_to_log(
|
637
|
+
failed_to_log(unable_to)
|
637
638
|
end
|
638
639
|
|
639
640
|
alias validate_textfield_value textfield_equals?
|
@@ -658,7 +659,7 @@ module Awetestlib
|
|
658
659
|
failed_to_log("#{msg} Contents: '#{contents}'")
|
659
660
|
end
|
660
661
|
rescue
|
661
|
-
failed_to_log(
|
662
|
+
failed_to_log(unable_to)
|
662
663
|
end
|
663
664
|
|
664
665
|
# Verify that a text field (also text area), identified by *how* and *what*, is empty.
|
@@ -680,7 +681,7 @@ module Awetestlib
|
|
680
681
|
failed_to_log("#{msg} Contents: '#{contents}'")
|
681
682
|
end
|
682
683
|
rescue
|
683
|
-
failed_to_log(
|
684
|
+
failed_to_log(unable_to)
|
684
685
|
end
|
685
686
|
|
686
687
|
alias validate_textfield_empty textfield_empty?
|
@@ -722,7 +723,7 @@ module Awetestlib
|
|
722
723
|
failed_to_log("#{msg} Actual: #{browser.url}")
|
723
724
|
end
|
724
725
|
rescue
|
725
|
-
failed_to_log(
|
726
|
+
failed_to_log(unable_to)
|
726
727
|
end
|
727
728
|
|
728
729
|
# @!endgroup Core
|
@@ -767,7 +768,7 @@ module Awetestlib
|
|
767
768
|
failed_to_log(msg)
|
768
769
|
end
|
769
770
|
rescue
|
770
|
-
failed_to_log(
|
771
|
+
failed_to_log(unable_to)
|
771
772
|
end
|
772
773
|
|
773
774
|
alias popup_exist popup_is_browser?
|
@@ -820,19 +821,18 @@ module Awetestlib
|
|
820
821
|
myText = browser.text
|
821
822
|
end
|
822
823
|
if myText.match(target)
|
823
|
-
#if myText.match(ptrn)
|
824
824
|
passed_to_log("#{msg}")
|
825
825
|
true
|
826
826
|
else
|
827
827
|
if skip_fail
|
828
|
-
debug_to_log("#{cls}
|
828
|
+
debug_to_log("#{cls} text does not contain the text: '#{ptrn}'. #{desc} (Fail suppressed)")
|
829
829
|
else
|
830
830
|
failed_to_log("#{msg}")
|
831
831
|
end
|
832
832
|
#debug_to_log("\n#{myText}")
|
833
833
|
end
|
834
834
|
rescue
|
835
|
-
failed_to_log(
|
835
|
+
failed_to_log(unable_to)
|
836
836
|
end
|
837
837
|
|
838
838
|
alias validate_link validate_text
|
@@ -853,16 +853,16 @@ module Awetestlib
|
|
853
853
|
end
|
854
854
|
end
|
855
855
|
rescue
|
856
|
-
failed_to_log(
|
856
|
+
failed_to_log(unable_to)
|
857
857
|
end
|
858
858
|
|
859
859
|
def element_contains_text?(browser, element, how, what, expected, desc = '')
|
860
860
|
msg = build_message("Element #{element} :{how}=>#{what} contains text '#{expected}'.", desc)
|
861
861
|
case how
|
862
862
|
when :href
|
863
|
-
who = browser.element(how, what)
|
864
|
-
else
|
865
863
|
who = browser.link(how, what)
|
864
|
+
else
|
865
|
+
who = browser.element(how, what)
|
866
866
|
end
|
867
867
|
if who
|
868
868
|
text = who.text
|
@@ -888,22 +888,26 @@ module Awetestlib
|
|
888
888
|
end
|
889
889
|
end
|
890
890
|
rescue
|
891
|
-
failed_to_log(
|
891
|
+
failed_to_log(unable_to)
|
892
892
|
end
|
893
893
|
|
894
|
-
def validate_select_list(browser, how, what, opt_type, list = nil, multiple = false, ignore = ['Select One'], limit = 5)
|
895
|
-
mark_testlevel("
|
894
|
+
def validate_select_list(browser, how, what, opt_type, list = nil, desc= '', multiple = false, ignore = ['Select One'], limit = 5)
|
895
|
+
mark_testlevel("(#{how}=>#{what})")
|
896
|
+
msg = "Select list #{how}=>#{what}"
|
896
897
|
ok = true
|
897
898
|
select_list = browser.select_list(how, what)
|
898
899
|
options = select_list.options
|
899
900
|
if list
|
900
901
|
if options == list
|
901
|
-
passed_to_log("
|
902
|
+
passed_to_log(build_message(msg, ": options list equals expected list #{list}"))
|
902
903
|
else
|
903
904
|
debug_to_report("actual:\n#{nice_array(options, true)}")
|
904
905
|
debug_to_report("expected:\n#{nice_array(list, true)}")
|
905
|
-
failed_to_log(
|
906
|
+
failed_to_log(build_message(
|
907
|
+
msg,
|
908
|
+
": options list #{nice_array(options, true)}",
|
906
909
|
"does not equal expected list #{nice_array(list, true)}")
|
910
|
+
)
|
907
911
|
end
|
908
912
|
end
|
909
913
|
|
@@ -927,34 +931,36 @@ module Awetestlib
|
|
927
931
|
select_option(select_list, opt_type, options[1])
|
928
932
|
select_option(select_list, opt_type, options[2])
|
929
933
|
selected = select_list.selected_options
|
934
|
+
msg1 = "#{msg}: selected options equals expected #{nice_array(targets)}."
|
930
935
|
if selected == targets
|
931
|
-
passed_to_log(
|
936
|
+
passed_to_log(msg1)
|
932
937
|
else
|
933
|
-
failed_to_log("
|
938
|
+
failed_to_log("#{msg} Found #{nice_array(selected)}")
|
934
939
|
end
|
935
940
|
else
|
936
|
-
debug_to_log("Too few options to test multiple selection (need 2 or more): '#{options}"
|
941
|
+
debug_to_log("#{msg}: Too few options to test multiple selection (need 2 or more): '#{options}")
|
937
942
|
end
|
938
943
|
end
|
939
944
|
rescue
|
940
|
-
failed_to_log(
|
945
|
+
failed_to_log(unable_to)
|
941
946
|
end
|
942
947
|
|
943
|
-
def validate_select_list_contents(browser, how, what, list)
|
944
|
-
mark_testlevel("#{
|
948
|
+
def validate_select_list_contents(browser, how, what, list, desc = '')
|
949
|
+
mark_testlevel("#{how}=>#{what}", 2)
|
950
|
+
msg = build_message("Select list #{how}=>#{what} options list equals", nice_array(list), desc)
|
945
951
|
select_list = browser.select_list(how, what)
|
946
952
|
options = select_list.options
|
947
953
|
if list
|
948
954
|
if options == list
|
949
|
-
passed_to_log(
|
955
|
+
passed_to_log(msg)
|
950
956
|
options
|
951
957
|
else
|
952
|
-
failed_to_log("
|
958
|
+
failed_to_log("#{msg}. Found #{nice_array(options)}")
|
953
959
|
nil
|
954
960
|
end
|
955
961
|
end
|
956
962
|
rescue
|
957
|
-
failed_to_log(
|
963
|
+
failed_to_log(unable_to)
|
958
964
|
end
|
959
965
|
|
960
966
|
def validate_selected_options(browser, how, what, list, desc = '')
|
@@ -985,7 +991,7 @@ module Awetestlib
|
|
985
991
|
end
|
986
992
|
|
987
993
|
rescue
|
988
|
-
failed_to_log(
|
994
|
+
failed_to_log(unable_to)
|
989
995
|
end
|
990
996
|
|
991
997
|
alias validate_selections validate_selected_options
|
@@ -1037,7 +1043,7 @@ module Awetestlib
|
|
1037
1043
|
true
|
1038
1044
|
end
|
1039
1045
|
rescue
|
1040
|
-
failed_to_log(
|
1046
|
+
failed_to_log(unable_to)
|
1041
1047
|
end
|
1042
1048
|
|
1043
1049
|
def textfield_does_not_equal?(browser, how, what, expected, desc = '')
|
@@ -1049,11 +1055,24 @@ module Awetestlib
|
|
1049
1055
|
failed_to_log(msg)
|
1050
1056
|
end
|
1051
1057
|
rescue
|
1052
|
-
failed_to_log(
|
1058
|
+
failed_to_log(unable_to)
|
1053
1059
|
end
|
1054
1060
|
|
1055
1061
|
alias validate_textfield_not_value textfield_does_not_equal?
|
1056
1062
|
|
1063
|
+
def verify_class(browser, element, how, what, strg, desc = '')
|
1064
|
+
msg = build_message("#{element} :#{how}=>#{what} :class contains '#{strg}'", desc)
|
1065
|
+
class_strg = browser.element(how, what).class_name
|
1066
|
+
if class_strg =~ /#{strg}/
|
1067
|
+
passed_to_log(msg)
|
1068
|
+
true
|
1069
|
+
else
|
1070
|
+
failed_to_log(msg)
|
1071
|
+
end
|
1072
|
+
rescue
|
1073
|
+
failed_to_log(unable_to)
|
1074
|
+
end
|
1075
|
+
|
1057
1076
|
# @!endgroup Core
|
1058
1077
|
|
1059
1078
|
# @!group Deprecated
|