awetestlib 0.1.29pre4-x86-mingw32 → 0.1.29-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +123 -123
- data/bin/awetestlib-android-setup.rb +28 -28
- data/bin/awetestlib-cucumber-setup.rb +30 -30
- data/bin/awetestlib-driver-setup.rb +22 -22
- data/bin/awetestlib-helpers.rb +42 -42
- data/bin/awetestlib-mobile-app-setup.rb +32 -32
- data/bin/awetestlib-netbeans-setup.rb +60 -60
- data/bin/awetestlib-regression-setup.rb +30 -30
- data/bin/awetestlib-rubymine-setup.rb +45 -45
- data/lib/awetestlib/logging.rb +366 -366
- data/lib/awetestlib/regression/browser.rb +1378 -1385
- data/lib/awetestlib/regression/drag_and_drop.rb +3 -4
- data/lib/awetestlib/regression/runner.rb +2 -3
- data/lib/awetestlib/regression/tables.rb +9 -17
- data/lib/awetestlib/regression/user_input.rb +1 -1
- data/lib/awetestlib/regression/utilities.rb +24 -82
- data/lib/awetestlib/regression/validations.rb +1075 -1094
- 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 +354 -354
- metadata +8 -26
- 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/test/demo_wwd.rb +0 -7
@@ -1,1094 +1,1075 @@
|
|
1
|
-
module Awetestlib
|
2
|
-
module Regression
|
3
|
-
# Contains methods to verify content, accessibility, or appearance of page elements.
|
4
|
-
module Validations
|
5
|
-
|
6
|
-
# @!group Core
|
7
|
-
|
8
|
-
# Verify that element style attribute contains expected value in style *type*.
|
9
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
10
|
-
# @param [Symbol] element The kind of element to click. Must be one of the elements recognized by Watir.
|
11
|
-
# Some common values are :link, :button, :image, :div, :span.
|
12
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
13
|
-
# Valid values depend on the kind of element.
|
14
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
15
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
16
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
17
|
-
# @param [String] type The name of the style type (sub-attribute) where *expected* is to be found.
|
18
|
-
# @param [String] expected The value in *type* expected.
|
19
|
-
# @return [Boolean] True if the style type contains the expected value
|
20
|
-
#
|
21
|
-
def validate_style_value(browser, element, how, what, type, expected, desc = '')
|
22
|
-
#TODO: works only with watir-webdriver
|
23
|
-
msg = build_message("Expected Style #{type} value '#{expected}' in #{element} with #{how} = #{what}", desc)
|
24
|
-
case element
|
25
|
-
when :link
|
26
|
-
actual = browser.link(how
|
27
|
-
when :button
|
28
|
-
actual = browser.button(how
|
29
|
-
when :image
|
30
|
-
actual = browser.image(how
|
31
|
-
when :span
|
32
|
-
actual = browser.span(how
|
33
|
-
when :div
|
34
|
-
actual = browser.div(how
|
35
|
-
else
|
36
|
-
if browser.element(how
|
37
|
-
actual = browser.element(how
|
38
|
-
else
|
39
|
-
failed_to_log("#{msg}: Element #{element} does not repond to style command.")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
if expected == actual
|
43
|
-
passed_to_log(msg)
|
44
|
-
true
|
45
|
-
else
|
46
|
-
failed_to_log(msg)
|
47
|
-
end
|
48
|
-
rescue
|
49
|
-
failed_to_log(
|
50
|
-
end
|
51
|
-
|
52
|
-
def validate_style_greater_than_value(browser, element, how, what, type, value, desc = '')
|
53
|
-
case element
|
54
|
-
when :link
|
55
|
-
actual_value = browser.link(how
|
56
|
-
when :button
|
57
|
-
actual_value = browser.button(how
|
58
|
-
when :image
|
59
|
-
actual_value = browser.image(how
|
60
|
-
when :span
|
61
|
-
actual_value = browser.span(how
|
62
|
-
when :div
|
63
|
-
actual_value = browser.div(how
|
64
|
-
else
|
65
|
-
actual_value = browser.element(how
|
66
|
-
end
|
67
|
-
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
68
|
-
|
69
|
-
if actual_value.to_i > value.to_i
|
70
|
-
passed_to_log(msg)
|
71
|
-
elsif actual_value.to_i >~ value.to_i
|
72
|
-
passed_to_log(msg)
|
73
|
-
else
|
74
|
-
failed_to_log(msg)
|
75
|
-
end
|
76
|
-
rescue
|
77
|
-
|
78
|
-
# sleep_for(1)
|
79
|
-
end
|
80
|
-
|
81
|
-
alias validate_style_greaterthan_value validate_style_greater_than_value
|
82
|
-
|
83
|
-
def validate_style_less_than_value(browser, element, how, what, type, value, desc = '')
|
84
|
-
case element
|
85
|
-
when :link
|
86
|
-
actual_value = browser.link(how
|
87
|
-
when :button
|
88
|
-
actual_value = browser.button(how
|
89
|
-
when :image
|
90
|
-
actual_value = browser.image(how
|
91
|
-
when :span
|
92
|
-
actual_value = browser.span(how
|
93
|
-
when :div
|
94
|
-
actual_value = browser.div(how
|
95
|
-
else
|
96
|
-
actual_value = browser.element(how
|
97
|
-
end
|
98
|
-
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
99
|
-
|
100
|
-
if actual_value.to_i < value.to_i
|
101
|
-
passed_to_log(msg)
|
102
|
-
elsif actual_value.to_i <~ value.to_i
|
103
|
-
passed_to_log(msg)
|
104
|
-
else
|
105
|
-
failed_to_log(msg)
|
106
|
-
end
|
107
|
-
rescue
|
108
|
-
|
109
|
-
# sleep_for(1)
|
110
|
-
end
|
111
|
-
|
112
|
-
alias validate_style_lessthan_value validate_style_less_than_value
|
113
|
-
|
114
|
-
# @todo Clarify and rename
|
115
|
-
def arrays_match?(exp, act, dir, col, org = nil, desc = '')
|
116
|
-
if exp == act
|
117
|
-
passed_to_log("Click on #{dir} column '#{col}' produces expected sorted list. #{desc}")
|
118
|
-
true
|
119
|
-
else
|
120
|
-
failed_to_log("Click on #{dir} column '#{col}' fails to produce expected sorted list. #{desc}")
|
121
|
-
debug_to_log("Original order ['#{org.join("', '")}']") if org
|
122
|
-
debug_to_log("Expected order ['#{exp.join("', '")}']")
|
123
|
-
debug_to_log(" Actual order ['#{act.join("', '")}']")
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
alias arrays_match arrays_match?
|
128
|
-
|
129
|
-
# Verify that a DOM element is enabled.
|
130
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
131
|
-
# @param [Symbol] element The kind of element to click. Must be one of the elements recognized by Watir.
|
132
|
-
# Some common values are :link, :button, :image, :div, :span.
|
133
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
134
|
-
# Valid values depend on the kind of element.
|
135
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
136
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
137
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
138
|
-
# @return [Boolean] Returns true if the element is enabled.
|
139
|
-
def enabled?(browser, element, how, what, desc = '')
|
140
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
141
|
-
msg = build_message("#{element.to_s.titlecase} by #{how}=>'#{what}' is enabled.}", desc)
|
142
|
-
case element
|
143
|
-
when :textfield, :textarea, :text_area, :text_field
|
144
|
-
rtrn = browser.text_field(how, what).enabled? and not browser.text_field(how, what).readonly?
|
145
|
-
when :select_list, :selectlist
|
146
|
-
rtrn = browser.select_list(how, what).enabled?
|
147
|
-
else
|
148
|
-
rtrn = browser.element(how, what).enabled?
|
149
|
-
end
|
150
|
-
if rtrn
|
151
|
-
passed_to_log("#{msg}")
|
152
|
-
true
|
153
|
-
else
|
154
|
-
failed_to_log("#{msg}")
|
155
|
-
end
|
156
|
-
rtrn
|
157
|
-
rescue
|
158
|
-
failed_to_log(
|
159
|
-
end
|
160
|
-
|
161
|
-
alias validate_enabled enabled?
|
162
|
-
|
163
|
-
# Verify that a DOM element is disabled.
|
164
|
-
# @param (see #enabled?)
|
165
|
-
# @return [Boolean] Returns true if the element is disabled.
|
166
|
-
def disabled?(browser, element, how, what, desc = '')
|
167
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
168
|
-
msg = build_message("#{element.to_s.titlecase} by #{how}=>'#{what}' is disabled.", desc)
|
169
|
-
case element
|
170
|
-
when :textfield, :textarea, :text_area, :text_field
|
171
|
-
rtrn = browser.text_field(how, what).disabled? ||
|
172
|
-
browser.text_field(how, what).readonly?
|
173
|
-
when :select_list, :selectlist
|
174
|
-
rtrn = browser.select_list(how, what).disabled?
|
175
|
-
when :checkbox
|
176
|
-
rtrn = browser.checkbox(how, what).disabled?
|
177
|
-
when :radio
|
178
|
-
rtrn = browser.radio(how, what).disabled?
|
179
|
-
when :button
|
180
|
-
rtrn = browser.button(how, what).disabled?
|
181
|
-
else
|
182
|
-
rtrn = browser.element(how, what).disabled?
|
183
|
-
end
|
184
|
-
if rtrn
|
185
|
-
passed_to_log("#{msg}")
|
186
|
-
true
|
187
|
-
else
|
188
|
-
failed_to_log("#{msg}")
|
189
|
-
end
|
190
|
-
rtrn
|
191
|
-
rescue
|
192
|
-
failed_to_log(
|
193
|
-
end
|
194
|
-
|
195
|
-
alias validate_not_enabled disabled?
|
196
|
-
alias validate_disabled disabled?
|
197
|
-
|
198
|
-
# Verify that a DOM element is visible.
|
199
|
-
# @param (see #enabled?)
|
200
|
-
# @return [Boolean] Returns true if the element is visible.
|
201
|
-
def visible?(browser, element, how, what, desc = '')
|
202
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
203
|
-
msg = build_message("#{element.to_s.titlecase} #{how}=>'#{what}' is visible.", desc)
|
204
|
-
rtrn = false
|
205
|
-
case how
|
206
|
-
when :index
|
207
|
-
target = get_element(browser, element, how, what)
|
208
|
-
if target.visible?
|
209
|
-
rtrn = true
|
210
|
-
end
|
211
|
-
else
|
212
|
-
if browser.element(how, what).visible?
|
213
|
-
rtrn = true
|
214
|
-
end
|
215
|
-
end
|
216
|
-
if rtrn
|
217
|
-
passed_to_log("#{msg}")
|
218
|
-
else
|
219
|
-
failed_to_log("#{msg}")
|
220
|
-
end
|
221
|
-
rtrn
|
222
|
-
rescue
|
223
|
-
failed_to_log(
|
224
|
-
end
|
225
|
-
|
226
|
-
alias validate_visible visible?
|
227
|
-
|
228
|
-
# Verify that a DOM element is not visible.
|
229
|
-
# @param (see #enabled?)
|
230
|
-
# @return [Boolean] Returns true if the element is not visible.
|
231
|
-
def not_visible?(browser, element, how, what, desc = '')
|
232
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
233
|
-
msg = build_message("#{element.to_s.titlecase} #{how}=>'#{what}' is not visible.", desc)
|
234
|
-
rtrn = false
|
235
|
-
case how
|
236
|
-
when :index
|
237
|
-
target = get_element(browser, element, how, what)
|
238
|
-
if not target.visible?
|
239
|
-
rtrn = true
|
240
|
-
end
|
241
|
-
else
|
242
|
-
if not browser.element(how, what).visible?
|
243
|
-
rtrn = true
|
244
|
-
end
|
245
|
-
end
|
246
|
-
if rtrn
|
247
|
-
passed_to_log("#{msg}")
|
248
|
-
else
|
249
|
-
failed_to_log("#{msg}")
|
250
|
-
end
|
251
|
-
rtrn
|
252
|
-
rescue
|
253
|
-
failed_to_log(
|
254
|
-
end
|
255
|
-
|
256
|
-
alias validate_not_visible not_visible?
|
257
|
-
|
258
|
-
# Verify that a checkbox is checked.
|
259
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
260
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
261
|
-
# Valid values depend on the kind of element.
|
262
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
263
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
264
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
265
|
-
# @return [Boolean] Returns true if the checkbox is checked.
|
266
|
-
def checked?(browser, how, what, desc = '')
|
267
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
268
|
-
msg = build_message("Checkbox #{how}=>#{what} is checked.", desc)
|
269
|
-
if browser.checkbox(how, what).checked?
|
270
|
-
passed_to_log(msg)
|
271
|
-
true
|
272
|
-
else
|
273
|
-
failed_to_log(msg)
|
274
|
-
end
|
275
|
-
rescue
|
276
|
-
failed_to_log(
|
277
|
-
end
|
278
|
-
|
279
|
-
alias checkbox_checked? checked?
|
280
|
-
alias checkbox_set? checked?
|
281
|
-
|
282
|
-
# Verify that a checkbox is not checked.
|
283
|
-
# @param (see #checked?)
|
284
|
-
# @return [Boolean] Returns true if the checkbox is not checked.
|
285
|
-
def not_checked?(browser, how, what, desc = '')
|
286
|
-
#TODO: handle identification of element with value as well as other attribute. see exists?
|
287
|
-
msg = build_message("Checkbox #{how}=>#{what} is not checked.", desc)
|
288
|
-
if not browser.checkbox(how, what).checked?
|
289
|
-
passed_to_log(msg)
|
290
|
-
true
|
291
|
-
else
|
292
|
-
failed_to_log(msg)
|
293
|
-
end
|
294
|
-
rescue
|
295
|
-
failed_to_log(
|
296
|
-
end
|
297
|
-
|
298
|
-
alias checkbox_checked? checked?
|
299
|
-
alias checkbox_set? checked?
|
300
|
-
|
301
|
-
# Verify that a DOM element exists on the page.
|
302
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
303
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
304
|
-
# Valid values depend on the kind of element.
|
305
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
306
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
307
|
-
# @param [String, Regexp] value A string or a regular expression to be found in the value attribute of the element.
|
308
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
309
|
-
# @return [Boolean] True if the element exists.
|
310
|
-
def exists?(browser, element, how, what, value = nil, desc = '')
|
311
|
-
msg2 = "and value=>'#{value}' " if value
|
312
|
-
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'exists.', desc)
|
313
|
-
case element
|
314
|
-
when :link
|
315
|
-
bool = browser.link(how, what).exists?
|
316
|
-
else
|
317
|
-
bool = browser.element(how, what).exists?
|
318
|
-
end
|
319
|
-
if bool
|
320
|
-
passed_to_log("#{msg}? #{desc}")
|
321
|
-
true
|
322
|
-
else
|
323
|
-
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
324
|
-
end
|
325
|
-
rescue
|
326
|
-
failed_to_log(
|
327
|
-
end
|
328
|
-
|
329
|
-
# Verify that a DOM element does not exist on the page.
|
330
|
-
# @param (see #exists?)
|
331
|
-
# @return [Boolean] True if the element does not exist.
|
332
|
-
def does_not_exist?(browser, element, how, what, value = nil, desc = '')
|
333
|
-
msg2 = "and value=>'#{value}' " if value
|
334
|
-
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'does not exist.', desc)
|
335
|
-
case element
|
336
|
-
when :link
|
337
|
-
bool = browser.link(how, what).exists?
|
338
|
-
else
|
339
|
-
bool = browser.element(how, what).exists?
|
340
|
-
end
|
341
|
-
if bool
|
342
|
-
failed_to_log(msg)
|
343
|
-
else
|
344
|
-
passed_to_log(msg)
|
345
|
-
true
|
346
|
-
end
|
347
|
-
rescue
|
348
|
-
failed_to_log(
|
349
|
-
end
|
350
|
-
|
351
|
-
alias not_exist? does_not_exist?
|
352
|
-
|
353
|
-
# Verify that a radio button is set.
|
354
|
-
# @param (see #checked?)
|
355
|
-
# @return [Boolean] Returns true if the radio button is set.
|
356
|
-
def set?(browser, how, what, desc = '', no_fail = false)
|
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
|
359
|
-
if browser.radio(how, what).set?
|
360
|
-
passed_to_log(msg)
|
361
|
-
true
|
362
|
-
else
|
363
|
-
if no_fail
|
364
|
-
passed_to_log("#{
|
365
|
-
else
|
366
|
-
failed_to_log(msg)
|
367
|
-
end
|
368
|
-
end
|
369
|
-
rescue
|
370
|
-
failed_to_log(
|
371
|
-
end
|
372
|
-
|
373
|
-
alias radio_set? set?
|
374
|
-
alias radio_checked? set?
|
375
|
-
alias radio_selected? set?
|
376
|
-
|
377
|
-
# Verify that a radio button is not set.
|
378
|
-
# @param (see #checked?)
|
379
|
-
# @return [Boolean] Returns true if the radio button is not set.
|
380
|
-
def not_set?(browser, how, what, desc = '', no_fail = false)
|
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
|
383
|
-
if not browser.radio(how, what).set?
|
384
|
-
passed_to_log(msg)
|
385
|
-
true
|
386
|
-
else
|
387
|
-
if no_fail
|
388
|
-
passed_to_log("#{
|
389
|
-
else
|
390
|
-
failed_to_log(msg)
|
391
|
-
end
|
392
|
-
end
|
393
|
-
rescue
|
394
|
-
failed_to_log(
|
395
|
-
end
|
396
|
-
|
397
|
-
alias radio_not_set? not_set?
|
398
|
-
alias radio_not_checked? not_set?
|
399
|
-
alias radio_not_selected? not_set?
|
400
|
-
|
401
|
-
# Verify that a radio button, identified by both the value (*what*) in attribute *how*
|
402
|
-
# and the *value* in its value attribute, is set.
|
403
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
404
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
405
|
-
# Valid values depend on the kind of element.
|
406
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
407
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
408
|
-
# @param [String, Regexp] value A string or a regular expression to be found in the value attribute of the element.
|
409
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
410
|
-
# @return [Boolean] Returns true if the radio button is set.
|
411
|
-
def radio_with_value_set?(browser, how, what, value, desc = '', no_fail = false)
|
412
|
-
msg2 = 'not' if no_fail
|
413
|
-
msg = build_message("Radio #{how}=>#{what} :value=>#{value} is", msg2, 'selected.', desc)
|
414
|
-
if browser.radio(how, what, value).set?
|
415
|
-
passed_to_log(msg)
|
416
|
-
true
|
417
|
-
else
|
418
|
-
if no_fail
|
419
|
-
passed_to_log(msg)
|
420
|
-
else
|
421
|
-
failed_to_log(msg)
|
422
|
-
end
|
423
|
-
end
|
424
|
-
rescue
|
425
|
-
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
426
|
-
end
|
427
|
-
|
428
|
-
alias radio_set_with_value? radio_with_value_set?
|
429
|
-
|
430
|
-
# Verify that a select list, identified by the value (*what*) in attribute *how*, contains an option with the
|
431
|
-
# value in *option*.
|
432
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
433
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
434
|
-
# Valid values depend on the kind of element.
|
435
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
436
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
437
|
-
# @param [String, Regexp] option A string or a regular expression to be found in the value attribute of the element.
|
438
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
439
|
-
# @return [Boolean] Returns true if the option is found.
|
440
|
-
def select_list_includes?(browser, how, what, option, desc = '')
|
441
|
-
msg = build_message("Select list #{how}=>#{what} includes option '#{option}'.", desc)
|
442
|
-
select_list = browser.select_list(how, what)
|
443
|
-
options = select_list.options
|
444
|
-
if option
|
445
|
-
if options.include?(option)
|
446
|
-
passed_to_log(msg)
|
447
|
-
true
|
448
|
-
else
|
449
|
-
failed_to_log(msg)
|
450
|
-
end
|
451
|
-
end
|
452
|
-
rescue
|
453
|
-
failed_to_log("Unable to verify #{msg}. '#{$!}'")
|
454
|
-
end
|
455
|
-
|
456
|
-
alias validate_select_list_contains select_list_includes?
|
457
|
-
alias select_list_contains? select_list_includes?
|
458
|
-
|
459
|
-
# Verify that a select list, identified by the value (*what*) in attribute *how*, contains an option with the
|
460
|
-
# value in *option*.
|
461
|
-
# @param (see #select_list_includes?)
|
462
|
-
# @return [Boolean] Returns true if the option is not found.
|
463
|
-
def select_list_does_not_include?(browser, how, what, option, desc = '')
|
464
|
-
msg = build_message("Select list #{how}=>#{what} does not include option '#{option}'.", desc)
|
465
|
-
select_list = browser.select_list(how, what)
|
466
|
-
options = select_list.options
|
467
|
-
if option
|
468
|
-
if not options.include?(option)
|
469
|
-
passed_to_log(msg)
|
470
|
-
true
|
471
|
-
else
|
472
|
-
failed_to_log(msg)
|
473
|
-
nil
|
474
|
-
end
|
475
|
-
end
|
476
|
-
rescue
|
477
|
-
failed_to_log("Unable to verify #{msg}. '#{$!}'")
|
478
|
-
end
|
479
|
-
|
480
|
-
# Compare strings for exact match and log results
|
481
|
-
# @param [String] actual The actual value as found in the application.
|
482
|
-
# @param [String] expected The value expected to be found.
|
483
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
484
|
-
# @return [Boolean] Returns true if actual exactly matches expected.
|
485
|
-
def string_equals?(actual, expected, desc = '')
|
486
|
-
msg = build_message("Actual string '#{actual}' equals expected '#{expected}'.", desc)
|
487
|
-
if actual == expected
|
488
|
-
passed_to_log("#{msg}")
|
489
|
-
true
|
490
|
-
else
|
491
|
-
failed_to_log("#{msg}")
|
492
|
-
end
|
493
|
-
rescue
|
494
|
-
failed_to_log("Unable to
|
495
|
-
end
|
496
|
-
|
497
|
-
alias validate_string_equal string_equals?
|
498
|
-
alias validate_string_equals string_equals?
|
499
|
-
alias text_equals string_equals?
|
500
|
-
alias text_equals? string_equals?
|
501
|
-
|
502
|
-
# Compare strings for no match and log results
|
503
|
-
# @param (see #string_equals?)
|
504
|
-
# @return [Boolean] Returns true if actual does not match expected.
|
505
|
-
def string_does_not_equal?(actual, expected, desc = '')
|
506
|
-
msg = build_message("Actual string '#{actual}' does not equal expected '#{expected}'.", desc)
|
507
|
-
if actual == expected
|
508
|
-
failed_to_log("#{msg} (#{__LINE__})")
|
509
|
-
true
|
510
|
-
else
|
511
|
-
passed_to_log("#{msg} (#{__LINE__})")
|
512
|
-
end
|
513
|
-
end
|
514
|
-
|
515
|
-
alias validate_string_not_equal string_does_not_equal?
|
516
|
-
alias validate_string_does_not_equal string_does_not_equal?
|
517
|
-
|
518
|
-
# Verify that date strings represent the same date, allowing for format differences.
|
519
|
-
# Compare strings for no match and log results
|
520
|
-
# @param (see #string_equals?)
|
521
|
-
# @param [Boolean] fail_on_format If set to true method will fail if the formats differ
|
522
|
-
# even though the dates/times match
|
523
|
-
# @return [Boolean] Returns true if actual does not match expected.
|
524
|
-
def date_string_equals?(actual, expected, desc = '', fail_on_format = true)
|
525
|
-
rtrn = false
|
526
|
-
if actual == expected
|
527
|
-
rtrn = true
|
528
|
-
elsif DateTime.parse(actual).to_s == DateTime.parse(expected).to_s
|
529
|
-
msg2 = "with different formatting. "
|
530
|
-
unless fail_on_format
|
531
|
-
rtrn = true
|
532
|
-
end
|
533
|
-
end
|
534
|
-
msg = build_message("Actual date '#{actual}' equals expected date '#{expected}'.", msg2, desc)
|
535
|
-
if rtrn
|
536
|
-
passed_to_log("#{msg}")
|
537
|
-
else
|
538
|
-
failed_to_log("#{msg}")
|
539
|
-
end
|
540
|
-
rtrn
|
541
|
-
rescue
|
542
|
-
failed_to_log("Unable to verify that #{msg}. #{$!}")
|
543
|
-
end
|
544
|
-
|
545
|
-
# Verify that a DOM element is in read-only state.
|
546
|
-
# @param (see #enabled?)
|
547
|
-
# @return [Boolean] Returns true if the element is in read-only state.
|
548
|
-
def read_only?(browser, element, how, what, value = nil, desc = '')
|
549
|
-
msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
|
550
|
-
msg << "and value=>'#{value}' " if value
|
551
|
-
msg << "read only"
|
552
|
-
e = get_element(browser, element, how, what, value)
|
553
|
-
if e
|
554
|
-
if e.readonly?
|
555
|
-
passed_to_log("#{msg}? #{desc}")
|
556
|
-
true
|
557
|
-
else
|
558
|
-
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
559
|
-
end
|
560
|
-
end
|
561
|
-
rescue
|
562
|
-
failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
|
563
|
-
end
|
564
|
-
|
565
|
-
# Verify that a DOM element is not in read-only state.
|
566
|
-
# @param (see #enabled?)
|
567
|
-
# @return [Boolean] Returns true if the element is not in read-only state.
|
568
|
-
def not_read_only?(browser, element, how, what, value = nil, desc = '')
|
569
|
-
msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
|
570
|
-
msg << "and value=>'#{value}' " if value
|
571
|
-
msg << "is not read only"
|
572
|
-
e = get_element(browser, element, how, what, value)
|
573
|
-
if e
|
574
|
-
if e.readonly?
|
575
|
-
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
576
|
-
else
|
577
|
-
passed_to_log("#{msg}? #{desc}")
|
578
|
-
true
|
579
|
-
end
|
580
|
-
end
|
581
|
-
rescue
|
582
|
-
failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
|
583
|
-
end
|
584
|
-
|
585
|
-
# Verify that a DOM element is ready, i.e., both exists and is enabled.
|
586
|
-
# @param (see #exists?)
|
587
|
-
# @return [Boolean] Returns true if the element is ready.
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
e
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
#
|
604
|
-
# @param [
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
# @param [String
|
609
|
-
# @param [String]
|
610
|
-
# @
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
actual
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
"
|
631
|
-
|
632
|
-
)
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
alias
|
641
|
-
|
642
|
-
|
643
|
-
#
|
644
|
-
# @param [
|
645
|
-
#
|
646
|
-
#
|
647
|
-
#
|
648
|
-
# @param [String, Regexp]
|
649
|
-
# @param [String
|
650
|
-
# @
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
contents
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
#
|
666
|
-
# @param [
|
667
|
-
#
|
668
|
-
#
|
669
|
-
#
|
670
|
-
# @param [String
|
671
|
-
# @
|
672
|
-
|
673
|
-
|
674
|
-
msg
|
675
|
-
|
676
|
-
contents
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
alias
|
688
|
-
|
689
|
-
|
690
|
-
#
|
691
|
-
# @param [
|
692
|
-
#
|
693
|
-
#
|
694
|
-
#
|
695
|
-
# @param [String
|
696
|
-
# @param [String]
|
697
|
-
# @
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
#
|
713
|
-
# @param [
|
714
|
-
# @param [String
|
715
|
-
# @
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
alias
|
775
|
-
alias
|
776
|
-
alias
|
777
|
-
alias
|
778
|
-
alias iepopup_exist popup_is_browser?
|
779
|
-
alias
|
780
|
-
alias iepopup_exists popup_is_browser?
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
cls
|
809
|
-
cls.gsub!('
|
810
|
-
cls
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
passed_to_log("#{msg}")
|
825
|
-
true
|
826
|
-
else
|
827
|
-
if skip_fail
|
828
|
-
debug_to_log("#{cls}
|
829
|
-
else
|
830
|
-
failed_to_log("#{msg}")
|
831
|
-
end
|
832
|
-
#debug_to_log("\n#{myText}")
|
833
|
-
end
|
834
|
-
rescue
|
835
|
-
failed_to_log(
|
836
|
-
end
|
837
|
-
|
838
|
-
alias validate_link validate_text
|
839
|
-
|
840
|
-
def text_in_element_equals?(browser, element, how, what, expected, desc = '')
|
841
|
-
msg = build_message("Expected exact text '#{expected}' in #{element} :#{how}=>#{what}.", desc)
|
842
|
-
text = ''
|
843
|
-
who = browser.element(how, what)
|
844
|
-
if who
|
845
|
-
text = who.text
|
846
|
-
if text == expected
|
847
|
-
passed_to_log(msg)
|
848
|
-
true
|
849
|
-
else
|
850
|
-
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
851
|
-
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
852
|
-
failed_to_log("#{msg} Found '#{text}'.")
|
853
|
-
end
|
854
|
-
end
|
855
|
-
rescue
|
856
|
-
failed_to_log(
|
857
|
-
end
|
858
|
-
|
859
|
-
def element_contains_text?(browser, element, how, what, expected, desc = '')
|
860
|
-
msg = build_message("Element #{element} :{how}=>#{what} contains text '#{expected}'.", desc)
|
861
|
-
case how
|
862
|
-
when :href
|
863
|
-
who = browser.
|
864
|
-
else
|
865
|
-
who = browser.
|
866
|
-
end
|
867
|
-
if who
|
868
|
-
text = who.text
|
869
|
-
if expected and expected.length > 0
|
870
|
-
rgx = Regexp.new(Regexp.escape(expected))
|
871
|
-
if text =~ rgx
|
872
|
-
passed_to_log(msg)
|
873
|
-
true
|
874
|
-
else
|
875
|
-
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
876
|
-
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
877
|
-
failed_to_log("#{msg} Found '#{text}'. #{desc}")
|
878
|
-
end
|
879
|
-
else
|
880
|
-
if text.length > 0
|
881
|
-
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
882
|
-
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
883
|
-
failed_to_log("#{msg} Found '#{text}'. #{desc}")
|
884
|
-
else
|
885
|
-
passed_to_log(msg)
|
886
|
-
true
|
887
|
-
end
|
888
|
-
end
|
889
|
-
end
|
890
|
-
rescue
|
891
|
-
failed_to_log(
|
892
|
-
end
|
893
|
-
|
894
|
-
def validate_select_list(browser, how, what, opt_type, list = nil,
|
895
|
-
mark_testlevel("(#{how}=>#{what})")
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
debug_to_report("
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
cnt
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
else
|
982
|
-
failed_to_log("Expected option [#{list}] was not
|
983
|
-
end
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
if
|
1034
|
-
target
|
1035
|
-
else
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
# @!endgroup Core
|
1077
|
-
|
1078
|
-
# @!group Deprecated
|
1079
|
-
# @deprecated
|
1080
|
-
def self.included(mod)
|
1081
|
-
# puts "RegressionSupport::Validations extended by #{mod}"
|
1082
|
-
end
|
1083
|
-
|
1084
|
-
# @deprecated Use #message_to_log
|
1085
|
-
def validate_message(browser, message)
|
1086
|
-
message_to_log(message)
|
1087
|
-
end
|
1088
|
-
|
1089
|
-
# @!endgroup Deprecated
|
1090
|
-
|
1091
|
-
end
|
1092
|
-
end
|
1093
|
-
end
|
1094
|
-
|
1
|
+
module Awetestlib
|
2
|
+
module Regression
|
3
|
+
# Contains methods to verify content, accessibility, or appearance of page elements.
|
4
|
+
module Validations
|
5
|
+
|
6
|
+
# @!group Core
|
7
|
+
|
8
|
+
# Verify that element style attribute contains expected value in style *type*.
|
9
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
10
|
+
# @param [Symbol] element The kind of element to click. Must be one of the elements recognized by Watir.
|
11
|
+
# Some common values are :link, :button, :image, :div, :span.
|
12
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
13
|
+
# Valid values depend on the kind of element.
|
14
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
15
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
16
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
17
|
+
# @param [String] type The name of the style type (sub-attribute) where *expected* is to be found.
|
18
|
+
# @param [String] expected The value in *type* expected.
|
19
|
+
# @return [Boolean] True if the style type contains the expected value
|
20
|
+
#
|
21
|
+
def validate_style_value(browser, element, how, what, type, expected, desc = '')
|
22
|
+
#TODO: works only with watir-webdriver
|
23
|
+
msg = build_message("Expected Style #{type} value '#{expected}' in #{element} with #{how} = #{what}", desc)
|
24
|
+
case element
|
25
|
+
when :link
|
26
|
+
actual = browser.link(how => what).style type
|
27
|
+
when :button
|
28
|
+
actual = browser.button(how => what).style type
|
29
|
+
when :image
|
30
|
+
actual = browser.image(how => what).style type
|
31
|
+
when :span
|
32
|
+
actual = browser.span(how => what).style type
|
33
|
+
when :div
|
34
|
+
actual = browser.div(how => what).style type
|
35
|
+
else
|
36
|
+
if browser.element(how => what).responds_to?("style")
|
37
|
+
actual = browser.element(how => what).style type
|
38
|
+
else
|
39
|
+
failed_to_log("#{msg}: Element #{element} does not repond to style command.")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
if expected == actual
|
43
|
+
passed_to_log(msg)
|
44
|
+
true
|
45
|
+
else
|
46
|
+
failed_to_log(msg)
|
47
|
+
end
|
48
|
+
rescue
|
49
|
+
failed_to_log("Unable to verify that #{msg} '#{$!}'")
|
50
|
+
end
|
51
|
+
|
52
|
+
def validate_style_greater_than_value(browser, element, how, what, type, value, desc = '')
|
53
|
+
case element
|
54
|
+
when :link
|
55
|
+
actual_value = browser.link(how => what).style type
|
56
|
+
when :button
|
57
|
+
actual_value = browser.button(how => what).style type
|
58
|
+
when :image
|
59
|
+
actual_value = browser.image(how => what).style type
|
60
|
+
when :span
|
61
|
+
actual_value = browser.span(how => what).style type
|
62
|
+
when :div
|
63
|
+
actual_value = browser.div(how => what).style type
|
64
|
+
else
|
65
|
+
actual_value = browser.element(how => what).style type
|
66
|
+
end
|
67
|
+
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
68
|
+
|
69
|
+
if actual_value.to_i > value.to_i
|
70
|
+
passed_to_log(msg)
|
71
|
+
elsif actual_value.to_i >~ value.to_i
|
72
|
+
passed_to_log(msg)
|
73
|
+
else
|
74
|
+
failed_to_log(msg)
|
75
|
+
end
|
76
|
+
rescue
|
77
|
+
fail_to_log("Unable to verify #{msg} '#{$!}'")
|
78
|
+
# sleep_for(1)
|
79
|
+
end
|
80
|
+
|
81
|
+
alias validate_style_greaterthan_value validate_style_greater_than_value
|
82
|
+
|
83
|
+
def validate_style_less_than_value(browser, element, how, what, type, value, desc = '')
|
84
|
+
case element
|
85
|
+
when :link
|
86
|
+
actual_value = browser.link(how => what).style type
|
87
|
+
when :button
|
88
|
+
actual_value = browser.button(how => what).style type
|
89
|
+
when :image
|
90
|
+
actual_value = browser.image(how => what).style type
|
91
|
+
when :span
|
92
|
+
actual_value = browser.span(how => what).style type
|
93
|
+
when :div
|
94
|
+
actual_value = browser.div(how => what).style type
|
95
|
+
else
|
96
|
+
actual_value = browser.element(how => what).style type
|
97
|
+
end
|
98
|
+
msg = build_message("The CSS value for style #{type} in #{element} :#{how}=>#{what}: '#{actual_value}' is greater than #{value}.", desc)
|
99
|
+
|
100
|
+
if actual_value.to_i < value.to_i
|
101
|
+
passed_to_log(msg)
|
102
|
+
elsif actual_value.to_i <~ value.to_i
|
103
|
+
passed_to_log(msg)
|
104
|
+
else
|
105
|
+
failed_to_log(msg)
|
106
|
+
end
|
107
|
+
rescue
|
108
|
+
fail_to_log("Unable to verify #{msg} '#{$!}'")
|
109
|
+
# sleep_for(1)
|
110
|
+
end
|
111
|
+
|
112
|
+
alias validate_style_lessthan_value validate_style_less_than_value
|
113
|
+
|
114
|
+
# @todo Clarify and rename
|
115
|
+
def arrays_match?(exp, act, dir, col, org = nil, desc = '')
|
116
|
+
if exp == act
|
117
|
+
passed_to_log("Click on #{dir} column '#{col}' produces expected sorted list. #{desc}")
|
118
|
+
true
|
119
|
+
else
|
120
|
+
failed_to_log("Click on #{dir} column '#{col}' fails to produce expected sorted list. #{desc}")
|
121
|
+
debug_to_log("Original order ['#{org.join("', '")}']") if org
|
122
|
+
debug_to_log("Expected order ['#{exp.join("', '")}']")
|
123
|
+
debug_to_log(" Actual order ['#{act.join("', '")}']")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
alias arrays_match arrays_match?
|
128
|
+
|
129
|
+
# Verify that a DOM element is enabled.
|
130
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
131
|
+
# @param [Symbol] element The kind of element to click. Must be one of the elements recognized by Watir.
|
132
|
+
# Some common values are :link, :button, :image, :div, :span.
|
133
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
134
|
+
# Valid values depend on the kind of element.
|
135
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
136
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
137
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
138
|
+
# @return [Boolean] Returns true if the element is enabled.
|
139
|
+
def enabled?(browser, element, how, what, desc = '')
|
140
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
141
|
+
msg = build_message("#{element.to_s.titlecase} by #{how}=>'#{what}' is enabled.}", desc)
|
142
|
+
case element
|
143
|
+
when :textfield, :textarea, :text_area, :text_field
|
144
|
+
rtrn = browser.text_field(how, what).enabled? and not browser.text_field(how, what).readonly?
|
145
|
+
when :select_list, :selectlist
|
146
|
+
rtrn = browser.select_list(how, what).enabled?
|
147
|
+
else
|
148
|
+
rtrn = browser.element(how, what).enabled?
|
149
|
+
end
|
150
|
+
if rtrn
|
151
|
+
passed_to_log("#{msg}")
|
152
|
+
true
|
153
|
+
else
|
154
|
+
failed_to_log("#{msg}")
|
155
|
+
end
|
156
|
+
rtrn
|
157
|
+
rescue
|
158
|
+
failed_to_log("#Unable to verify that #{msg}': '#{$!}")
|
159
|
+
end
|
160
|
+
|
161
|
+
alias validate_enabled enabled?
|
162
|
+
|
163
|
+
# Verify that a DOM element is disabled.
|
164
|
+
# @param (see #enabled?)
|
165
|
+
# @return [Boolean] Returns true if the element is disabled.
|
166
|
+
def disabled?(browser, element, how, what, desc = '')
|
167
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
168
|
+
msg = build_message("#{element.to_s.titlecase} by #{how}=>'#{what}' is disabled.", desc)
|
169
|
+
case element
|
170
|
+
when :textfield, :textarea, :text_area, :text_field
|
171
|
+
rtrn = browser.text_field(how, what).disabled? ||
|
172
|
+
browser.text_field(how, what).readonly?
|
173
|
+
when :select_list, :selectlist
|
174
|
+
rtrn = browser.select_list(how, what).disabled?
|
175
|
+
when :checkbox
|
176
|
+
rtrn = browser.checkbox(how, what).disabled?
|
177
|
+
when :radio
|
178
|
+
rtrn = browser.radio(how, what).disabled?
|
179
|
+
when :button
|
180
|
+
rtrn = browser.button(how, what).disabled?
|
181
|
+
else
|
182
|
+
rtrn = browser.element(how, what).disabled?
|
183
|
+
end
|
184
|
+
if rtrn
|
185
|
+
passed_to_log("#{msg}")
|
186
|
+
true
|
187
|
+
else
|
188
|
+
failed_to_log("#{msg}")
|
189
|
+
end
|
190
|
+
rtrn
|
191
|
+
rescue
|
192
|
+
failed_to_log("#Unable to verify that #{msg}: '#{$!}'")
|
193
|
+
end
|
194
|
+
|
195
|
+
alias validate_not_enabled disabled?
|
196
|
+
alias validate_disabled disabled?
|
197
|
+
|
198
|
+
# Verify that a DOM element is visible.
|
199
|
+
# @param (see #enabled?)
|
200
|
+
# @return [Boolean] Returns true if the element is visible.
|
201
|
+
def visible?(browser, element, how, what, desc = '')
|
202
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
203
|
+
msg = build_message("#{element.to_s.titlecase} #{how}=>'#{what}' is visible.", desc)
|
204
|
+
rtrn = false
|
205
|
+
case how
|
206
|
+
when :index
|
207
|
+
target = get_element(browser, element, how, what)
|
208
|
+
if target.visible?
|
209
|
+
rtrn = true
|
210
|
+
end
|
211
|
+
else
|
212
|
+
if browser.element(how, what).visible?
|
213
|
+
rtrn = true
|
214
|
+
end
|
215
|
+
end
|
216
|
+
if rtrn
|
217
|
+
passed_to_log("#{msg}")
|
218
|
+
else
|
219
|
+
failed_to_log("#{msg}")
|
220
|
+
end
|
221
|
+
rtrn
|
222
|
+
rescue
|
223
|
+
failed_to_log("Unable to verify that #{msg}': '#{$!}'")
|
224
|
+
end
|
225
|
+
|
226
|
+
alias validate_visible visible?
|
227
|
+
|
228
|
+
# Verify that a DOM element is not visible.
|
229
|
+
# @param (see #enabled?)
|
230
|
+
# @return [Boolean] Returns true if the element is not visible.
|
231
|
+
def not_visible?(browser, element, how, what, desc = '')
|
232
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
233
|
+
msg = build_message("#{element.to_s.titlecase} #{how}=>'#{what}' is not visible.", desc)
|
234
|
+
rtrn = false
|
235
|
+
case how
|
236
|
+
when :index
|
237
|
+
target = get_element(browser, element, how, what)
|
238
|
+
if not target.visible?
|
239
|
+
rtrn = true
|
240
|
+
end
|
241
|
+
else
|
242
|
+
if not browser.element(how, what).visible?
|
243
|
+
rtrn = true
|
244
|
+
end
|
245
|
+
end
|
246
|
+
if rtrn
|
247
|
+
passed_to_log("#{msg}")
|
248
|
+
else
|
249
|
+
failed_to_log("#{msg}")
|
250
|
+
end
|
251
|
+
rtrn
|
252
|
+
rescue
|
253
|
+
failed_to_log("Unable to verify that #{msg}': '#{$!}' #{desc}")
|
254
|
+
end
|
255
|
+
|
256
|
+
alias validate_not_visible not_visible?
|
257
|
+
|
258
|
+
# Verify that a checkbox is checked.
|
259
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
260
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
261
|
+
# Valid values depend on the kind of element.
|
262
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
263
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
264
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
265
|
+
# @return [Boolean] Returns true if the checkbox is checked.
|
266
|
+
def checked?(browser, how, what, desc = '')
|
267
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
268
|
+
msg = build_message("Checkbox #{how}=>#{what} is checked.", desc)
|
269
|
+
if browser.checkbox(how, what).checked?
|
270
|
+
passed_to_log(msg)
|
271
|
+
true
|
272
|
+
else
|
273
|
+
failed_to_log(msg)
|
274
|
+
end
|
275
|
+
rescue
|
276
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
277
|
+
end
|
278
|
+
|
279
|
+
alias checkbox_checked? checked?
|
280
|
+
alias checkbox_set? checked?
|
281
|
+
|
282
|
+
# Verify that a checkbox is not checked.
|
283
|
+
# @param (see #checked?)
|
284
|
+
# @return [Boolean] Returns true if the checkbox is not checked.
|
285
|
+
def not_checked?(browser, how, what, desc = '')
|
286
|
+
#TODO: handle identification of element with value as well as other attribute. see exists?
|
287
|
+
msg = build_message("Checkbox #{how}=>#{what} is not checked.", desc)
|
288
|
+
if not browser.checkbox(how, what).checked?
|
289
|
+
passed_to_log(msg)
|
290
|
+
true
|
291
|
+
else
|
292
|
+
failed_to_log(msg)
|
293
|
+
end
|
294
|
+
rescue
|
295
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
296
|
+
end
|
297
|
+
|
298
|
+
alias checkbox_checked? checked?
|
299
|
+
alias checkbox_set? checked?
|
300
|
+
|
301
|
+
# Verify that a DOM element exists on the page.
|
302
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
303
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
304
|
+
# Valid values depend on the kind of element.
|
305
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
306
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
307
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the value attribute of the element.
|
308
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
309
|
+
# @return [Boolean] True if the element exists.
|
310
|
+
def exists?(browser, element, how, what, value = nil, desc = '')
|
311
|
+
msg2 = "and value=>'#{value}' " if value
|
312
|
+
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'exists.', desc)
|
313
|
+
case element
|
314
|
+
when :link
|
315
|
+
bool = browser.link(how, what).exists?
|
316
|
+
else
|
317
|
+
bool = browser.element(how, what).exists?
|
318
|
+
end
|
319
|
+
if bool
|
320
|
+
passed_to_log("#{msg}? #{desc}")
|
321
|
+
true
|
322
|
+
else
|
323
|
+
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
324
|
+
end
|
325
|
+
rescue
|
326
|
+
failed_to_log("Unable to verify that #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
|
327
|
+
end
|
328
|
+
|
329
|
+
# Verify that a DOM element does not exist on the page.
|
330
|
+
# @param (see #exists?)
|
331
|
+
# @return [Boolean] True if the element does not exist.
|
332
|
+
def does_not_exist?(browser, element, how, what, value = nil, desc = '')
|
333
|
+
msg2 = "and value=>'#{value}' " if value
|
334
|
+
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'does not exist.', desc)
|
335
|
+
case element
|
336
|
+
when :link
|
337
|
+
bool = browser.link(how, what).exists?
|
338
|
+
else
|
339
|
+
bool = browser.element(how, what).exists?
|
340
|
+
end
|
341
|
+
if bool
|
342
|
+
failed_to_log(msg)
|
343
|
+
else
|
344
|
+
passed_to_log(msg)
|
345
|
+
true
|
346
|
+
end
|
347
|
+
rescue
|
348
|
+
failed_to_log("Unable to verify that #{msg}': '#{$!}' #{desc}")
|
349
|
+
end
|
350
|
+
|
351
|
+
alias not_exist? does_not_exist?
|
352
|
+
|
353
|
+
# Verify that a radio button is set.
|
354
|
+
# @param (see #checked?)
|
355
|
+
# @return [Boolean] Returns true if the radio button is set.
|
356
|
+
def set?(browser, how, what, desc = '', no_fail = false)
|
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 selected.", desc)
|
359
|
+
if browser.radio(how, what).set?
|
360
|
+
passed_to_log(msg)
|
361
|
+
true
|
362
|
+
else
|
363
|
+
if no_fail
|
364
|
+
passed_to_log("Radio #{how}=>#{what} is not selected.")
|
365
|
+
else
|
366
|
+
failed_to_log(msg)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
rescue
|
370
|
+
failed_to_log("Unable to verify taht #{msg}: '#{$!}'")
|
371
|
+
end
|
372
|
+
|
373
|
+
alias radio_set? set?
|
374
|
+
alias radio_checked? set?
|
375
|
+
alias radio_selected? set?
|
376
|
+
|
377
|
+
# Verify that a radio button is not set.
|
378
|
+
# @param (see #checked?)
|
379
|
+
# @return [Boolean] Returns true if the radio button is not set.
|
380
|
+
def not_set?(browser, how, what, desc = '', no_fail = false)
|
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 selected.", desc)
|
383
|
+
if not browser.radio(how, what).set?
|
384
|
+
passed_to_log(msg)
|
385
|
+
true
|
386
|
+
else
|
387
|
+
if no_fail
|
388
|
+
passed_to_log("Radio #{how}=>#{what} is not selected.")
|
389
|
+
else
|
390
|
+
failed_to_log(msg)
|
391
|
+
end
|
392
|
+
end
|
393
|
+
rescue
|
394
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
395
|
+
end
|
396
|
+
|
397
|
+
alias radio_not_set? not_set?
|
398
|
+
alias radio_not_checked? not_set?
|
399
|
+
alias radio_not_selected? not_set?
|
400
|
+
|
401
|
+
# Verify that a radio button, identified by both the value (*what*) in attribute *how*
|
402
|
+
# and the *value* in its value attribute, is set.
|
403
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
404
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
405
|
+
# Valid values depend on the kind of element.
|
406
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
407
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
408
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the value attribute of the element.
|
409
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
410
|
+
# @return [Boolean] Returns true if the radio button is set.
|
411
|
+
def radio_with_value_set?(browser, how, what, value, desc = '', no_fail = false)
|
412
|
+
msg2 = 'not' if no_fail
|
413
|
+
msg = build_message("Radio #{how}=>#{what} :value=>#{value} is", msg2, 'selected.', desc)
|
414
|
+
if browser.radio(how, what, value).set?
|
415
|
+
passed_to_log(msg)
|
416
|
+
true
|
417
|
+
else
|
418
|
+
if no_fail
|
419
|
+
passed_to_log(msg)
|
420
|
+
else
|
421
|
+
failed_to_log(msg)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
rescue
|
425
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
426
|
+
end
|
427
|
+
|
428
|
+
alias radio_set_with_value? radio_with_value_set?
|
429
|
+
|
430
|
+
# Verify that a select list, identified by the value (*what*) in attribute *how*, contains an option with the
|
431
|
+
# value in *option*.
|
432
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
433
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
434
|
+
# Valid values depend on the kind of element.
|
435
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
436
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
437
|
+
# @param [String, Regexp] option A string or a regular expression to be found in the value attribute of the element.
|
438
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
439
|
+
# @return [Boolean] Returns true if the option is found.
|
440
|
+
def select_list_includes?(browser, how, what, option, desc = '')
|
441
|
+
msg = build_message("Select list #{how}=>#{what} includes option '#{option}'.", desc)
|
442
|
+
select_list = browser.select_list(how, what)
|
443
|
+
options = select_list.options
|
444
|
+
if option
|
445
|
+
if options.include?(option)
|
446
|
+
passed_to_log(msg)
|
447
|
+
true
|
448
|
+
else
|
449
|
+
failed_to_log(msg)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
rescue
|
453
|
+
failed_to_log("Unable to verify #{msg}. '#{$!}'")
|
454
|
+
end
|
455
|
+
|
456
|
+
alias validate_select_list_contains select_list_includes?
|
457
|
+
alias select_list_contains? select_list_includes?
|
458
|
+
|
459
|
+
# Verify that a select list, identified by the value (*what*) in attribute *how*, contains an option with the
|
460
|
+
# value in *option*.
|
461
|
+
# @param (see #select_list_includes?)
|
462
|
+
# @return [Boolean] Returns true if the option is not found.
|
463
|
+
def select_list_does_not_include?(browser, how, what, option, desc = '')
|
464
|
+
msg = build_message("Select list #{how}=>#{what} does not include option '#{option}'.", desc)
|
465
|
+
select_list = browser.select_list(how, what)
|
466
|
+
options = select_list.options
|
467
|
+
if option
|
468
|
+
if not options.include?(option)
|
469
|
+
passed_to_log(msg)
|
470
|
+
true
|
471
|
+
else
|
472
|
+
failed_to_log(msg)
|
473
|
+
nil
|
474
|
+
end
|
475
|
+
end
|
476
|
+
rescue
|
477
|
+
failed_to_log("Unable to verify #{msg}. '#{$!}'")
|
478
|
+
end
|
479
|
+
|
480
|
+
# Compare strings for exact match and log results
|
481
|
+
# @param [String] actual The actual value as found in the application.
|
482
|
+
# @param [String] expected The value expected to be found.
|
483
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
484
|
+
# @return [Boolean] Returns true if actual exactly matches expected.
|
485
|
+
def string_equals?(actual, expected, desc = '')
|
486
|
+
msg = build_message("Actual string '#{actual}' equals expected '#{expected}'.", desc)
|
487
|
+
if actual == expected
|
488
|
+
passed_to_log("#{msg}")
|
489
|
+
true
|
490
|
+
else
|
491
|
+
failed_to_log("#{msg}")
|
492
|
+
end
|
493
|
+
rescue
|
494
|
+
failed_to_log("Unable to #{msg}. #{$!}")
|
495
|
+
end
|
496
|
+
|
497
|
+
alias validate_string_equal string_equals?
|
498
|
+
alias validate_string_equals string_equals?
|
499
|
+
alias text_equals string_equals?
|
500
|
+
alias text_equals? string_equals?
|
501
|
+
|
502
|
+
# Compare strings for no match and log results
|
503
|
+
# @param (see #string_equals?)
|
504
|
+
# @return [Boolean] Returns true if actual does not match expected.
|
505
|
+
def string_does_not_equal?(actual, expected, desc = '')
|
506
|
+
msg = build_message("Actual string '#{actual}' does not equal expected '#{expected}'.", desc)
|
507
|
+
if actual == expected
|
508
|
+
failed_to_log("#{msg} (#{__LINE__})")
|
509
|
+
true
|
510
|
+
else
|
511
|
+
passed_to_log("#{msg} (#{__LINE__})")
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
alias validate_string_not_equal string_does_not_equal?
|
516
|
+
alias validate_string_does_not_equal string_does_not_equal?
|
517
|
+
|
518
|
+
# Verify that date strings represent the same date, allowing for format differences.
|
519
|
+
# Compare strings for no match and log results
|
520
|
+
# @param (see #string_equals?)
|
521
|
+
# @param [Boolean] fail_on_format If set to true method will fail if the formats differ
|
522
|
+
# even though the dates/times match
|
523
|
+
# @return [Boolean] Returns true if actual does not match expected.
|
524
|
+
def date_string_equals?(actual, expected, desc = '', fail_on_format = true)
|
525
|
+
rtrn = false
|
526
|
+
if actual == expected
|
527
|
+
rtrn = true
|
528
|
+
elsif DateTime.parse(actual).to_s == DateTime.parse(expected).to_s
|
529
|
+
msg2 = "with different formatting. "
|
530
|
+
unless fail_on_format
|
531
|
+
rtrn = true
|
532
|
+
end
|
533
|
+
end
|
534
|
+
msg = build_message("Actual date '#{actual}' equals expected date '#{expected}'.", msg2, desc)
|
535
|
+
if rtrn
|
536
|
+
passed_to_log("#{msg}")
|
537
|
+
else
|
538
|
+
failed_to_log("#{msg}")
|
539
|
+
end
|
540
|
+
rtrn
|
541
|
+
rescue
|
542
|
+
failed_to_log("Unable to verify that #{msg}. #{$!}")
|
543
|
+
end
|
544
|
+
|
545
|
+
# Verify that a DOM element is in read-only state.
|
546
|
+
# @param (see #enabled?)
|
547
|
+
# @return [Boolean] Returns true if the element is in read-only state.
|
548
|
+
def read_only?(browser, element, how, what, value = nil, desc = '')
|
549
|
+
msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
|
550
|
+
msg << "and value=>'#{value}' " if value
|
551
|
+
msg << "read only"
|
552
|
+
e = get_element(browser, element, how, what, value)
|
553
|
+
if e
|
554
|
+
if e.readonly?
|
555
|
+
passed_to_log("#{msg}? #{desc}")
|
556
|
+
true
|
557
|
+
else
|
558
|
+
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
559
|
+
end
|
560
|
+
end
|
561
|
+
rescue
|
562
|
+
failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
|
563
|
+
end
|
564
|
+
|
565
|
+
# Verify that a DOM element is not in read-only state.
|
566
|
+
# @param (see #enabled?)
|
567
|
+
# @return [Boolean] Returns true if the element is not in read-only state.
|
568
|
+
def not_read_only?(browser, element, how, what, value = nil, desc = '')
|
569
|
+
msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
|
570
|
+
msg << "and value=>'#{value}' " if value
|
571
|
+
msg << "is not read only"
|
572
|
+
e = get_element(browser, element, how, what, value)
|
573
|
+
if e
|
574
|
+
if e.readonly?
|
575
|
+
failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
|
576
|
+
else
|
577
|
+
passed_to_log("#{msg}? #{desc}")
|
578
|
+
true
|
579
|
+
end
|
580
|
+
end
|
581
|
+
rescue
|
582
|
+
failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
|
583
|
+
end
|
584
|
+
|
585
|
+
# Verify that a DOM element is ready, i.e., both exists and is enabled.
|
586
|
+
# @param (see #exists?)
|
587
|
+
# @return [Boolean] Returns true if the element is ready.
|
588
|
+
def ready?(browser, element, how, what, value = '', desc = '')
|
589
|
+
msg2 = "and value=>'#{value}' " if value
|
590
|
+
msg = build_message("#{element.to_s.titlecase} with #{how}=>'#{what}' ", msg2, 'exists and is enabled.', desc)
|
591
|
+
e = get_element(browser, element, how, what, value)
|
592
|
+
if e and e.enabled?
|
593
|
+
passed_to_log(msg)
|
594
|
+
true
|
595
|
+
else
|
596
|
+
failed_to_log(msg)
|
597
|
+
end
|
598
|
+
rescue
|
599
|
+
failed_to_log("Unable to determine if #{msg}. '#{$!}' [#{get_callers(1)}]")
|
600
|
+
end
|
601
|
+
|
602
|
+
# Verify that a text field (also text area), identified by *how* and *what*, contains only the exact string specified in *expected*.
|
603
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
604
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
605
|
+
# Valid values depend on the kind of element.
|
606
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
607
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
608
|
+
# @param [String] expected A string which the value attribute of the text field must equal.
|
609
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
610
|
+
# @return [Boolean] Returns true if the *expected* and the value in the text field are identical.
|
611
|
+
def textfield_equals?(browser, how, what, expected, desc = '')
|
612
|
+
msg = build_message("Expected value to equal '#{expected}' in textfield #{how}=>'#{what}'.", desc)
|
613
|
+
actual = browser.text_field(how, what).value
|
614
|
+
if actual.is_a?(Array)
|
615
|
+
actual = actual[0].to_s
|
616
|
+
end
|
617
|
+
if actual == expected
|
618
|
+
passed_to_log(msg)
|
619
|
+
true
|
620
|
+
else
|
621
|
+
act_s = actual.strip
|
622
|
+
exp_s = expected.strip
|
623
|
+
if act_s == exp_s
|
624
|
+
passed_to_log("#{msg} (stripped)")
|
625
|
+
true
|
626
|
+
else
|
627
|
+
debug_to_report(
|
628
|
+
"#{__method__} (spaces underscored):\n "+
|
629
|
+
"expected:[#{expected.gsub(' ', '_')}] (#{expected.length})\n "+
|
630
|
+
"actual:[#{actual.gsub(' ', '_')}] (#{actual.length}) (spaces underscored)"
|
631
|
+
)
|
632
|
+
failed_to_log("#{msg}. Found: '#{actual}'")
|
633
|
+
end
|
634
|
+
end
|
635
|
+
rescue
|
636
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}")
|
637
|
+
end
|
638
|
+
|
639
|
+
alias validate_textfield_value textfield_equals?
|
640
|
+
alias text_field_equals? textfield_equals?
|
641
|
+
|
642
|
+
# Verify that a text field (also text area), identified by *how* and *what*, contains the string specified in *expected*.
|
643
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
644
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
645
|
+
# Valid values depend on the kind of element.
|
646
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
647
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
648
|
+
# @param [String, Regexp] expected A string or regular expression which must be matched in the value of the text field
|
649
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
650
|
+
# @return [Boolean] Returns true if the *expected* is matched in the value of the text field.
|
651
|
+
def textfield_contains?(browser, how, what, expected, desc = '')
|
652
|
+
msg = build_message("Text field #{how}=>#{what} contains '#{expected}'.", desc)
|
653
|
+
contents = browser.text_field(how, what).value
|
654
|
+
if contents =~ /#{expected}/
|
655
|
+
passed_to_log(msg)
|
656
|
+
true
|
657
|
+
else
|
658
|
+
failed_to_log("#{msg} Contents: '#{contents}'")
|
659
|
+
end
|
660
|
+
rescue
|
661
|
+
failed_to_log("Unable to verify that #{msg} '#{$!}'")
|
662
|
+
end
|
663
|
+
|
664
|
+
# Verify that a text field (also text area), identified by *how* and *what*, is empty.
|
665
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
666
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
667
|
+
# Valid values depend on the kind of element.
|
668
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
669
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
670
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
671
|
+
# @return [Boolean] Returns true if the text field is empty.
|
672
|
+
def textfield_empty?(browser, how, what, desc = '')
|
673
|
+
msg = "Text field #{how}=>#{what} is empty."
|
674
|
+
msg << desc if desc.length > 0
|
675
|
+
contents = browser.text_field(how, what).value
|
676
|
+
if contents.to_s.length == 0
|
677
|
+
passed_to_log(msg)
|
678
|
+
true
|
679
|
+
else
|
680
|
+
failed_to_log("#{msg} Contents: '#{contents}'")
|
681
|
+
end
|
682
|
+
rescue
|
683
|
+
failed_to_log("Unable to verify that #{msg} '#{$!}'")
|
684
|
+
end
|
685
|
+
|
686
|
+
alias validate_textfield_empty textfield_empty?
|
687
|
+
alias text_field_empty? textfield_empty?
|
688
|
+
|
689
|
+
# Verify that a text field (also text area), identified by *how* and *what*, contains the string specified in *expected*.
|
690
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
691
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
692
|
+
# Valid values depend on the kind of element.
|
693
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
694
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
695
|
+
# @param [String] expected A string in dollar formatting
|
696
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
697
|
+
# @return [Boolean] Returns true if the *expected* is matched in the value of the text field.
|
698
|
+
def validate_textfield_dollar_value(browser, how, what, expected, with_cents = true, desc = '')
|
699
|
+
target = expected.dup
|
700
|
+
desc << " Dollar formatting"
|
701
|
+
if with_cents
|
702
|
+
target << '.00' if not expected =~ /\.00$/
|
703
|
+
desc << " without cents. orig:(#{expected})"
|
704
|
+
else
|
705
|
+
target.gsub!(/\.00$/, '')
|
706
|
+
desc << " with cents. orig:(#{expected})"
|
707
|
+
end
|
708
|
+
textfield_equals?(browser, how, what, target, desc)
|
709
|
+
end
|
710
|
+
|
711
|
+
# Verify that *browser* is set to a url that is matched by the string or rexexp in *url*.
|
712
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
713
|
+
# @param [String, Regexp] url A string or a regular expression to match to the url of the browser..
|
714
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
715
|
+
# @return [Boolean] Returns true if the *expected* is matched in the value of the text field.
|
716
|
+
def validate_url(browser, url, desc = '')
|
717
|
+
msg = build_message("Current URL matches #{url}.", desc)
|
718
|
+
if browser.url.to_s.match(url)
|
719
|
+
passed_to_log(msg)
|
720
|
+
true
|
721
|
+
else
|
722
|
+
failed_to_log("#{msg} Actual: #{browser.url}")
|
723
|
+
end
|
724
|
+
rescue
|
725
|
+
failed_to_log("Unable to validate that #{msg} '#{$!}'")
|
726
|
+
end
|
727
|
+
|
728
|
+
# @!endgroup Core
|
729
|
+
|
730
|
+
# @!group AutoIT
|
731
|
+
|
732
|
+
def window_exists?(title)
|
733
|
+
title = translate_popup_title(title)
|
734
|
+
if @ai.WinExists(title) == 1
|
735
|
+
passed_to_log("Window title:'#{title}' exists")
|
736
|
+
true
|
737
|
+
else
|
738
|
+
failed_to_log("Window title:'#{title}' does not exist")
|
739
|
+
end
|
740
|
+
end
|
741
|
+
|
742
|
+
alias window_exists window_exists?
|
743
|
+
|
744
|
+
def window_does_not_exist?(title)
|
745
|
+
title = translate_popup_title(title)
|
746
|
+
if @ai.WinExists(title) == 1
|
747
|
+
failed_to_log("Window title:'#{title}' exists")
|
748
|
+
else
|
749
|
+
passed_to_log("Window title:'#{title}' does not exist")
|
750
|
+
true
|
751
|
+
end
|
752
|
+
end
|
753
|
+
|
754
|
+
alias window_no_exists window_does_not_exist?
|
755
|
+
|
756
|
+
# @!endgroup AutoIT
|
757
|
+
|
758
|
+
# @!group Core
|
759
|
+
|
760
|
+
def popup_is_browser?(popup, desc = '')
|
761
|
+
msg = build_message("Popup: #{popup.title} is a browser window.", desc)
|
762
|
+
if is_browser?(popup)
|
763
|
+
passed_to_log(msg)
|
764
|
+
debug_to_log("\n"+popup.text+"\n")
|
765
|
+
true
|
766
|
+
else
|
767
|
+
failed_to_log(msg)
|
768
|
+
end
|
769
|
+
rescue
|
770
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'. (#{__LINE__})")
|
771
|
+
end
|
772
|
+
|
773
|
+
alias popup_exist popup_is_browser?
|
774
|
+
alias popup_exists popup_is_browser?
|
775
|
+
alias popup_exist? popup_is_browser?
|
776
|
+
alias popup_exists? popup_is_browser?
|
777
|
+
alias iepopup_exist popup_is_browser?
|
778
|
+
alias iepopup_exist? popup_is_browser?
|
779
|
+
alias iepopup_exists popup_is_browser?
|
780
|
+
alias iepopup_exists? popup_is_browser?
|
781
|
+
|
782
|
+
# Verify that select list, identified by the value *what* in the attribute :id, contains text and select it if present.
|
783
|
+
def validate_list_by_id(browser, what, option, desc = '', select_if_present = true)
|
784
|
+
if select_list_includes?(browser, :id, what, option, desc)
|
785
|
+
if select_if_present
|
786
|
+
select_option(browser, :id, what, :text, option, desc, false)
|
787
|
+
else
|
788
|
+
passed_to_log(message)
|
789
|
+
true
|
790
|
+
end
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
794
|
+
# Verify that select list contains text
|
795
|
+
def validate_list_by_name(browser, what, option, desc = '', select_if_present = true)
|
796
|
+
if select_list_includes?(browser, :name, what, option, desc)
|
797
|
+
if select_if_present
|
798
|
+
select_option(browser, :name, what, :text, option, desc, false)
|
799
|
+
else
|
800
|
+
passed_to_log(message)
|
801
|
+
true
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
806
|
+
def validate_text(browser, ptrn, desc = '', skip_fail = false, skip_sleep = false)
|
807
|
+
cls = browser.class.to_s
|
808
|
+
cls.gsub!('Watir::', '')
|
809
|
+
cls.gsub!('IE', 'Browser')
|
810
|
+
msg = build_message("#{cls} text contains '#{ptrn}'.", desc)
|
811
|
+
if ptrn.is_a?(Regexp)
|
812
|
+
target = ptrn
|
813
|
+
else
|
814
|
+
target = Regexp.new(Regexp.escape(ptrn))
|
815
|
+
end
|
816
|
+
sleep_for(2) unless skip_sleep
|
817
|
+
myText = browser.text
|
818
|
+
if not myText.match(target)
|
819
|
+
sleep_for(2) unless skip_sleep #TODO try a wait_until here?
|
820
|
+
myText = browser.text
|
821
|
+
end
|
822
|
+
if myText.match(target)
|
823
|
+
#if myText.match(ptrn)
|
824
|
+
passed_to_log("#{msg}")
|
825
|
+
true
|
826
|
+
else
|
827
|
+
if skip_fail
|
828
|
+
debug_to_log("#{cls} text does not contain the text: '#{ptrn}'. #{desc}")
|
829
|
+
else
|
830
|
+
failed_to_log("#{msg}")
|
831
|
+
end
|
832
|
+
#debug_to_log("\n#{myText}")
|
833
|
+
end
|
834
|
+
rescue
|
835
|
+
failed_to_log("Unable to verify that #{msg} '#{$!}'")
|
836
|
+
end
|
837
|
+
|
838
|
+
alias validate_link validate_text
|
839
|
+
|
840
|
+
def text_in_element_equals?(browser, element, how, what, expected, desc = '')
|
841
|
+
msg = build_message("Expected exact text '#{expected}' in #{element} :#{how}=>#{what}.", desc)
|
842
|
+
text = ''
|
843
|
+
who = browser.element(how, what)
|
844
|
+
if who
|
845
|
+
text = who.text
|
846
|
+
if text == expected
|
847
|
+
passed_to_log(msg)
|
848
|
+
true
|
849
|
+
else
|
850
|
+
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
851
|
+
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
852
|
+
failed_to_log("#{msg} Found '#{text}'.")
|
853
|
+
end
|
854
|
+
end
|
855
|
+
rescue
|
856
|
+
failed_to_log("Unable to verify #{msg} '#{$!}'")
|
857
|
+
end
|
858
|
+
|
859
|
+
def element_contains_text?(browser, element, how, what, expected, desc = '')
|
860
|
+
msg = build_message("Element #{element} :{how}=>#{what} contains text '#{expected}'.", desc)
|
861
|
+
case how
|
862
|
+
when :href
|
863
|
+
who = browser.element(how, what)
|
864
|
+
else
|
865
|
+
who = browser.link(how, what)
|
866
|
+
end
|
867
|
+
if who
|
868
|
+
text = who.text
|
869
|
+
if expected and expected.length > 0
|
870
|
+
rgx = Regexp.new(Regexp.escape(expected))
|
871
|
+
if text =~ rgx
|
872
|
+
passed_to_log(msg)
|
873
|
+
true
|
874
|
+
else
|
875
|
+
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
876
|
+
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
877
|
+
failed_to_log("#{msg} Found '#{text}'. #{desc}")
|
878
|
+
end
|
879
|
+
else
|
880
|
+
if text.length > 0
|
881
|
+
debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
|
882
|
+
debug_to_log("act: [#{text.gsub(' ', '^')}]")
|
883
|
+
failed_to_log("#{msg} Found '#{text}'. #{desc}")
|
884
|
+
else
|
885
|
+
passed_to_log(msg)
|
886
|
+
true
|
887
|
+
end
|
888
|
+
end
|
889
|
+
end
|
890
|
+
rescue
|
891
|
+
failed_to_log("Unable to verify #{msg} '#{$!}'")
|
892
|
+
end
|
893
|
+
|
894
|
+
def validate_select_list(browser, how, what, opt_type, list = nil, multiple = false, ignore = ['Select One'], limit = 5)
|
895
|
+
mark_testlevel("#{__method__.to_s.titleize} (#{how}=>#{what})", 0)
|
896
|
+
ok = true
|
897
|
+
select_list = browser.select_list(how, what)
|
898
|
+
options = select_list.options
|
899
|
+
if list
|
900
|
+
if options == list
|
901
|
+
passed_to_log("Select list options list equals expected list #{list}")
|
902
|
+
else
|
903
|
+
debug_to_report("actual:\n#{nice_array(options, true)}")
|
904
|
+
debug_to_report("expected:\n#{nice_array(list, true)}")
|
905
|
+
failed_to_log("Select list options list #{nice_array(options, true)} "+
|
906
|
+
"does not equal expected list #{nice_array(list, true)}")
|
907
|
+
end
|
908
|
+
end
|
909
|
+
|
910
|
+
#single selections
|
911
|
+
cnt = 0
|
912
|
+
options.each do |opt|
|
913
|
+
if not ignore.include?(opt)
|
914
|
+
cnt += 1
|
915
|
+
ok = select_option(select_list, opt_type, opt)
|
916
|
+
break if not ok
|
917
|
+
select_list.clear
|
918
|
+
break if limit > 0 and cnt >= limit
|
919
|
+
end
|
920
|
+
end
|
921
|
+
|
922
|
+
sleep_for(0.5)
|
923
|
+
select_list.clear
|
924
|
+
if ok and multiple
|
925
|
+
if options.length > 2
|
926
|
+
targets = list.slice(1, 2)
|
927
|
+
select_option(select_list, opt_type, options[1])
|
928
|
+
select_option(select_list, opt_type, options[2])
|
929
|
+
selected = select_list.selected_options
|
930
|
+
if selected == targets
|
931
|
+
passed_to_log("Select list selected options equals expected #{targets}")
|
932
|
+
else
|
933
|
+
failed_to_log("Select list selected options #{selected} does not equal expected list #{targets.to_a}")
|
934
|
+
end
|
935
|
+
else
|
936
|
+
debug_to_log("Too few options to test multiple selection (need 2 or more): '#{options}", __LINE__)
|
937
|
+
end
|
938
|
+
end
|
939
|
+
rescue
|
940
|
+
failed_to_log("Unable to validate select_list: '#{$!}'", __LINE__)
|
941
|
+
end
|
942
|
+
|
943
|
+
def validate_select_list_contents(browser, how, what, list)
|
944
|
+
mark_testlevel("#{__method__.to_s.titleize} (#{what})", 2)
|
945
|
+
select_list = browser.select_list(how, what)
|
946
|
+
options = select_list.options
|
947
|
+
if list
|
948
|
+
if options == list
|
949
|
+
passed_to_log("Select list options list equals expected list #{list}")
|
950
|
+
options
|
951
|
+
else
|
952
|
+
failed_to_log("Select list options list #{options} does not equal expected list #{list}")
|
953
|
+
nil
|
954
|
+
end
|
955
|
+
end
|
956
|
+
rescue
|
957
|
+
failed_to_log("Unable to validate select_list contents: '#{$!}'", __LINE__)
|
958
|
+
end
|
959
|
+
|
960
|
+
def validate_selected_options(browser, how, what, list, desc = '')
|
961
|
+
select_list = browser.select_list(how, what)
|
962
|
+
selected = select_list.selected_options.sort
|
963
|
+
if list.is_a?(Array)
|
964
|
+
if selected == list.sort
|
965
|
+
passed_to_log("Expected options [#{list.sort}] are selected [#{selected}]. #{desc}")
|
966
|
+
else
|
967
|
+
failed_to_log("Selected options [#{selected}] do not match expected [#{list.sort}]. #{desc}")
|
968
|
+
true
|
969
|
+
end
|
970
|
+
else
|
971
|
+
if selected.length == 1
|
972
|
+
if selected[0] =~ /#{list}/
|
973
|
+
passed_to_log("Expected option [#{list}] was selected. #{desc}")
|
974
|
+
true
|
975
|
+
else
|
976
|
+
failed_to_log("Expected option [#{list}] was not selected. Found [#{selected}]. #{desc}")
|
977
|
+
end
|
978
|
+
else
|
979
|
+
if selected.include?(list)
|
980
|
+
failed_to_log("Expected option [#{list}] was found among multiple selections [#{selected}]. #{desc}")
|
981
|
+
else
|
982
|
+
failed_to_log("Expected option [#{list}] was not found among multiple selections [#{selected}]. #{desc}")
|
983
|
+
end
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
rescue
|
988
|
+
failed_to_log("Unable to validate selected option(s): '#{$!}' #{desc}", __LINE__)
|
989
|
+
end
|
990
|
+
|
991
|
+
alias validate_selections validate_selected_options
|
992
|
+
alias validate_select_list_selections validate_selected_options
|
993
|
+
|
994
|
+
def string_contains?(strg, target, desc = '')
|
995
|
+
msg = build_message("String '#{strg}' contains '#{target}'.", desc)
|
996
|
+
if strg.match(target)
|
997
|
+
passed_to_log("#{msg} (#{__LINE__})")
|
998
|
+
true
|
999
|
+
else
|
1000
|
+
failed_to_log("#{msg} (#{__LINE__})")
|
1001
|
+
end
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
alias validate_string string_contains?
|
1005
|
+
alias validate_string_contains string_contains?
|
1006
|
+
|
1007
|
+
def string_does_not_contain?(strg, target, desc = '')
|
1008
|
+
msg = build_message("String '#{strg}' does not contain '#{target}'.", desc)
|
1009
|
+
if strg.match(target)
|
1010
|
+
failed_to_log("#{msg} (#{__LINE__})")
|
1011
|
+
true
|
1012
|
+
else
|
1013
|
+
passed_to_log("#{msg} (#{__LINE__})")
|
1014
|
+
end
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
alias validate_string_not_contains string_does_not_contain?
|
1018
|
+
alias validate_string_not_contain string_does_not_contain?
|
1019
|
+
alias validate_string_does_not_contain string_does_not_contain?
|
1020
|
+
|
1021
|
+
def validate_no_text(browser, ptrn, desc = '')
|
1022
|
+
cls = browser.class.to_s
|
1023
|
+
cls.gsub!('Watir::', '')
|
1024
|
+
cls.gsub!('IE', 'Browser')
|
1025
|
+
msg = "#{cls} does not contain text '#{ptrn}'."
|
1026
|
+
msg << " #{desc}" if desc.length > 0
|
1027
|
+
if ptrn.is_a?(Regexp)
|
1028
|
+
target = ptrn
|
1029
|
+
else
|
1030
|
+
target = Regexp.new(Regexp.escape(ptrn))
|
1031
|
+
end
|
1032
|
+
browser_text = browser.text
|
1033
|
+
if browser_text.match(target)
|
1034
|
+
failed_to_log("#{msg} [#{browser_text.match(target)[0]}]")
|
1035
|
+
else
|
1036
|
+
passed_to_log(msg)
|
1037
|
+
true
|
1038
|
+
end
|
1039
|
+
rescue
|
1040
|
+
failed_to_log("Unable to verify that #{msg}: '#{$!}'")
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
def textfield_does_not_equal?(browser, how, what, expected, desc = '')
|
1044
|
+
msg = build_message("Text field #{how}=>#{what} does not equal '#{expected}'", desc)
|
1045
|
+
if not browser.text_field(how, what).value == expected
|
1046
|
+
passed_to_log(msg)
|
1047
|
+
true
|
1048
|
+
else
|
1049
|
+
failed_to_log(msg)
|
1050
|
+
end
|
1051
|
+
rescue
|
1052
|
+
failed_to_log("Unable to validate that #{msg}: '#{$!}'")
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
alias validate_textfield_not_value textfield_does_not_equal?
|
1056
|
+
|
1057
|
+
# @!endgroup Core
|
1058
|
+
|
1059
|
+
# @!group Deprecated
|
1060
|
+
# @deprecated
|
1061
|
+
def self.included(mod)
|
1062
|
+
# puts "RegressionSupport::Validations extended by #{mod}"
|
1063
|
+
end
|
1064
|
+
|
1065
|
+
# @deprecated Use #message_to_log
|
1066
|
+
def validate_message(browser, message)
|
1067
|
+
message_to_log(message)
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
# @!endgroup Deprecated
|
1071
|
+
|
1072
|
+
end
|
1073
|
+
end
|
1074
|
+
end
|
1075
|
+
|