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
@@ -0,0 +1,391 @@
|
|
1
|
+
module Awetestlib
|
2
|
+
module Regression
|
3
|
+
module Waits
|
4
|
+
|
5
|
+
def sleep_for(seconds, dbg = true, desc = '')
|
6
|
+
msg = "Sleeping for #{seconds} seconds."
|
7
|
+
msg << " #{desc}" if desc.length > 0
|
8
|
+
info_to_log(msg)
|
9
|
+
sleep(seconds)
|
10
|
+
end
|
11
|
+
|
12
|
+
# howLong is integer, whatFor is a browser object
|
13
|
+
=begin rdoc
|
14
|
+
:tags:wait
|
15
|
+
howLong is the number of seconds, text is a string to be found, threshold is the number of seconds
|
16
|
+
after which a fail message is generated even though the text was detected within the howLong limit.
|
17
|
+
Use this in place of wait_until_by_text when the wait time needs to be longer than the test automation default.
|
18
|
+
=end
|
19
|
+
def hold_for_text(browser, howLong, text, desc = '', threshold = 20, interval = 0.25)
|
20
|
+
countdown = howLong
|
21
|
+
while ((not browser.contains_text(text)) and countdown > 0)
|
22
|
+
sleep(interval)
|
23
|
+
countdown = countdown - interval
|
24
|
+
end
|
25
|
+
if countdown < howLong
|
26
|
+
waittime = howLong - countdown
|
27
|
+
passed_tolog("#{__method__} '#{text}' found after #{waittime} second(s) #{desc}")
|
28
|
+
if waittime > threshold
|
29
|
+
failed_tolog("#{__method__} '#{text}' took #{waittime} second(s). (threshold: #{threshold} seconds) #{desc}")
|
30
|
+
end
|
31
|
+
true
|
32
|
+
else
|
33
|
+
failed_tolog("#{__method__} '#{text}' not found after #{howLong} second(s) #{desc}")
|
34
|
+
false
|
35
|
+
end
|
36
|
+
rescue
|
37
|
+
failed_tolog("Unable to #{__method__} '#{text}'. '#{$!}' #{desc}")
|
38
|
+
end
|
39
|
+
|
40
|
+
alias wait_for_text hold_for_text
|
41
|
+
|
42
|
+
# howLong is integer, whatFor is a browser object
|
43
|
+
def wait_for_text(browser, howLong, text)
|
44
|
+
countdown = howLong
|
45
|
+
while ((not browser.contains_text(text)) and countdown > 0)
|
46
|
+
sleep(1)
|
47
|
+
countdown = countdown - 1
|
48
|
+
end
|
49
|
+
if countdown
|
50
|
+
passed_tolog("wait_for_text '#{text}' found after #{howLong} second(s)")
|
51
|
+
else
|
52
|
+
failed_tolog("wait_for_text '#{text}' not foundafter #{howLong} second(s)")
|
53
|
+
end
|
54
|
+
countdown
|
55
|
+
end
|
56
|
+
|
57
|
+
def wait_for_element_to_reappear(browser, how, what, desc = '', timeout = 20)
|
58
|
+
msg = "Element #{how}=#{what} exists. #{desc}"
|
59
|
+
wait_while(browser, "While: #{msg}", timeout) { browser.element(how, what).exists? }
|
60
|
+
wait_until(browser, "Until: #{msg}", timeout) { browser.element(how, what).exists? }
|
61
|
+
end
|
62
|
+
|
63
|
+
# howLong is integer, whatFor is a browser object
|
64
|
+
def wait_for_exists(howLong, whatFor)
|
65
|
+
wait_for(howLong, whatFor)
|
66
|
+
end
|
67
|
+
|
68
|
+
def wait_for(howLong, whatFor)
|
69
|
+
countdown = howLong
|
70
|
+
while ((not whatFor.exists?) and countdown > 0)
|
71
|
+
sleep(1)
|
72
|
+
puts whatFor.inspect+':'+countdown.to_s
|
73
|
+
countdown = countdown - 1
|
74
|
+
end
|
75
|
+
if countdown
|
76
|
+
puts 'found '+whatFor.inspect
|
77
|
+
passed_tolog("wait_for (#{howLong} found "+whatFor.inspect)
|
78
|
+
else
|
79
|
+
puts 'Did not find '+whatFor.inspect
|
80
|
+
failed_tolog("wait_for (#{howLong} did not find "+whatFor.inspect)
|
81
|
+
end
|
82
|
+
countdown
|
83
|
+
end
|
84
|
+
|
85
|
+
def wait_the_hard_way(browser, how, what, wait = 6, intvl = 0.25)
|
86
|
+
count = (wait / intvl).to_i + 1
|
87
|
+
tally = 0
|
88
|
+
ok = (1 / intvl).to_i + 1
|
89
|
+
debug_to_log("#{__method__}: wait: #{wait} secs; intvl: #{intvl} secs; count; #{count}; thresh: #{ok}")
|
90
|
+
(1..count).each do |x|
|
91
|
+
begin
|
92
|
+
if browser.element(how, what).exists?
|
93
|
+
tally += 1
|
94
|
+
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} exists.")
|
95
|
+
else
|
96
|
+
tally = 0
|
97
|
+
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} does not exist.")
|
98
|
+
end
|
99
|
+
rescue
|
100
|
+
tally = 0
|
101
|
+
debug_to_log("#{x}: #{(x - 1) * intvl}: #{what} rescue: #{$!}")
|
102
|
+
end
|
103
|
+
if tally >= ok
|
104
|
+
return true
|
105
|
+
end
|
106
|
+
sleep(intvl)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def wait_until_exists(browser, element, how, what, desc = '')
|
111
|
+
msg = "Wait until (#{element} :#{how}=>#{what}) exists."
|
112
|
+
msg << " #{desc}" if desc.length > 0
|
113
|
+
start = Time.now.to_f
|
114
|
+
# TODO: try Watir::Wait.until { browser.element(how, what).exists? } instead of this (cumbersome) case statement
|
115
|
+
# TODO: above fails on frame
|
116
|
+
begin
|
117
|
+
case element
|
118
|
+
when :link
|
119
|
+
Watir::Wait.until { browser.link(how, what).exists? }
|
120
|
+
when :button
|
121
|
+
Watir::Wait.until { browser.button(how, what).exists? }
|
122
|
+
when :radio
|
123
|
+
Watir::Wait.until { browser.radio(how, what).exists? }
|
124
|
+
when :checkbox
|
125
|
+
Watir::Wait.until { browser.checkbox(how, what).exists? }
|
126
|
+
when :div
|
127
|
+
Watir::Wait.until { browser.div(how, what).exists? }
|
128
|
+
when :select_list
|
129
|
+
Watir::Wait.until { browser.select_list(how, what).exists? }
|
130
|
+
when :text_field
|
131
|
+
Watir::Wait.until { browser.text_field(how, what).exists? }
|
132
|
+
when :frame
|
133
|
+
Watir::Wait.until { browser.frame(how, what).exists? }
|
134
|
+
when :form
|
135
|
+
Watir::Wait.until { browser.form(how, what).exists? }
|
136
|
+
when :cell
|
137
|
+
Watir::Wait.until { browser.cell(how, what).exists? }
|
138
|
+
when :image
|
139
|
+
Watir::Wait.until { browser.image(how, what).exists? }
|
140
|
+
else
|
141
|
+
Watir::Wait.until { browser.element(how, what).exists? }
|
142
|
+
end
|
143
|
+
rescue => e
|
144
|
+
if e.class.to_s =~ /TimeOutException/
|
145
|
+
failed_to_log("#{msg}: '#{$!}'")
|
146
|
+
return false
|
147
|
+
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
148
|
+
raise e
|
149
|
+
end
|
150
|
+
end
|
151
|
+
stop = Time.now.to_f
|
152
|
+
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
153
|
+
# sleep 1
|
154
|
+
if validate(browser, @myName, __LINE__)
|
155
|
+
passed_to_log("#{msg} (#{stop - start} seconds)")
|
156
|
+
true
|
157
|
+
end
|
158
|
+
rescue
|
159
|
+
failed_to_log("Unable to complete #{msg}: '#{$!}'")
|
160
|
+
end
|
161
|
+
|
162
|
+
def wait_while(browser, desc, timeout = 45, &block)
|
163
|
+
#TODO: Would like to be able to see the block code in the log message instead of the identification
|
164
|
+
msg = "Wait while #{desc}:"
|
165
|
+
start = Time.now.to_f
|
166
|
+
begin
|
167
|
+
#Watir::Wait.until(timeout) { block.call(nil) }
|
168
|
+
if block.call(nil)
|
169
|
+
Watir::Wait.while(timeout) { block.call(nil) }
|
170
|
+
end
|
171
|
+
rescue => e
|
172
|
+
if e.class.to_s =~ /TimeOutException/ or e.message =~ /timed out/
|
173
|
+
failed_to_log("#{msg}: '#{$!}' ")
|
174
|
+
return false
|
175
|
+
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
176
|
+
raise e
|
177
|
+
end
|
178
|
+
end
|
179
|
+
stop = Time.now.to_f
|
180
|
+
#debug_to_log("#{__method__}: start:#{start} stop:#{stop} block: #{block.to_s}")
|
181
|
+
# sleep 1
|
182
|
+
if validate(browser, @myName, __LINE__)
|
183
|
+
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") # {#{block.to_s}}")
|
184
|
+
true
|
185
|
+
end
|
186
|
+
rescue
|
187
|
+
failed_to_log("Unable to complete #{msg}. '#{$!}'")
|
188
|
+
end
|
189
|
+
|
190
|
+
alias wait_while_true wait_while
|
191
|
+
|
192
|
+
def wait_until(browser, desc, timeout = 45, skip_pass = false, &block)
|
193
|
+
#TODO: Would like to be able to see the block code in the log message instead of the identification
|
194
|
+
msg = "Wait until #{desc}"
|
195
|
+
start = Time.now.to_f
|
196
|
+
begin
|
197
|
+
Watir::Wait.until(timeout) { block.call(nil) }
|
198
|
+
rescue => e
|
199
|
+
if e.class.to_s =~ /TimeOutException/ or e.message =~ /timed out/
|
200
|
+
failed_to_log("#{msg} '#{$!}'")
|
201
|
+
return false
|
202
|
+
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
203
|
+
raise e
|
204
|
+
end
|
205
|
+
end
|
206
|
+
stop = Time.now.to_f
|
207
|
+
#debug_to_log("#{__method__}: start:#{start} stop:#{stop} block: #{block.to_s}")
|
208
|
+
# sleep 1
|
209
|
+
if validate(browser, @myName, __LINE__)
|
210
|
+
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") unless skip_pass # {#{block.to_s}}")
|
211
|
+
true
|
212
|
+
end
|
213
|
+
rescue
|
214
|
+
failed_to_log("Unable to complete #{msg} '#{$!}'")
|
215
|
+
end
|
216
|
+
|
217
|
+
alias wait_until_true wait_until
|
218
|
+
|
219
|
+
def wait_until_by_radio_value(browser, strg, desc = '')
|
220
|
+
wait_until_exists(browser, :radio, :value, strg, desc)
|
221
|
+
end
|
222
|
+
|
223
|
+
def wait_until_ready(browser, how, what, desc = '', timeout = 90, verbose = false)
|
224
|
+
msg = "#{__method__.to_s.titleize}: element: #{how}='#{what}'"
|
225
|
+
msg << " #{desc}" if desc.length > 0
|
226
|
+
proc_exists = Proc.new { browser.element(how, what).exists? }
|
227
|
+
proc_enabled = Proc.new { browser.element(how, what).enabled? }
|
228
|
+
case how
|
229
|
+
when :href
|
230
|
+
proc_exists = Proc.new { browser.link(how, what).exists? }
|
231
|
+
proc_enabled = Proc.new { browser.link(how, what).enabled? }
|
232
|
+
end
|
233
|
+
if verbose
|
234
|
+
if wait_until(browser, "#{msg} Element exists.", timeout) { proc_exists.call(nil) }
|
235
|
+
if wait_until(browser, "#{msg} Element enabled.", timeout) { proc_enabled.call(nil) }
|
236
|
+
passed_to_log(msg)
|
237
|
+
true
|
238
|
+
else
|
239
|
+
failed_to_log(msg)
|
240
|
+
end
|
241
|
+
else
|
242
|
+
failed_to_log(msg)
|
243
|
+
end
|
244
|
+
else
|
245
|
+
start = Time.now.to_f
|
246
|
+
if Watir::Wait.until(timeout) { proc_exists.call(nil) }
|
247
|
+
if Watir::Wait.until(timeout) { proc_enabled.call(nil) }
|
248
|
+
stop = Time.now.to_f
|
249
|
+
#debug_to_log("#{__method__}: start:#{"%.5f" % start} stop:#{"%.5f" % stop}")
|
250
|
+
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)")
|
251
|
+
true
|
252
|
+
else
|
253
|
+
failed_to_log(msg)
|
254
|
+
end
|
255
|
+
else
|
256
|
+
failed_to_log(msg)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
rescue
|
260
|
+
failed_to_log("Unable to #{msg}. '#{$!}'")
|
261
|
+
end
|
262
|
+
|
263
|
+
def wait_until_ready_quiet(browser, how, what, desc = '', timeout = 45, quiet = true)
|
264
|
+
msg = "#{__method__.to_s.titleize}: element: #{how}='#{what}'"
|
265
|
+
msg << " #{desc}" if desc.length > 0
|
266
|
+
proc_exists = Proc.new { browser.element(how, what).exists? }
|
267
|
+
proc_enabled = Proc.new { browser.element(how, what).enabled? }
|
268
|
+
case how
|
269
|
+
when :href
|
270
|
+
proc_exists = Proc.new { browser.link(how, what).exists? }
|
271
|
+
proc_enabled = Proc.new { browser.link(how, what).enabled? }
|
272
|
+
end
|
273
|
+
start = Time.now.to_f
|
274
|
+
if Watir::Wait.until(timeout) { proc_exists.call(nil) }
|
275
|
+
if Watir::Wait.until(timeout) { proc_enabled.call(nil) }
|
276
|
+
stop = Time.now.to_f
|
277
|
+
#debug_to_log("#{msg}: start:#{"%.5f" % start} stop:#{"%.5f" % stop}")
|
278
|
+
passed_to_log("#{msg} (#{"%.5f" % (stop - start)} seconds)") unless quiet
|
279
|
+
true
|
280
|
+
else
|
281
|
+
failed_to_log(msg)
|
282
|
+
end
|
283
|
+
else
|
284
|
+
failed_to_log(msg)
|
285
|
+
end
|
286
|
+
rescue
|
287
|
+
failed_to_log("Unable to #{msg}. '#{$!}'")
|
288
|
+
end
|
289
|
+
|
290
|
+
def wait_until_text(browser, strg, desc = '', timeout = 60)
|
291
|
+
if not strg.class.to_s.match('String')
|
292
|
+
raise "#{__method__} requires String for search target. #{strg.class} is not supported."
|
293
|
+
end
|
294
|
+
wait_until(browser, "'#{strg}' #{desc}", timeout) { browser.text.include? strg }
|
295
|
+
end
|
296
|
+
|
297
|
+
alias wait_until_by_text wait_until_text
|
298
|
+
|
299
|
+
def wait_until_by_link_text(browser, strg, desc = '')
|
300
|
+
wait_until_exists(browser, :link, :text, strg, desc)
|
301
|
+
end
|
302
|
+
|
303
|
+
def wait_until_enabled(browser, what, how, value, desc = '')
|
304
|
+
# TODO: This can be simplified
|
305
|
+
start = Time.now.to_f
|
306
|
+
begin
|
307
|
+
case what
|
308
|
+
when :link
|
309
|
+
Watir::Wait.until { browser.link(how, value).enabled? }
|
310
|
+
when :button
|
311
|
+
Watir::Wait.until { browser.button(how, value).enabled? }
|
312
|
+
when :radio
|
313
|
+
Watir::Wait.until { browser.radio(how, value).enabled? }
|
314
|
+
when :checkbox
|
315
|
+
Watir::Wait.until { browser.checkbox(how, value).enabled? }
|
316
|
+
when :div
|
317
|
+
Watir::Wait.until { browser.div(how, value).enabled? }
|
318
|
+
when :select_list
|
319
|
+
Watir::Wait.until { browser.select_list(how, value).enabled? }
|
320
|
+
when :text_field
|
321
|
+
Watir::Wait.until { browser.text_field(how, value).enabled? }
|
322
|
+
when :table
|
323
|
+
Watir::Wait.until { browser.table(how, value).enabled? }
|
324
|
+
else
|
325
|
+
raise "#{__method__}: Element #{what} not supported."
|
326
|
+
end
|
327
|
+
rescue => e
|
328
|
+
if e.class.to_s =~ /TimeOutException/
|
329
|
+
failed_to_log("Wait until (#{what} :#{how}=>#{value}) enabled. #{desc}: '#{$!}' #{desc}")
|
330
|
+
return false
|
331
|
+
elsif not rescue_me(e, __method__, "#{block.to_s}", "#{browser.class}")
|
332
|
+
raise e
|
333
|
+
end
|
334
|
+
end
|
335
|
+
stop = Time.now.to_f
|
336
|
+
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
337
|
+
# sleep 1
|
338
|
+
if validate(browser, @myName, __LINE__)
|
339
|
+
passed_to_log("Wait until (#{what} :#{how}=>#{value}) enabled. #{desc} (#{stop - start} seconds)")
|
340
|
+
true
|
341
|
+
end
|
342
|
+
rescue
|
343
|
+
failed_to_log("Unable to complete wait until (#{what} :#{how}=>#{value}) enabled. #{desc}: '#{$!}'")
|
344
|
+
end
|
345
|
+
|
346
|
+
def wait_until_visible(browser, element, how, what, desc = '')
|
347
|
+
start = Time.now.to_f
|
348
|
+
Watir::Wait.until(20) { browser.element(how, what).exists? }
|
349
|
+
begin
|
350
|
+
case element
|
351
|
+
when :link
|
352
|
+
Watir::Wait.until { browser.link(how, what).visible? }
|
353
|
+
when :button
|
354
|
+
Watir::Wait.until { browser.button(how, what).visible? }
|
355
|
+
when :radio
|
356
|
+
Watir::Wait.until { browser.radio(how, what).visible? }
|
357
|
+
when :checkbox
|
358
|
+
Watir::Wait.until { browser.checkbox(how, what).visible? }
|
359
|
+
when :div
|
360
|
+
Watir::Wait.until { browser.div(how, what).visible? }
|
361
|
+
when :select_list
|
362
|
+
Watir::Wait.until { browser.select_list(how, what).visible? }
|
363
|
+
when :text_field
|
364
|
+
Watir::Wait.until { browser.text_field(how, what).visible? }
|
365
|
+
else
|
366
|
+
Watir::Wait.until { browser.element(how, what).visible? }
|
367
|
+
# raise "#{__method__}: Element #{what} not supported."
|
368
|
+
end
|
369
|
+
rescue => e
|
370
|
+
if e.class.to_s =~ /TimeOutException/
|
371
|
+
failed_to_log("Wait until (#{what} :#{how}=>#{what}) visible. #{desc}: '#{$!}' #{desc}")
|
372
|
+
return false
|
373
|
+
elsif not rescue_me(e, __method__, '', "#{browser.class}")
|
374
|
+
raise e
|
375
|
+
end
|
376
|
+
end
|
377
|
+
stop = Time.now.to_f
|
378
|
+
#debug_to_log("#{__method__}: start:#{start} stop:#{stop}")
|
379
|
+
# sleep 1
|
380
|
+
if validate(browser, @myName, __LINE__)
|
381
|
+
passed_to_log("Wait until (#{element} :#{how}=>#{what}) visible. #{desc} (#{stop - start} seconds)")
|
382
|
+
true
|
383
|
+
end
|
384
|
+
rescue
|
385
|
+
failed_to_log("Unable to complete wait until (#{element} :#{how}=>#{what}) visible. #{desc}: '#{$!}'")
|
386
|
+
end
|
387
|
+
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Awetestlib
|
2
|
+
class Runner
|
3
|
+
def initialize(options = {})
|
4
|
+
build_class = "Awetestlib::#{check_script_type(options[:script_type])}::Runner".constantize
|
5
|
+
build_class.new(options).start
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_script_type(script_type)
|
9
|
+
case script_type
|
10
|
+
when "Regression" ; "Regression" #Should this be regression? possible rename
|
11
|
+
else ; script_type
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/lib/awetestlib.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'yaml'
|
1
|
+
#require 'yaml' #Couldn't find use anywhere
|
2
2
|
require 'active_support/core_ext/hash'
|
3
3
|
|
4
4
|
module Awetestlib
|
@@ -25,15 +25,15 @@ module Awetestlib
|
|
25
25
|
#require 'active_support/inflector'
|
26
26
|
#require 'active_support/core_ext/object'
|
27
27
|
#require 'active_support/core_ext/hash'
|
28
|
-
|
28
|
+
require 'awetestlib/runner'
|
29
29
|
require 'andand'
|
30
|
-
require 'regression/runner'
|
30
|
+
require 'awetestlib/regression/runner'
|
31
31
|
|
32
32
|
|
33
33
|
if USING_OSX
|
34
34
|
require 'appscript'
|
35
35
|
end
|
36
36
|
|
37
|
-
require 'roo'
|
37
|
+
#require 'roo' #moved to awetestlib runner
|
38
38
|
|
39
39
|
end
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
module Demo
|
2
|
+
def run
|
3
|
+
browser = open_browser
|
4
|
+
login(browser)
|
5
|
+
test_zoho(browser)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_account_lookup(browser)
|
9
|
+
mark_testlevel('Account Lookup', 1)
|
10
|
+
browser.image(:title, 'Account Name Lookup').click
|
11
|
+
sleep_for(5)
|
12
|
+
popup = attach_browser_by_url(browser, /Parent/)
|
13
|
+
# TODO: This should be transparent:
|
14
|
+
if @browserAbbrev == "FF"
|
15
|
+
popup = browser
|
16
|
+
end
|
17
|
+
set_textfield_by_name(popup, 'fldValue', 'test')
|
18
|
+
click_button_by_value(popup, 'Go')
|
19
|
+
popup.link(:text, /Test Account/).click
|
20
|
+
#browser = attach_browser_by_url(browser, /ShowHomePage/)
|
21
|
+
#validate_textfield_value_by_name(browser, /Parent Account/, 'Test Account #007')
|
22
|
+
end
|
23
|
+
|
24
|
+
def login(browser)
|
25
|
+
mark_testlevel('Zoho Login', 2)
|
26
|
+
user = "joeklienwatir@gmail.com" #@zohologin.cell(2,2)
|
27
|
+
password = "watir001" #@zohologin.cell(2,3)
|
28
|
+
go_to_url(browser, "https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css")
|
29
|
+
#browser.goto("https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css")
|
30
|
+
set_textfield_by_name(browser, 'lid', user)
|
31
|
+
set_textfield_by_name(browser, 'pwd', password)
|
32
|
+
click_button_by_value(browser, 'Sign In')
|
33
|
+
go_to_url(browser, url = 'https://crm.zoho.com/crm/ShowHomePage.do')
|
34
|
+
validate_text(browser, 'Welcome joeklienwatir at Software')
|
35
|
+
#click_text(browser, 'Old Version')
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def navigate_to_crm(browser)
|
40
|
+
mark_testlevel('Navigate to CRM', 1)
|
41
|
+
click_text(browser, 'CRM')
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_zoho(browser)
|
45
|
+
#get_variables("#{@myRoot}/zoho_variables.xls")
|
46
|
+
navigate_to_crm(browser) #In Project Util
|
47
|
+
create_account(browser)
|
48
|
+
#create_blank_new_account(browser)
|
49
|
+
#export_accounts(browser)
|
50
|
+
#import_accounts(browser)
|
51
|
+
#signout(browser)
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_account(browser)
|
55
|
+
mark_testlevel('Create New Account', 3)
|
56
|
+
sleep_for(3)
|
57
|
+
click_link(browser, 'Accounts')
|
58
|
+
sleep_for(3)
|
59
|
+
click_button_by_value(browser, 'New Account')
|
60
|
+
sleep_for(5)
|
61
|
+
# Watir::Waiter::wait_until { browser.text_field(:name, /Account Name/).exist? }
|
62
|
+
# Watir::Waiter::wait_until { browser.text_field(:name, /Account Name/).visible? }
|
63
|
+
set_textfield_by_name(browser, /Account Name/, "Test Account #1")
|
64
|
+
set_textfield_by_name(browser, /Phone/, "415-333-2311")
|
65
|
+
|
66
|
+
test_account_lookup(browser) #In Project Util
|
67
|
+
browser = attach_browser_by_url(browser, /ShowHomePage/)
|
68
|
+
select_option_by_name_and_option_text(browser, /Account Type/, "Analyst")
|
69
|
+
select_option_by_name_and_option_text(browser, /Industry/, "ASP")
|
70
|
+
set_textfield_by_name(browser, /Billing Street/, "201 Main St")
|
71
|
+
set_textfield_by_name(browser, /Billing City/, "San Francisco")
|
72
|
+
set_textfield_by_name(browser, /Billing State/, "CA")
|
73
|
+
set_textfield_by_name(browser, /Billing Code/, "94102")
|
74
|
+
set_textfield_by_name(browser, /Billing Country/, "USA")
|
75
|
+
#browser.cell(:text, 'Billing to Shipping').click
|
76
|
+
click_button_by_id(browser, 'copyAddress')
|
77
|
+
sleep_for(5)
|
78
|
+
click_button_by_value(browser, 'Save')
|
79
|
+
|
80
|
+
sleep_for(8)
|
81
|
+
#wait_until_by_text(browser, 'Test Account #1')
|
82
|
+
validate_text(browser, "Test Account #1")
|
83
|
+
validate_text(browser, "random")
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
config=Demo
|
@@ -0,0 +1 @@
|
|
1
|
+
application.args=SAMPLE-SCRIPT -b FF
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
3
|
+
<type>org.netbeans.modules.ruby.rubyproject</type>
|
4
|
+
<configuration>
|
5
|
+
<data xmlns="http://www.netbeans.org/ns/ruby-project/1">
|
6
|
+
<name>Netbeans</name>
|
7
|
+
<source-roots>
|
8
|
+
<root id="src.dir"/>
|
9
|
+
</source-roots>
|
10
|
+
<test-roots/>
|
11
|
+
</data>
|
12
|
+
</configuration>
|
13
|
+
</project>
|
@@ -0,0 +1 @@
|
|
1
|
+
sample_rubymine
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/sample_rubymine.iml" filepath="$PROJECT_DIR$/.idea/sample_rubymine.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
5
|
+
<orderEntry type="inheritedJdk" />
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
7
|
+
</component>
|
8
|
+
</module>
|
9
|
+
|