awetestlib 0.1.22-x86-mingw32 → 0.1.23-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +7 -0
- data/lib/awetestlib/html_report.rb +15 -44
- data/lib/awetestlib/logging.rb +334 -374
- data/lib/awetestlib/regression/browser.rb +61 -71
- data/lib/awetestlib/regression/drag_and_drop.rb +31 -5
- data/lib/awetestlib/regression/find.rb +21 -139
- data/lib/awetestlib/regression/legacy.rb +1175 -1
- data/lib/awetestlib/regression/runner.rb +10 -6
- data/lib/awetestlib/regression/tables.rb +71 -25
- data/lib/awetestlib/regression/user_input.rb +88 -900
- data/lib/awetestlib/regression/utilities.rb +43 -18
- data/lib/awetestlib/regression/validations.rb +165 -248
- data/lib/awetestlib/regression/waits.rb +180 -94
- data/lib/awetestlib/runner.rb +1 -0
- data/lib/awetestlib.rb +3 -1
- data/lib/version.rb +2 -2
- data/test/create_zoho_account1.rb +1 -1
- data/test/login.xls +0 -0
- data/test/login_1.rb +37 -0
- data/test/login_1a.rb +37 -0
- data/test/login_2.rb +32 -0
- data/test/zoho_exercise.rb +21 -0
- metadata +10 -4
@@ -52,10 +52,10 @@ module Awetestlib
|
|
52
52
|
|
53
53
|
def build_message(strg1, desc = '', strg2 = '', strg3 = '', strg4 = '')
|
54
54
|
msg = "#{strg1}"
|
55
|
-
msg << " #{desc}" if desc.length > 0
|
56
|
-
msg << " #{strg2}" if strg2.length > 0
|
57
|
-
msg << " #{strg3}" if strg3.length > 0
|
58
|
-
msg << " #{strg4}" if strg4.length > 0
|
55
|
+
msg << " #{desc}" if desc and desc.length > 0
|
56
|
+
msg << " #{strg2}" if strg2 and strg2.length > 0
|
57
|
+
msg << " #{strg3}" if strg3 and strg3.length > 0
|
58
|
+
msg << " #{strg4}" if strg4 and strg4.length > 0
|
59
59
|
msg
|
60
60
|
end
|
61
61
|
|
@@ -105,9 +105,13 @@ module Awetestlib
|
|
105
105
|
(index / every) + (every - 1)
|
106
106
|
end
|
107
107
|
|
108
|
-
def get_variables(file,
|
108
|
+
def get_variables(file, key_type = :role, dbg = true)
|
109
|
+
#TODO refactor this
|
109
110
|
debug_to_log("#{__method__}: file = #{file}")
|
110
|
-
debug_to_log("#{__method__}:
|
111
|
+
debug_to_log("#{__method__}: key = #{key_type}")
|
112
|
+
|
113
|
+
script_found_in_login = false
|
114
|
+
script_found_in_data = false
|
111
115
|
|
112
116
|
@var = Hash.new
|
113
117
|
workbook = Excel.new(file)
|
@@ -119,6 +123,7 @@ module Awetestlib
|
|
119
123
|
scriptName = workbook.cell(1, col)
|
120
124
|
if scriptName == @myName
|
121
125
|
var_col = col
|
126
|
+
script_found_in_data = true
|
122
127
|
break
|
123
128
|
end
|
124
129
|
end
|
@@ -140,15 +145,16 @@ module Awetestlib
|
|
140
145
|
password_col = 0
|
141
146
|
url_col = 0
|
142
147
|
name_col = 0
|
143
|
-
|
144
|
-
if
|
145
|
-
workbook.default_sheet = workbook.sheets[
|
148
|
+
login_index = find_sheet_with_name(workbook, 'Login')
|
149
|
+
if login_index and login_index >= 0
|
150
|
+
workbook.default_sheet = workbook.sheets[login_index]
|
146
151
|
|
147
152
|
1.upto(workbook.last_column) do |col|
|
148
153
|
a_cell = workbook.cell(1, col)
|
149
154
|
case a_cell
|
150
155
|
when @myName
|
151
156
|
login_col = col
|
157
|
+
script_found_in_login = true
|
152
158
|
break
|
153
159
|
when 'role'
|
154
160
|
role_col = col
|
@@ -171,13 +177,13 @@ module Awetestlib
|
|
171
177
|
username = workbook.cell(line, name_col)
|
172
178
|
enabled = workbook.cell(line, login_col).to_s
|
173
179
|
|
174
|
-
case
|
175
|
-
when :id
|
180
|
+
case key_type
|
181
|
+
when :id, :userid
|
176
182
|
key = userid
|
177
183
|
when :role
|
178
184
|
key = role
|
179
185
|
else
|
180
|
-
key =
|
186
|
+
key = userid
|
181
187
|
end
|
182
188
|
|
183
189
|
@login[key] = Hash.new
|
@@ -191,12 +197,17 @@ module Awetestlib
|
|
191
197
|
end
|
192
198
|
|
193
199
|
@login.keys.sort.each do |key|
|
194
|
-
message_tolog("@login (by #{
|
200
|
+
message_tolog("@login (by #{key_type}): #{key}=>'#{@login[key].to_yaml}'")
|
195
201
|
end if dbg
|
196
202
|
end
|
197
203
|
|
204
|
+
if script_found_in_login and script_found_in_data
|
205
|
+
true
|
206
|
+
else
|
207
|
+
failed_to_log("Script found: in Login = #{script_found_in_login}; in Data = #{script_found_in_data}")
|
208
|
+
end
|
198
209
|
rescue
|
199
|
-
|
210
|
+
failed_to_log("#{__method__}: '#{$!}'")
|
200
211
|
end
|
201
212
|
|
202
213
|
def translate_var_list(key)
|
@@ -345,9 +356,9 @@ module Awetestlib
|
|
345
356
|
puts call_list if dbg
|
346
357
|
call_list.each_index do |x|
|
347
358
|
myCaller = call_list[x].to_s
|
348
|
-
break if x > depth or myCaller =~ /:in .run.$/
|
349
359
|
myCaller =~ /([\(\)\w_\_\-\.]+\:\d+\:?.*?)$/
|
350
360
|
myList << "[#{$1.gsub(/eval/, @myName)}] "
|
361
|
+
break if x > depth or myCaller =~ /:in .run.$/
|
351
362
|
end
|
352
363
|
myList
|
353
364
|
end
|
@@ -360,23 +371,23 @@ module Awetestlib
|
|
360
371
|
puts call_list if dbg
|
361
372
|
call_list.each_index do |x|
|
362
373
|
myCaller = call_list[x].to_s
|
363
|
-
break if x > depth or myCaller =~ /:in .run.$/
|
364
374
|
if myCaller.include? @myName
|
365
375
|
myCaller =~ /([\(\)\w_\_\-\.]+\:\d+\:?.*?)$/
|
366
376
|
myList << "[#{$1.gsub(/eval/, @myName)}] "
|
367
377
|
break
|
368
378
|
end
|
379
|
+
break if x > depth or myCaller =~ /:in .run.$/
|
369
380
|
end
|
370
381
|
if @projName
|
371
382
|
call_list.each_index do |x|
|
372
383
|
myCaller = call_list[x].to_s
|
373
|
-
break if x > depth or myCaller =~ /:in .run.$/
|
374
384
|
if myCaller.include? @projName
|
375
385
|
myCaller =~ /([\(\)\w_\_\-\.]+\:\d+\:?.*?)$/
|
376
386
|
myList << "[#{$1.gsub(/eval/, @projName)}] "
|
377
387
|
break
|
378
388
|
end
|
379
389
|
end
|
390
|
+
break if x > depth or myCaller =~ /:in .run.$/
|
380
391
|
end
|
381
392
|
myList
|
382
393
|
end
|
@@ -386,9 +397,9 @@ module Awetestlib
|
|
386
397
|
call_list = Kernel.caller
|
387
398
|
call_list.each_index do |x|
|
388
399
|
myCaller = call_list[x].to_s
|
389
|
-
break if x > depth or myCaller =~ /:in .run.$/
|
390
400
|
myCaller =~ /([\(\)\w_\_\-\.]+\:\d+\:?.*?)$/
|
391
401
|
arr << $1.gsub(/eval/, @myName)
|
402
|
+
break if x > depth or myCaller =~ /:in .run.$/
|
392
403
|
end
|
393
404
|
arr
|
394
405
|
end
|
@@ -912,6 +923,20 @@ module Awetestlib
|
|
912
923
|
error_to_log("#{$!} (#{__LINE__})")
|
913
924
|
end
|
914
925
|
|
926
|
+
def rescue_me_command(element, how, what, command = nil, param = nil, container = :browser)
|
927
|
+
loc = "#{container}.#{element}(#{how}, #{what})"
|
928
|
+
loc << ".#{command}" if command
|
929
|
+
loc << "(#{param})" if param
|
930
|
+
loc
|
931
|
+
end
|
932
|
+
|
933
|
+
def method_to_title(method, no_sub = false)
|
934
|
+
title = method.to_s.titleize
|
935
|
+
title.gsub!(/And/, '&') unless no_sub
|
936
|
+
title
|
937
|
+
rescue
|
938
|
+
debug_to_log("#{__method__}: #{method} #{$!}")
|
939
|
+
end
|
915
940
|
|
916
941
|
end
|
917
942
|
end
|