awetestlib 0.1.3-x86-mingw32 → 0.1.5-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/awetestlib.windows.gemspec +1 -1
- data/bin/awetestlib +11 -4
- data/bin/awetestlib-helpers.rb +28 -1
- data/bin/awetestlib-netbeans-setup.rb +39 -0
- data/bin/awetestlib-rubymine-setup.rb +33 -0
- data/images/logo.png +0 -0
- data/lib/awetestlib/html_report.rb +171 -0
- data/lib/{regression → awetestlib}/logging.rb +10 -43
- data/lib/awetestlib/regression/browser.rb +1233 -0
- data/lib/awetestlib/regression/drag_and_drop.rb +379 -0
- data/lib/awetestlib/regression/find.rb +431 -0
- data/lib/awetestlib/regression/legacy.rb +45 -0
- data/lib/awetestlib/regression/page_data.rb +190 -0
- data/lib/awetestlib/regression/runner.rb +306 -0
- data/lib/awetestlib/regression/tables.rb +491 -0
- data/lib/awetestlib/regression/user_input.rb +1256 -0
- data/lib/awetestlib/regression/utilities.rb +895 -0
- data/lib/awetestlib/regression/validations.rb +1184 -0
- data/lib/awetestlib/regression/waits.rb +391 -0
- data/lib/awetestlib/runner.rb +16 -0
- data/lib/awetestlib.rb +4 -4
- data/lib/version.rb +2 -2
- data/setup_samples/sample_netbeans/demo.rb +86 -0
- data/setup_samples/sample_netbeans/nbproject/configs/Demo.properties +2 -0
- data/setup_samples/sample_netbeans/nbproject/private/config.properties +1 -0
- data/setup_samples/sample_netbeans/nbproject/private/configs/Demo.properties +1 -0
- data/setup_samples/sample_netbeans/nbproject/private/private.properties +2 -0
- data/setup_samples/sample_netbeans/nbproject/project.properties +5 -0
- data/setup_samples/sample_netbeans/nbproject/project.xml +13 -0
- data/setup_samples/sample_rubymine/.idea/.name +1 -0
- data/setup_samples/sample_rubymine/.idea/encodings.xml +5 -0
- data/setup_samples/sample_rubymine/.idea/misc.xml +5 -0
- data/setup_samples/sample_rubymine/.idea/modules.xml +9 -0
- data/setup_samples/sample_rubymine/.idea/sample_rubymine.iml +9 -0
- data/setup_samples/sample_rubymine/.idea/scopes/scope_settings.xml +5 -0
- data/setup_samples/sample_rubymine/.idea/vcs.xml +7 -0
- data/setup_samples/sample_rubymine/.idea/workspace.xml +213 -0
- data/setup_samples/sample_rubymine/demo.rb +86 -0
- metadata +44 -19
- data/lib/regression/browser.rb +0 -1259
- data/lib/regression/drag_and_drop.rb +0 -374
- data/lib/regression/find.rb +0 -426
- data/lib/regression/legacy.rb +0 -40
- data/lib/regression/page_data.rb +0 -185
- data/lib/regression/runner.rb +0 -278
- data/lib/regression/tables.rb +0 -486
- data/lib/regression/user_input.rb +0 -1255
- data/lib/regression/utilities.rb +0 -891
- data/lib/regression/validations.rb +0 -1179
- data/lib/regression/waits.rb +0 -387
data/lib/regression/waits.rb
DELETED
@@ -1,387 +0,0 @@
|
|
1
|
-
module Waits
|
2
|
-
|
3
|
-
def sleep_for(seconds, dbg = true, desc = '')
|
4
|
-
msg = "Sleeping for #{seconds} seconds."
|
5
|
-
msg << " #{desc}" if desc.length > 0
|
6
|
-
msg << "\n#{get_debug_list}" if dbg
|
7
|
-
info_to_log(msg)
|
8
|
-
sleep(seconds)
|
9
|
-
end
|
10
|
-
|
11
|
-
# howLong is integer, whatFor is a browser object
|
12
|
-
=begin rdoc
|
13
|
-
:tags:wait
|
14
|
-
howLong is the number of seconds, text is a string to be found, threshold is the number of seconds
|
15
|
-
after which a fail message is generated even though the text was detected within the howLong limit.
|
16
|
-
Use this in place of wait_until_by_text when the wait time needs to be longer than the test automation default.
|
17
|
-
=end
|
18
|
-
def hold_for_text(browser, howLong, text, desc = '', threshold = 20, interval = 0.25)
|
19
|
-
countdown = howLong
|
20
|
-
while ((not browser.contains_text(text)) and countdown > 0)
|
21
|
-
sleep(interval)
|
22
|
-
countdown = countdown - interval
|
23
|
-
end
|
24
|
-
if countdown < howLong
|
25
|
-
waittime = howLong - countdown
|
26
|
-
passed_tolog("#{__method__} '#{text}' found after #{waittime} second(s) #{desc}")
|
27
|
-
if waittime > threshold
|
28
|
-
failed_tolog("#{__method__} '#{text}' took #{waittime} second(s). (threshold: #{threshold} seconds) #{desc}")
|
29
|
-
end
|
30
|
-
true
|
31
|
-
else
|
32
|
-
failed_tolog("#{__method__} '#{text}' not found after #{howLong} second(s) #{desc}")
|
33
|
-
false
|
34
|
-
end
|
35
|
-
rescue
|
36
|
-
failed_tolog("Unable to #{__method__} '#{text}'. '#{$!}' #{desc}")
|
37
|
-
end
|
38
|
-
|
39
|
-
alias wait_for_text hold_for_text
|
40
|
-
|
41
|
-
# howLong is integer, whatFor is a browser object
|
42
|
-
def wait_for_text(browser, howLong, text)
|
43
|
-
countdown = howLong
|
44
|
-
while ((not browser.contains_text(text)) and countdown > 0)
|
45
|
-
sleep(1)
|
46
|
-
countdown = countdown - 1
|
47
|
-
end
|
48
|
-
if countdown
|
49
|
-
passed_tolog("wait_for_text '#{text}' found after #{howLong} second(s)")
|
50
|
-
else
|
51
|
-
failed_tolog("wait_for_text '#{text}' not foundafter #{howLong} second(s)")
|
52
|
-
end
|
53
|
-
countdown
|
54
|
-
end
|
55
|
-
|
56
|
-
def wait_for_element_to_reappear(browser, how, what, desc = '', timeout = 20)
|
57
|
-
msg = "Element #{how}=#{what} exists. #{desc}"
|
58
|
-
wait_while(browser, "While: #{msg}", timeout) { browser.element(how, what).exists? }
|
59
|
-
wait_until(browser, "Until: #{msg}", timeout) { browser.element(how, what).exists? }
|
60
|
-
end
|
61
|
-
|
62
|
-
# howLong is integer, whatFor is a browser object
|
63
|
-
def wait_for_exists(howLong, whatFor)
|
64
|
-
wait_for(howLong, whatFor)
|
65
|
-
end
|
66
|
-
|
67
|
-
def wait_for(howLong, whatFor)
|
68
|
-
countdown = howLong
|
69
|
-
while ((not whatFor.exists?) and countdown > 0)
|
70
|
-
sleep(1)
|
71
|
-
puts whatFor.inspect+':'+countdown.to_s
|
72
|
-
countdown = countdown - 1
|
73
|
-
end
|
74
|
-
if countdown
|
75
|
-
puts 'found '+whatFor.inspect
|
76
|
-
passed_tolog("wait_for (#{howLong} found "+whatFor.inspect)
|
77
|
-
else
|
78
|
-
puts 'Did not find '+whatFor.inspect
|
79
|
-
failed_tolog("wait_for (#{howLong} did not find "+whatFor.inspect)
|
80
|
-
end
|
81
|
-
countdown
|
82
|
-
end
|
83
|
-
|
84
|
-
def wait_the_hard_way(browser, how, what, wait = 6, intvl = 0.25)
|
85
|
-
count = (wait / intvl).to_i + 1
|
86
|
-
tally = 0
|
87
|
-
ok = (1 / intvl).to_i + 1
|
88
|
-
debug_to_log("#{__method__}: wait: #{wait} secs; intvl: #{intvl} secs; count; #{count}; thresh: #{ok}")
|
89
|
-
(1..count).each do |x|
|
90
|
-
begin
|
91
|
-
if browser.element(how, what).exists?
|
92
|
-
tally += 1
|
93
|
-
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} exists.")
|
94
|
-
else
|
95
|
-
tally = 0
|
96
|
-
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} does not exist.")
|
97
|
-
end
|
98
|
-
rescue
|
99
|
-
tally = 0
|
100
|
-
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} rescue: #{$!}")
|
101
|
-
end
|
102
|
-
if tally >= ok
|
103
|
-
return true
|
104
|
-
end
|
105
|
-
sleep(intvl)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def wait_until_exists(browser, element, how, what, desc = '')
|
110
|
-
msg = "Wait until (#{element} :#{how}=>#{what}) exists."
|
111
|
-
msg << " #{desc}" if desc.length > 0
|
112
|
-
start = Time.now.to_f
|
113
|
-
# TODO: try Watir::Wait.until { browser.element(how, what).exists? } instead of this (cumbersome) case statement
|
114
|
-
# TODO: above fails on frame
|
115
|
-
begin
|
116
|
-
case element
|
117
|
-
when :link
|
118
|
-
Watir::Wait.until { browser.link(how, what).exists? }
|
119
|
-
when :button
|
120
|
-
Watir::Wait.until { browser.button(how, what).exists? }
|
121
|
-
when :radio
|
122
|
-
Watir::Wait.until { browser.radio(how, what).exists? }
|
123
|
-
when :checkbox
|
124
|
-
Watir::Wait.until { browser.checkbox(how, what).exists? }
|
125
|
-
when :div
|
126
|
-
Watir::Wait.until { browser.div(how, what).exists? }
|
127
|
-
when :select_list
|
128
|
-
Watir::Wait.until { browser.select_list(how, what).exists? }
|
129
|
-
when :text_field
|
130
|
-
Watir::Wait.until { browser.text_field(how, what).exists? }
|
131
|
-
when :frame
|
132
|
-
Watir::Wait.until { browser.frame(how, what).exists? }
|
133
|
-
when :form
|
134
|
-
Watir::Wait.until { browser.form(how, what).exists? }
|
135
|
-
when :cell
|
136
|
-
Watir::Wait.until { browser.cell(how, what).exists? }
|
137
|
-
when :image
|
138
|
-
Watir::Wait.until { browser.image(how, what).exists? }
|
139
|
-
else
|
140
|
-
Watir::Wait.until { browser.element(how, what).exists? }
|
141
|
-
end
|
142
|
-
rescue => e
|
143
|
-
if e.class.to_s =~ /TimeOutException/
|
144
|
-
failed_to_log("#{msg}: '#{$!}'")
|
145
|
-
return false
|
146
|
-
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
147
|
-
raise e
|
148
|
-
end
|
149
|
-
end
|
150
|
-
stop = Time.now.to_f
|
151
|
-
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
152
|
-
# sleep 1
|
153
|
-
if validate(browser, @myName, __LINE__)
|
154
|
-
passed_to_log("#{msg} (#{stop - start} seconds)")
|
155
|
-
true
|
156
|
-
end
|
157
|
-
rescue
|
158
|
-
failed_to_log("Unable to complete #{msg}: '#{$!}'")
|
159
|
-
end
|
160
|
-
|
161
|
-
def wait_while(browser, desc, timeout = 45, &block)
|
162
|
-
#TODO: Would like to be able to see the block code in the log message instead of the identification
|
163
|
-
msg = "Wait while #{desc}:"
|
164
|
-
start = Time.now.to_f
|
165
|
-
begin
|
166
|
-
#Watir::Wait.until(timeout) { block.call(nil) }
|
167
|
-
if block.call(nil)
|
168
|
-
Watir::Wait.while(timeout) { block.call(nil) }
|
169
|
-
end
|
170
|
-
rescue => e
|
171
|
-
if e.class.to_s =~ /TimeOutException/ or e.message =~ /timed out/
|
172
|
-
failed_to_log("#{msg}: '#{$!}' ")
|
173
|
-
return false
|
174
|
-
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
175
|
-
raise e
|
176
|
-
end
|
177
|
-
end
|
178
|
-
stop = Time.now.to_f
|
179
|
-
#debug_to_log("#{__method__}: start:#{start} stop:#{stop} block: #{block.to_s}")
|
180
|
-
# sleep 1
|
181
|
-
if validate(browser, @myName, __LINE__)
|
182
|
-
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") # {#{block.to_s}}")
|
183
|
-
true
|
184
|
-
end
|
185
|
-
rescue
|
186
|
-
failed_to_log("Unable to complete #{msg}. '#{$!}'")
|
187
|
-
end
|
188
|
-
|
189
|
-
alias wait_while_true wait_while
|
190
|
-
|
191
|
-
def wait_until(browser, desc, timeout = 45, skip_pass = false, &block)
|
192
|
-
#TODO: Would like to be able to see the block code in the log message instead of the identification
|
193
|
-
msg = "Wait until #{desc}"
|
194
|
-
start = Time.now.to_f
|
195
|
-
begin
|
196
|
-
Watir::Wait.until(timeout) { block.call(nil) }
|
197
|
-
rescue => e
|
198
|
-
if e.class.to_s =~ /TimeOutException/ or e.message =~ /timed out/
|
199
|
-
failed_to_log("#{msg} '#{$!}'")
|
200
|
-
return false
|
201
|
-
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
202
|
-
raise e
|
203
|
-
end
|
204
|
-
end
|
205
|
-
stop = Time.now.to_f
|
206
|
-
#debug_to_log("#{__method__}: start:#{start} stop:#{stop} block: #{block.to_s}")
|
207
|
-
# sleep 1
|
208
|
-
if validate(browser, @myName, __LINE__)
|
209
|
-
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") unless skip_pass # {#{block.to_s}}")
|
210
|
-
true
|
211
|
-
end
|
212
|
-
rescue
|
213
|
-
failed_to_log("Unable to complete #{msg} '#{$!}'")
|
214
|
-
end
|
215
|
-
|
216
|
-
alias wait_until_true wait_until
|
217
|
-
|
218
|
-
def wait_until_by_radio_value(browser, strg, desc = '')
|
219
|
-
wait_until_exists(browser, :radio, :value, strg, desc)
|
220
|
-
end
|
221
|
-
|
222
|
-
def wait_until_ready(browser, how, what, desc = '', timeout = 90, verbose = false)
|
223
|
-
msg = "#{__method__.to_s.titleize}: element: #{how}='#{what}'"
|
224
|
-
msg << " #{desc}" if desc.length > 0
|
225
|
-
proc_exists = Proc.new { browser.element(how, what).exists? }
|
226
|
-
proc_enabled = Proc.new { browser.element(how, what).enabled? }
|
227
|
-
case how
|
228
|
-
when :href
|
229
|
-
proc_exists = Proc.new { browser.link(how, what).exists? }
|
230
|
-
proc_enabled = Proc.new { browser.link(how, what).enabled? }
|
231
|
-
end
|
232
|
-
if verbose
|
233
|
-
if wait_until(browser, "#{msg} Element exists.", timeout) { proc_exists.call(nil) }
|
234
|
-
if wait_until(browser, "#{msg} Element enabled.", timeout) { proc_enabled.call(nil) }
|
235
|
-
passed_to_log(msg)
|
236
|
-
true
|
237
|
-
else
|
238
|
-
failed_to_log(msg)
|
239
|
-
end
|
240
|
-
else
|
241
|
-
failed_to_log(msg)
|
242
|
-
end
|
243
|
-
else
|
244
|
-
start = Time.now.to_f
|
245
|
-
if Watir::Wait.until(timeout) { proc_exists.call(nil) }
|
246
|
-
if Watir::Wait.until(timeout) { proc_enabled.call(nil) }
|
247
|
-
stop = Time.now.to_f
|
248
|
-
#debug_to_log("#{__method__}: start:#{"%.5f" % start} stop:#{"%.5f" % stop}")
|
249
|
-
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)")
|
250
|
-
true
|
251
|
-
else
|
252
|
-
failed_to_log(msg)
|
253
|
-
end
|
254
|
-
else
|
255
|
-
failed_to_log(msg)
|
256
|
-
end
|
257
|
-
end
|
258
|
-
rescue
|
259
|
-
failed_to_log("Unable to #{msg}. '#{$!}'")
|
260
|
-
end
|
261
|
-
|
262
|
-
def wait_until_ready_quiet(browser, how, what, desc = '', timeout = 45, quiet = true)
|
263
|
-
msg = "#{__method__.to_s.titleize}: element: #{how}='#{what}'"
|
264
|
-
msg << " #{desc}" if desc.length > 0
|
265
|
-
proc_exists = Proc.new { browser.element(how, what).exists? }
|
266
|
-
proc_enabled = Proc.new { browser.element(how, what).enabled? }
|
267
|
-
case how
|
268
|
-
when :href
|
269
|
-
proc_exists = Proc.new { browser.link(how, what).exists? }
|
270
|
-
proc_enabled = Proc.new { browser.link(how, what).enabled? }
|
271
|
-
end
|
272
|
-
start = Time.now.to_f
|
273
|
-
if Watir::Wait.until(timeout) { proc_exists.call(nil) }
|
274
|
-
if Watir::Wait.until(timeout) { proc_enabled.call(nil) }
|
275
|
-
stop = Time.now.to_f
|
276
|
-
#debug_to_log("#{msg}: start:#{"%.5f" % start} stop:#{"%.5f" % stop}")
|
277
|
-
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") unless quiet
|
278
|
-
true
|
279
|
-
else
|
280
|
-
failed_to_log(msg)
|
281
|
-
end
|
282
|
-
else
|
283
|
-
failed_to_log(msg)
|
284
|
-
end
|
285
|
-
rescue
|
286
|
-
failed_to_log("Unable to #{msg}. '#{$!}'")
|
287
|
-
end
|
288
|
-
|
289
|
-
def wait_until_text(browser, strg, desc = '', timeout = 60)
|
290
|
-
if not strg.class.to_s.match('String')
|
291
|
-
raise "#{__method__} requires String for search target. #{strg.class} is not supported."
|
292
|
-
end
|
293
|
-
wait_until(browser, "'#{strg}' #{desc}", timeout) { browser.text.include? strg }
|
294
|
-
end
|
295
|
-
|
296
|
-
alias wait_until_by_text wait_until_text
|
297
|
-
|
298
|
-
def wait_until_by_link_text(browser, strg, desc = '')
|
299
|
-
wait_until_exists(browser, :link, :text, strg, desc)
|
300
|
-
end
|
301
|
-
|
302
|
-
def wait_until_enabled(browser, what, how, value, desc = '')
|
303
|
-
# TODO: This can be simplified
|
304
|
-
start = Time.now.to_f
|
305
|
-
begin
|
306
|
-
case what
|
307
|
-
when :link
|
308
|
-
Watir::Wait.until { browser.link(how, value).enabled? }
|
309
|
-
when :button
|
310
|
-
Watir::Wait.until { browser.button(how, value).enabled? }
|
311
|
-
when :radio
|
312
|
-
Watir::Wait.until { browser.radio(how, value).enabled? }
|
313
|
-
when :checkbox
|
314
|
-
Watir::Wait.until { browser.checkbox(how, value).enabled? }
|
315
|
-
when :div
|
316
|
-
Watir::Wait.until { browser.div(how, value).enabled? }
|
317
|
-
when :select_list
|
318
|
-
Watir::Wait.until { browser.select_list(how, value).enabled? }
|
319
|
-
when :text_field
|
320
|
-
Watir::Wait.until { browser.text_field(how, value).enabled? }
|
321
|
-
when :table
|
322
|
-
Watir::Wait.until { browser.table(how, value).enabled? }
|
323
|
-
else
|
324
|
-
raise "#{__method__}: Element #{what} not supported."
|
325
|
-
end
|
326
|
-
rescue => e
|
327
|
-
if e.class.to_s =~ /TimeOutException/
|
328
|
-
failed_to_log("Wait until (#{what} :#{how}=>#{value}) enabled. #{desc}: '#{$!}' #{desc}")
|
329
|
-
return false
|
330
|
-
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
331
|
-
raise e
|
332
|
-
end
|
333
|
-
end
|
334
|
-
stop = Time.now.to_f
|
335
|
-
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
336
|
-
# sleep 1
|
337
|
-
if validate(browser, @myName, __LINE__)
|
338
|
-
passed_to_log("Wait until (#{what} :#{how}=>#{value}) enabled. #{desc} (#{stop - start} seconds)")
|
339
|
-
true
|
340
|
-
end
|
341
|
-
rescue
|
342
|
-
failed_to_log("Unable to complete wait until (#{what} :#{how}=>#{value}) enabled. #{desc}: '#{$!}'")
|
343
|
-
end
|
344
|
-
|
345
|
-
def wait_until_visible(browser, element, how, what, desc = '')
|
346
|
-
start = Time.now.to_f
|
347
|
-
Watir::Wait.until(20) { browser.element(how, what).exists? }
|
348
|
-
begin
|
349
|
-
case element
|
350
|
-
when :link
|
351
|
-
Watir::Wait.until { browser.link(how, what).visible? }
|
352
|
-
when :button
|
353
|
-
Watir::Wait.until { browser.button(how, what).visible? }
|
354
|
-
when :radio
|
355
|
-
Watir::Wait.until { browser.radio(how, what).visible? }
|
356
|
-
when :checkbox
|
357
|
-
Watir::Wait.until { browser.checkbox(how, what).visible? }
|
358
|
-
when :div
|
359
|
-
Watir::Wait.until { browser.div(how, what).visible? }
|
360
|
-
when :select_list
|
361
|
-
Watir::Wait.until { browser.select_list(how, what).visible? }
|
362
|
-
when :text_field
|
363
|
-
Watir::Wait.until { browser.text_field(how, what).visible? }
|
364
|
-
else
|
365
|
-
Watir::Wait.until { browser.element(how, what).visible? }
|
366
|
-
# raise "#{__method__}: Element #{what} not supported."
|
367
|
-
end
|
368
|
-
rescue => e
|
369
|
-
if e.class.to_s =~ /TimeOutException/
|
370
|
-
failed_to_log("Wait until (#{what} :#{how}=>#{what}) visible. #{desc}: '#{$!}' #{desc}")
|
371
|
-
return false
|
372
|
-
elsif not rescue_me(e, __method__, '', "#{browser.class}")
|
373
|
-
raise e
|
374
|
-
end
|
375
|
-
end
|
376
|
-
stop = Time.now.to_f
|
377
|
-
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
378
|
-
# sleep 1
|
379
|
-
if validate(browser, @myName, __LINE__)
|
380
|
-
passed_to_log("Wait until (#{element} :#{how}=>#{what}) visible. #{desc} (#{stop - start} seconds)")
|
381
|
-
true
|
382
|
-
end
|
383
|
-
rescue
|
384
|
-
failed_to_log("Unable to complete wait until (#{element} :#{how}=>#{what}) visible. #{desc}: '#{$!}'")
|
385
|
-
end
|
386
|
-
|
387
|
-
end
|