Module: Awetestlib::Regression::Validations

Included in:
Runner
Defined in:
lib/awetestlib/regression/validations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



5
6
7
# File 'lib/awetestlib/regression/validations.rb', line 5

def self.included(mod)
  # puts "RegressionSupport::Validations extended by #{mod}"
end

Instance Method Details

#arrays_match?(exp, act, dir, col, org = nil) ⇒ Boolean Also known as: arrays_match

begin core validation methods #####

Returns:

  • (Boolean)


70
71
72
73
74
75
76
77
78
79
80
# File 'lib/awetestlib/regression/validations.rb', line 70

def arrays_match?(exp, act, dir, col, org = nil)
  if exp == act
    passed_to_log("Click on #{dir} column '#{col}' produces expected sorted list.")
    true
  else
    failed_to_log("Click on #{dir} column '#{col}' fails to produce expected sorted list.")
    debug_to_log("Original order ['#{org.join("', '")}']") if org
    debug_to_log("Expected order ['#{exp.join("', '")}']")
    debug_to_log("  Actual order ['#{act.join("', '")}']")
  end
end

#checkbox_is_disabled?(browser, strg, desc = '') ⇒ Boolean Also known as: validate_check_disabled

Returns:

  • (Boolean)


1152
1153
1154
# File 'lib/awetestlib/regression/validations.rb', line 1152

def checkbox_is_disabled?(browser, strg, desc = '')
  disabled?(browser, :checkbox, :id, strg, desc)
end

#checkbox_is_enabled?(browser, strg, desc = '') ⇒ Boolean Also known as: validate_check_enabled

Returns:

  • (Boolean)


1146
1147
1148
# File 'lib/awetestlib/regression/validations.rb', line 1146

def checkbox_is_enabled?(browser, strg, desc = '')
  enabled?(browser, :checkbox, :id, strg, desc)
end

#checkbox_not_checked?(browser, strg, desc) ⇒ Boolean Also known as: validate_not_check

Returns:

  • (Boolean)


1162
1163
1164
# File 'lib/awetestlib/regression/validations.rb', line 1162

def checkbox_not_checked?(browser, strg, desc)
  not_checked?(browser, :id, strg, desc)
end

#checked?(browser, how, what, desc = '') ⇒ Boolean Also known as: checkbox_checked?, checkbox_set?

Returns:

  • (Boolean)


227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/awetestlib/regression/validations.rb', line 227

def checked?(browser, how, what, desc = '')
  msg = "Checkbox #{how}=>#{what} is checked."
  msg << " #{desc}" if desc.length > 0
  if browser.checkbox(how, what).checked?
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    failed_to_log(msg)
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#checked_by_id?(browser, strg, desc = '') ⇒ Boolean Also known as: validate_check, checkbox_is_checked?

Returns:

  • (Boolean)


1139
1140
1141
# File 'lib/awetestlib/regression/validations.rb', line 1139

def checked_by_id?(browser, strg, desc = '')
  checked?(browser, :id, strg, desc)
end

#date_string_equals?(actual, expected, desc = '', fail_on_format = true) ⇒ Boolean

Returns:

  • (Boolean)


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/awetestlib/regression/validations.rb', line 108

def date_string_equals?(actual, expected, desc = '', fail_on_format = true)
  rtrn = false
  msg  = "Assert actual date '#{actual}' equals expected date '#{expected}'. #{desc} "
  if actual == expected
    rtrn = true
  elsif DateTime.parse(actual).to_s == DateTime.parse(expected).to_s
    msg << " with different formatting. "
    if not fail_on_format
      rtrn = true
    end
  end
  msg << " #{desc}" if desc.length > 0
  if rtrn
    passed_to_log("#{msg}")
  else
    failed_to_log("#{msg}")
  end
  rtrn
rescue
  failed_to_log("Unable to #{msg}. #{$!}")
end

#disabled?(browser, element, how, what, desc = '') ⇒ Boolean Also known as: validate_not_enabled, validate_disabled

Returns:

  • (Boolean)


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/awetestlib/regression/validations.rb', line 130

def disabled?(browser, element, how, what, desc = '')
  msg = "#{element.to_s.titlecase} by #{how}=>'#{what}' is disabled. #{desc}"
  case element
    when :textfield, :textarea, :text_area, :text_field
      rtrn = browser.text_field(how, what).disabled? ||
          browser.text_field(how, what).readonly?
    when :select_list, :selectlist
      rtrn = browser.select_list(how, what).disabled?
    when :checkbox
      rtrn = browser.checkbox(how, what).disabled?
    when :radio
      rtrn = browser.radio(how, what).disabled?
    when :button
      rtrn = browser.button(how, value).disabled?
    else
      msg = "#{__method__} does not yet support '#{element}'. #{desc}"
      debug_to_log(msg)
      raise msg
  end
  if rtrn
    passed_to_log("#{msg}")
    true
  else
    failed_to_log("#{msg}")
  end
  rtrn
rescue
  failed_to_log("#Unable to verify that #{msg}: '#{$!}'")
end

#does_not_exist?(browser, element, how, what, value = nil, desc = '') ⇒ Boolean Also known as: not_exist?

Returns:

  • (Boolean)


278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/awetestlib/regression/validations.rb', line 278

def does_not_exist?(browser, element, how, what, value = nil, desc = '')
  msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
  msg << "and value=>'#{value}' " if value
  msg << "does not exist."
  msg << " #{desc}" if desc.length > 0
  if browser.element(how, what).exists?
    failed_to_log(msg)
  else
    passed_to_log(msg)
    true
  end
rescue
  failed_to_log("Unable to verify that #{msg}': '#{$!}' #{desc}")
end

#element_contains_text?(browser, element, how, what, expected, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


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
# File 'lib/awetestlib/regression/validations.rb', line 745

def element_contains_text?(browser, element, how, what, expected, desc = '')
  msg = "Element #{element} :{how}=>#{what} contains text '#{expected}'."
  msg << " #{desc}" if desc.length > 0
  who = browser.element(how, what)
  if who
    text = who.text
    if expected and expected.length > 0
      rgx = Regexp.new(Regexp.escape(expected))
      if text =~ rgx
        passed_to_log(msg)
        true
      else
        debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
        debug_to_log("act: [#{text.gsub(' ', '^')}]")
        failed_to_log("#{msg} Found '#{text}'. #{desc}")
      end
    else
      if text.length > 0
        debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
        debug_to_log("act: [#{text.gsub(' ', '^')}]")
        failed_to_log("#{msg} Found '#{text}'. #{desc}")
      else
        passed_to_log(msg)
        true
      end
    end
  end
rescue
  failed_to_log("Unable to verify #{msg} '#{$!}'")
end

#enabled?(browser, element, how, what, desc = '') ⇒ Boolean Also known as: validate_enabled

Returns:

  • (Boolean)


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/awetestlib/regression/validations.rb', line 84

def enabled?(browser, element, how, what, desc = '')
  msg = "#{element.to_s.titlecase} by #{how}=>'#{what}' is enabled.}"
  msg << " #{desc}" if desc.length > 0
  case element
    when :textfield, :textarea, :text_area, :text_field
      rtrn = browser.text_field(how, what).enabled? and not browser.text_field(how, what).readonly?
    when :select_list, :selectlist
      rtrn = browser.select_list(how, what).enabled?
    else
      rtrn = browser.element(how, what).enabled?
  end
  if rtrn
    passed_to_log("#{msg}")
    true
  else
    failed_to_log("#{msg}")
  end
  rtrn
rescue
  failed_to_log("#Unable to verify that #{msg}': '#{$!}")
end

#exists?(browser, element, how, what, value = nil, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/awetestlib/regression/validations.rb', line 263

def exists?(browser, element, how, what, value = nil, desc = '')
  msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
  msg << "and value=>'#{value}' " if value
  msg << "exists"
  e = get_element(browser, element, how, what, value)
  if e
    passed_to_log("#{msg}? #{desc}")
    true
  else
    failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
  end
rescue
  failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
end

Returns:

  • (Boolean)


557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/awetestlib/regression/validations.rb', line 557

def link_disabled?(browser, strg)
  #TODO use disabled?()
  count = string_count_in_string(browser.text, strg)
  if count > 0
    if browser.link(:text, strg).enabled?
      if validate(browser, @myName, __LINE__)
        failed_to_log(strg + " is enabled. (#{__LINE__})")
      end
    else
      passed_to_log(strg + " is not enabled.")
      true
    end
  else
    failed_to_log("Link '#{strg.to_s}' (by :text) not found. Cannot validate if disabled. (#{__LINE__}) " + desc)
  end
rescue
  failed_to_log("Unable to validate that link with :text '#{text}' is enabled: '#{$!}'. (#{__LINE__})")
  debug_to_log("#{strg} appears #{count} times in browser.text.")
end

Returns:

  • (Boolean)


535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/awetestlib/regression/validations.rb', line 535

def link_enabled?(browser, strg)
  #TODO Use enabled?()
  count = string_count_in_string(browser.text, strg)
  if count > 0
    if browser.link(:text, strg).enabled?
      if validate(browser, @myName, __LINE__)
        passed_to_log(strg + " is enabled. (#{__LINE__})")
        true
      end
    else
      failed_to_log(strg + " is not enabled.")
    end
  else
    failed_to_log("Link '#{strg.to_s}' (by :text) not found. Cannot validate if enabled. (#{__LINE__}) " + desc)
  end
rescue
  failed_to_log("Unable to validate that link with :text '#{text}' is enabled: '#{$!}'. (#{__LINE__})")
  debug_to_log("#{strg} appears #{count} times in browser.text.")
end

Returns:

  • (Boolean)


518
519
520
# File 'lib/awetestlib/regression/validations.rb', line 518

def link_not_exist?(browser, link, desc = '')
  does_not_exist?(browser, :link, :text, link, nil, desc)
end

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/awetestlib/regression/validations.rb', line 9

def modal_exists?(browser, button = nil)
  rtrn = nil
  if @browserAbbrev == 'IE'
    Timeout::timeout(2) do
      begin
        if browser.enabled_popup
          hwnd = browser.enabled_popup(5)
          debug_to_log("Modal popup with handle #{hwnd} found. (#{__LINE__})")
          wc = WinClicker.new
          wc.makeWindowActive(hwnd)
          rtrn = wc.getWindowTitle(hwnd)
          if button
            wc.clickWindowsButton_hWnd(hwnd, button)
          end
          wc = nil
        end
      rescue Timeout::Error
        debug_to_log("No Modal popup found. (#{__LINE__})")
        return rtrn
      end
      return rtrn
    end
    rtrn
  else
    rtrn
  end
end

#not_checked?(browser, how, what, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/awetestlib/regression/validations.rb', line 245

def not_checked?(browser, how, what, desc = '')
  msg = "Checkbox #{how}=>#{what} is not checked."
  msg << " #{desc}" if desc.length > 0
  if not browser.checkbox(how, what).checked?
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    failed_to_log(msg)
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#not_read_only?(browser, element, how, what, value = nil, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/awetestlib/regression/validations.rb', line 451

def not_read_only?(browser, element, how, what, value = nil, desc = '')
  msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
  msg << "and value=>'#{value}' " if value
  msg << "is not read only"
  e = get_element(browser, element, how, what, value)
  if e
    if e.readonly?
      failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
    else
      passed_to_log("#{msg}? #{desc}")
      true
    end
  end
rescue
  failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
end

#not_set?(browser, how, what, desc = '', no_fail = false) ⇒ Boolean Also known as: radio_not_set?, radio_not_checked?, radio_not_selected?

Returns:

  • (Boolean)


319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/awetestlib/regression/validations.rb', line 319

def not_set?(browser, how, what, desc = '', no_fail = false)
  #TODO Needs to handle radio value as well
  msg = "Radio #{how}=>#{what} is not selectedd."
  msg << " #{desc}" if desc.length > 0
  if not browser.radio(how, what).set?
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    if no_fail
      passed_to_log("Radio #{how}=>#{what} is not selected.")
    else
      failed_to_log(msg)
    end
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#not_visible?(browser, element, how, what, desc = '') ⇒ Boolean Also known as: validate_not_visible

Returns:

  • (Boolean)


201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/awetestlib/regression/validations.rb', line 201

def not_visible?(browser, element, how, what, desc = '')
  msg  = "#{element.to_s.titlecase} #{how}=>'#{what}' is not visible. #{desc}"
  rtrn = false
  case how
    when :index
      target = get_element(browser, element, how, what)
      if not target.visible?
        rtrn = true
      end
    else
      if not browser.element(how, what).visible?
        rtrn = true
      end
  end
  if rtrn
    passed_to_log("#{msg}")
  else
    failed_to_log("#{msg}")
  end
  rtrn
rescue
  failed_to_log("Unable to verify that #{msg}': '#{$!}' #{desc}")
end

Returns:

  • (Boolean)


579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/awetestlib/regression/validations.rb', line 579

def popup_exists?(popup, message=nil)
  if not message
    message = "Popup: #{popup.title}"
  end
  if is_browser?(popup)
    passed_to_log("#{message}: found.")
    debug_to_log("\n"+popup.text+"\n")
    true
  else
    failed_to_log("#{message}: not found." + " (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate existence of popup: '#{$!}'. (#{__LINE__})")
end

#radio_is_set?(browser, radio, message) ⇒ Boolean Also known as: validate_radioset, validate_radio_set

Returns:

  • (Boolean)


1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
# File 'lib/awetestlib/regression/validations.rb', line 1110

def radio_is_set?(browser, radio, message)
  if browser.radio(:id, radio).checked?
    if validate(browser, @myName, __LINE__)
      passed_to_log(message)
      true
    end
  else
    failed_to_log(message + " (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate that radio with id='#{radio} is clear': '#{$!}'. (#{__LINE__})")
end

#radio_with_value_set?(browser, how, what, value, desc = '', no_fail = false) ⇒ Boolean Also known as: radio_set_with_value?

Returns:

  • (Boolean)


343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/awetestlib/regression/validations.rb', line 343

def radio_with_value_set?(browser, how, what, value, desc = '', no_fail = false)
  msg = "Radio #{how}=>#{what} :value=>#{value} is selected."
  msg << " #{desc}" if desc.length > 0
  if browser.radio(how, what, value).set?
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    if no_fail
      passed_to_log("Radio #{how}=>#{what} :value=>#{value} is not selected.")
    else
      failed_to_log(msg)
    end
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#read_only?(browser, element, how, what, value = nil, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/awetestlib/regression/validations.rb', line 434

def read_only?(browser, element, how, what, value = nil, desc = '')
  msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
  msg << "and value=>'#{value}' " if value
  msg << "read only"
  e = get_element(browser, element, how, what, value)
  if e
    if e.readonly?
      passed_to_log("#{msg}? #{desc}")
      true
    else
      failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
    end
  end
rescue
  failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
end

#ready?(browser, element, how, what, value = '', desc = '') ⇒ Boolean

Returns:

  • (Boolean)


468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/awetestlib/regression/validations.rb', line 468

def ready?(browser, element, how, what, value = '', desc = '')
  msg = "#{element.to_s.titlecase} with #{how}=>'#{what}' "
  msg << "and value=>'#{value}' " if value
  e = get_element(browser, element, how, what, value)
  if e and e.enabled?
    passed_to_log("#{msg}? #{desc}")
    true
  else
    failed_to_log("#{msg}? #{desc} [#{get_callers(1)}]")
  end
rescue
  failed_to_log("Unable to determine if #{msg}. #{desc} '#{$!}' [#{get_callers(1)}]")
end

#select_list_does_not_include?(browser, how, what, option, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/awetestlib/regression/validations.rb', line 385

def select_list_does_not_include?(browser, how, what, option, desc = '')
  msg = "Select list #{how}=>#{what} does not include option '#{option}'."
  msg << " #{desc}" if desc.length > 0
  select_list = browser.select_list(how, what)
  options     = select_list.options
  if option
    if not options.include?(option)
      passed_to_log(msg)
      true
    else
      failed_to_log(msg)
      nil
    end
  end
rescue
  failed_to_log("Unable to verify #{msg}. '#{$!}'")
end

#select_list_includes?(browser, how, what, option, desc = '') ⇒ Boolean Also known as: validate_select_list_contains, select_list_contains?

Returns:

  • (Boolean)


364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/awetestlib/regression/validations.rb', line 364

def select_list_includes?(browser, how, what, option, desc = '')
  msg = "Select list #{how}=>#{what} includes option '#{option}'."
  msg << " #{desc}" if desc.length > 0
  select_list = browser.select_list(how, what)
  options     = select_list.options
  if option
    if options.include?(option)
      passed_to_log(msg)
      true
    else
      failed_to_log(msg)
      nil
    end
  end
rescue
  failed_to_log("Unable to verify #{msg}. '#{$!}'")
end

#set?(browser, how, what, desc = '', no_fail = false) ⇒ Boolean Also known as: radio_set?, radio_checked?, radio_selected?

Returns:

  • (Boolean)


295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/awetestlib/regression/validations.rb', line 295

def set?(browser, how, what, desc = '', no_fail = false)
  #TODO Needs to handle radio value as well
  msg = "Radio #{how}=>#{what} is selected."
  msg << " #{desc}" if desc.length > 0
  if browser.radio(how, what).set?
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    if no_fail
      passed_to_log("Radio #{how}=>#{what} is not selected.")
    else
      failed_to_log(msg)
    end
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#span_contains_text?(browser, how, what, expected, desc = '') ⇒ Boolean Also known as: valid_text_in_span

Returns:

  • (Boolean)


776
777
778
# File 'lib/awetestlib/regression/validations.rb', line 776

def span_contains_text?(browser, how, what, expected, desc = '')
  element_contains_text?(browser, :span, how, what, expected, desc)
end

#string_contains?(strg, target, desc = '') ⇒ Boolean Also known as: validate_string, validate_string_contains

Returns:

  • (Boolean)


899
900
901
902
903
904
905
906
907
908
# File 'lib/awetestlib/regression/validations.rb', line 899

def string_contains?(strg, target, desc = '')
  msg = "String '#{strg}' contains '#{target}'."
  msg << " '#{desc}' " if desc.length > 0
  if strg.match(target)
    passed_to_log("#{msg} (#{__LINE__})")
    true
  else
    failed_to_log("#{msg} (#{__LINE__})")
  end
end

#string_does_not_contain?(strg, target, desc = '') ⇒ Boolean Also known as: validate_string_not_contains, validate_string_not_contain, validate_string_does_not_contain

Returns:

  • (Boolean)


913
914
915
916
917
918
919
920
921
922
# File 'lib/awetestlib/regression/validations.rb', line 913

def string_does_not_contain?(strg, target, desc = '')
  msg = "String '#{strg}' does not contain '#{target}'."
  msg << " '#{desc}' " if desc.length > 0
  if strg.match(target)
    failed_to_log("#{msg} (#{__LINE__})")
    true
  else
    passed_to_log("#{msg} (#{__LINE__})")
  end
end

#string_does_not_equal?(strg, target, desc = '') ⇒ Boolean Also known as: validate_string_not_equal, validate_string_does_not_equal

Returns:

  • (Boolean)


420
421
422
423
424
425
426
427
428
429
# File 'lib/awetestlib/regression/validations.rb', line 420

def string_does_not_equal?(strg, target, desc = '')
  msg = "String '#{strg}' does not equal '#{target}'."
  msg << " '#{desc}' " if desc.length > 0
  if strg == target
    failed_to_log("#{msg} (#{__LINE__})")
    true
  else
    passed_to_log("#{msg} (#{__LINE__})")
  end
end

#string_equals?(actual, target, desc = '') ⇒ Boolean Also known as: validate_string_equal, validate_string_equals, text_equals, text_equals?

Returns:

  • (Boolean)


403
404
405
406
407
408
409
410
411
412
413
# File 'lib/awetestlib/regression/validations.rb', line 403

def string_equals?(actual, target, desc = '')
  msg = "Assert actual '#{actual}' equals expected '#{target}'. #{desc} "
  if actual == target
    passed_to_log("#{msg}")
    true
  else
    failed_to_log("#{msg}")
  end
rescue
  failed_to_log("Unable to #{msg}. #{$!}")
end

#text_in_element_equals?(browser, element, how, what, expected, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/awetestlib/regression/validations.rb', line 721

def text_in_element_equals?(browser, element, how, what, expected, desc = '')
  msg = "Expected exact text '#{expected}' in #{element} :#{how}=>#{what}."
  msg << " #{desc}" if desc.length > 0
  text = ''
  who  = browser.element(how, what)
  if who
    text = who.text
    if text == expected
      passed_to_log(msg)
      true
    else
      debug_to_log("exp: [#{expected.gsub(' ', '^')}]")
      debug_to_log("act: [#{text.gsub(' ', '^')}]")
      failed_to_log("#{msg} Found '#{text}'.")
    end
  end
rescue
  failed_to_log("Unable to verify #{msg} '#{$!}'")
end

#text_in_span_equals?(browser, how, what, expected, desc = '') ⇒ Boolean

Returns:

  • (Boolean)


741
742
743
# File 'lib/awetestlib/regression/validations.rb', line 741

def text_in_span_equals?(browser, how, what, expected, desc = '')
  text_in_element_equals?(browser, :span, how, what, expected, desc)
end

#textfield_does_not_equal?(browser, how, what, expected, desc = '') ⇒ Boolean Also known as: validate_textfield_not_value

Returns:

  • (Boolean)


952
953
954
955
956
957
958
959
960
961
962
963
964
965
# File 'lib/awetestlib/regression/validations.rb', line 952

def textfield_does_not_equal?(browser, how, what, expected, desc = '')
  msg = "Text field #{how}=>#{what} does not equal '#{expected}'"
  msg << " #{desc}" if desc.length > 0
  if not browser.text_field(how, what).value == expected
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    failed_to_log(msg)
  end
rescue
  failed_to_log("Unable to validate that #{msg}: '#{$!}'")
end

#textfield_empty?(browser, how, what, desc = '') ⇒ Boolean Also known as: validate_textfield_empty, text_field_empty?

Returns:

  • (Boolean)


983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
# File 'lib/awetestlib/regression/validations.rb', line 983

def textfield_empty?(browser, how, what, desc = '')
  msg = "Text field #{how}=>#{what} is empty."
  msg << desc if desc.length > 0
  value = browser.text_field(how, what).value
  if value.to_s.length == 0
    if validate(browser, @myName, __LINE__)
      passed_to_log(msg)
      true
    end
  else
    failed_to_log("#{msg} Contains '#{value}'")
  end
rescue
  failed_to_log("Unable to validate #{msg}  '#{$!}'")
end

#textfield_equals?(browser, how, what, expected, desc = '') ⇒ Boolean Also known as: validate_textfield_value, text_field_equals?

Returns:

  • (Boolean)


1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
# File 'lib/awetestlib/regression/validations.rb', line 1014

def textfield_equals?(browser, how, what, expected, desc = '')
  msg    = "Expected '#{expected}' in textfield #{how}=>'#{what}'. #{desc}"
  actual = browser.text_field(how, what).value
  if actual.is_a?(Array)
    actual = actual[0].to_s
  end
  #debug_to_report("#{actual.inspect}")
  #debug_to_report("#{actual}")
  if actual == expected
    if validate(browser, @myName, __LINE__)
      passed_to_log("#{msg}")
      true
    end
  else
    act_s = actual.strip
    exp_s = expected.strip
    if act_s == exp_s
      if validate(browser, @myName, __LINE__)
        passed_to_log("#{msg} (stripped)")
        true
      end
    else
      debug_to_report(
          "#{__method__} (spaces underscored):\n "+
              "expected:[#{expected.gsub(' ', '_')}] (#{expected.length})\n "+
              "actual:[#{actual.gsub(' ', '_')}] (#{actual.length})"
      )
      failed_to_log("#{msg}. Found: '#{actual}'")
    end
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}")
end

#validate_check_by_class(browser, strg, desc) ⇒ Object



1158
1159
1160
# File 'lib/awetestlib/regression/validations.rb', line 1158

def validate_check_by_class(browser, strg, desc)
  checked?(browser, :class, strg, desc)
end

#validate_div_not_visible_by_id(browser, strg, desc = '') ⇒ Object



528
529
530
# File 'lib/awetestlib/regression/validations.rb', line 528

def validate_div_not_visible_by_id(browser, strg, desc = '')
  not_visible?(browser, :div, :id, strg, desc)
end

#validate_div_visible_by_id(browser, strg) ⇒ Object



524
525
526
# File 'lib/awetestlib/regression/validations.rb', line 524

def validate_div_visible_by_id(browser, strg)
  visible?(browser, :div, :id, strg)
end

#validate_drag_drop(err, tol, exp, act) ⇒ Object



602
603
604
605
606
607
608
609
610
# File 'lib/awetestlib/regression/validations.rb', line 602

def validate_drag_drop(err, tol, exp, act)
  ary = [false, "failed, expected: #{exp}, actual: #{act}, err: #{err}"]
  if err == 0
    ary = [true, 'succeeded ']
  elsif err.abs <= tol
    ary = [true, "within tolerance (+-#{tol}px) "]
  end
  ary
end

#validate_image(browser, source, desc = '', nofail = false) ⇒ Object



1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
# File 'lib/awetestlib/regression/validations.rb', line 1168

def validate_image(browser, source, desc = '', nofail=false)
  if browser.image(:src, source).exists?
    if validate(browser, @myName, __LINE__)
      passed_to_log("Found '#{source}' image. #{desc}")
      true
    end
  else
    failed_to_log("Did not find '#{source}' image. #{desc} (#{__LINE__})") unless nofail
  end
rescue
  failed_to_log("Unable to validate that '#{+source}' image appeared in page: '#{$!}'. (#{__LINE__})")
end

backward compatible methods #####



514
515
516
# File 'lib/awetestlib/regression/validations.rb', line 514

def validate_link_exist(browser, link, logit = true, desc = '')
  exists?(browser, :link, :text, link, nil, desc)
end

#validate_list(browser, listId, text, message) ⇒ Object



612
613
614
615
# File 'lib/awetestlib/regression/validations.rb', line 612

def validate_list(browser, listId, text, message)
  message_to_log("Method validate_list() is deprecated: use validate_list_by_xxx instead")
  validate_list_by_id(browser, listId, text, message)
end

#validate_list_by_id(browser, strg, text, message, select_if_present = true) ⇒ Object

Validate select list contains text



618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/awetestlib/regression/validations.rb', line 618

def validate_list_by_id(browser, strg, text, message, select_if_present=true)
  #TODO Use select_list_includes?() ?
  if browser.select_list(:id, strg).exists?
    select_list = browser.select_list(:id, strg)
    if select_list.include?(text)
      if select_if_present
        if select_option_by_id_and_option_text(browser, strg, text)
          if validate(browser, @myName, __LINE__)
            passed_to_log(message)
            true
          end
        else
          failed_to_log(message + " (#{__LINE__})")
        end
      else
        if validate(browser, @myName, __LINE__)
          passed_to_log(message)
          true
        end
      end
    else
      failed_to_log(message + "  Not found. (#{__LINE__})")
    end
  else
    failed_to_log("Select list with id='#{strg} not found. (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate selectlist with id='#{strg}: '#{$!}'. (#{__LINE__})")
end

#validate_list_by_name(browser, strg, text, message, select_if_present = true) ⇒ Object

Validate select list contains text



649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/awetestlib/regression/validations.rb', line 649

def validate_list_by_name(browser, strg, text, message, select_if_present=true)
  #TODO Use select_list_includes?() ?
  if browser.select_list(:name, strg).exists?
    select_list = browser.select_list(:name, strg)
    if select_list.include?(text)
      if select_if_present
        if select_option_by_name_and_option_text(browser, strg, text)
          if validate(browser, @myName, __LINE__)
            passed_to_log(message)
            true
          end
        else
          failed_to_log(message + " (#{__LINE__})")
        end
      else
        if validate(browser, @myName, __LINE__)
          passed_to_log(message)
          true
        end
      end
    else
      failed_to_log(message + "  Not found. (#{__LINE__})")
    end
  else
    failed_to_log("Select list with name='#{strg} not found. (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate that '#{text}' appeared in select list with name='#{strg}: '#{$!}'. (#{__LINE__})")
end

#validate_message(browser, message) ⇒ Object



37
38
39
40
41
# File 'lib/awetestlib/regression/validations.rb', line 37

def validate_message(browser, message)
  if validate(browser, @myName, __LINE__)
    message_to_log(message)
  end
end

#validate_no_list(browser, id, text, desc = '') ⇒ Object

Validate select list does not contain text



680
681
682
# File 'lib/awetestlib/regression/validations.rb', line 680

def validate_no_list(browser, id, text, desc = '')
  select_list_does_not_include?(browser, :id, id, text, desc)
end

#validate_no_text(browser, ptrn, desc = '') ⇒ Object



928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
# File 'lib/awetestlib/regression/validations.rb', line 928

def validate_no_text(browser, ptrn, desc = '')
  cls = browser.class.to_s
  cls.gsub!('Watir::', '')
  cls.gsub!('IE', 'Browser')
  msg = "#{cls} does not contain text '#{ptrn}'."
  msg << " #{desc}" if desc.length > 0
  if ptrn.is_a?(Regexp)
    target = ptrn
  else
    target = Regexp.new(Regexp.escape(ptrn))
  end
  browser_text = browser.text
  if browser_text.match(target)
    if validate(browser, @myName, __LINE__)
      failed_to_log("#{msg} [#{browser_text.match(target)[0]}]")
    end
  else
    passed_to_log(msg)
    true
  end
rescue
  failed_to_log("Unable to validate #{msg}: '#{$!}'")
end

#validate_radio_not_set(browser, radio, message) ⇒ Object Also known as: validate_not_radioset



1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
# File 'lib/awetestlib/regression/validations.rb', line 1095

def validate_radio_not_set(browser, radio, message)
  if browser.radio(:id, radio).checked?
    if validate(browser, @myName, __LINE__)
      failed_to_log(message + " (#{__LINE__})")
    end
  else
    passed_to_log(message)
    true
  end
rescue
  failed_to_log("Unable to validate that radio with id='#{radio} is clear': '#{$!}'. (#{__LINE__})")
end

#validate_radioset_by_name(browser, radio, message) ⇒ Object



1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
# File 'lib/awetestlib/regression/validations.rb', line 1126

def validate_radioset_by_name(browser, radio, message)
  if browser.radio(:name, radio).checked?
    if validate(browser, @myName, __LINE__)
      passed_to_log(message)
      true
    end
  else
    failed_to_log(message + " (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate that radio with name='#{radio} is clear': '#{$!}'. (#{__LINE__})")
end

#validate_select_list(browser, how, what, opt_type, list = nil, multiple = false, ignore = ['Select One'], limit = 5) ⇒ Object



799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
# File 'lib/awetestlib/regression/validations.rb', line 799

def validate_select_list(browser, how, what, opt_type, list = nil, multiple = false, ignore = ['Select One'], limit = 5)
  mark_testlevel("#{__method__.to_s.titleize} (#{how}=>#{what})", 2)
  ok          = true
  select_list = browser.select_list(how, what)
  options     = select_list.options
  if list
    if options == list
      passed_to_log("Select list options list equals expected list #{list}")
    else
      debug_to_report("actual:\n#{nice_array(options, true)}")
      debug_to_report("expected:\n#{nice_array(list, true)}")
      failed_to_log("Select list options list #{nice_array(options, true)} "+
                        "does not equal expected list #{nice_array(list, true)}")
    end
  end

  #single selections
  cnt = 0
  options.each do |opt|
    if not ignore.include?(opt)
      cnt += 1
      ok  = select_option(select_list, opt_type, opt)
      break if not ok
      select_list.clear
      break if limit > 0 and cnt >= limit
    end
  end

  sleep_for(0.5)
  select_list.clear
  if ok and multiple
    if options.length > 2
      targets = list.slice(1, 2)
      select_option(select_list, opt_type, options[1])
      select_option(select_list, opt_type, options[2])
      selected = select_list.selected_options
      if selected == targets
        passed_to_log("Select list selected options equals expected #{targets}")
      else
        failed_to_log("Select list selected options #{selected} does not equal expected list #{targets.to_a}")
      end
    else
      debug_to_log("Too few options to test multiple selection (need 2 or more): '#{options}", __LINE__)
    end
  end
rescue
  failed_to_log("Unable to validate select_list: '#{$!}'", __LINE__)
end

#validate_select_list_contents(browser, how, what, list) ⇒ Object



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
# File 'lib/awetestlib/regression/validations.rb', line 848

def validate_select_list_contents(browser, how, what, list)
  mark_testlevel("#{__method__.to_s.titleize} (#{what})", 2)
  select_list = browser.select_list(how, what)
  options     = select_list.options
  if list
    if options == list
      passed_to_log("Select list options list equals expected list #{list}")
      options
    else
      failed_to_log("Select list options list #{options} does not equal expected list #{list}")
      nil
    end
  end
rescue
  failed_to_log("Unable to validate select_list contents: '#{$!}'", __LINE__)
end

#validate_selected_options(browser, how, what, list, desc = '') ⇒ Object Also known as: validate_selections, validate_select_list_selections



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/awetestlib/regression/validations.rb', line 865

def validate_selected_options(browser, how, what, list, desc = '')
  select_list = browser.select_list(how, what)
  selected    = select_list.selected_options.sort
  if list.is_a?(Array)
    if selected == list.sort
      passed_to_log("Expected options [#{list.sort}] are selected [#{selected}]. #{desc}")
    else
      failed_to_log("Selected options [#{selected}] do not match expected [#{list.sort}]. #{desc}")
      true
    end
  else
    if selected.length == 1
      if selected[0] =~ /#{list}/
        passed_to_log("Expected option [#{list}] was selected. #{desc}")
        true
      else
        failed_to_log("Expected option [#{list}] was not selected. Found [#{selected}]. #{desc}")
      end
    else
      if selected.include?(list)
        failed_to_log("Expected option [#{list}] was found among multiple selections [#{selected}]. #{desc}")
      else
        failed_to_log("Expected option [#{list}] was not found among multiple selections [#{selected}]. #{desc}")
      end
    end
  end

rescue
  failed_to_log("Unable to validate selected option(s): '#{$!}' #{desc}", __LINE__)
end

#validate_style_value(browser, element, how, what, type, expected, desc = '') ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/awetestlib/regression/validations.rb', line 43

def validate_style_value(browser, element, how, what, type, expected, desc = '')
  #TODO: works only with watir-webdriver
  msg = "Expected CSS style #{type} value '#{expected}' in #{element} with #{how} = #{what}"
  msg << " #{desc}" if desc.length > 0
  case element
    when :link
      actual = browser.link(how => what).style type
    when :button
      actual = browser.button(how => what).style type
    when :image
      actual = browser.image(how => what).style type
    when :span
      actual = browser.span(how => what).style type
    when :div
      actual = browser.div(how => what).style type
  end
  if expected == actual
    passed_to_log(msg)
  else
    failed_to_log(msg)
  end
rescue
  failed_to_log( "Unable to validate #{msg} '#{$!}'")
end

#validate_text(browser, ptrn, desc = '', skip_fail = false, skip_sleep = false) ⇒ Object Also known as: validate_link



684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
# File 'lib/awetestlib/regression/validations.rb', line 684

def validate_text(browser, ptrn, desc = '', skip_fail = false, skip_sleep = false)
  cls = browser.class.to_s
  cls.gsub!('Watir::', '')
  cls.gsub!('IE', 'Browser')
  msg = "#{cls} text contains  '#{ptrn}'."
  msg << " #{desc}" if desc.length > 0
  if ptrn.is_a?(Regexp)
    target = ptrn
  else
    target = Regexp.new(Regexp.escape(ptrn))
  end
  sleep_for(2) unless skip_sleep
  myText = browser.text
  if not myText.match(target)
    sleep_for(2) unless skip_sleep #TODO try a wait_until here
    myText = browser.text
  end
  if myText.match(target)
    #if myText.match(ptrn)
    if validate(browser, @myName, __LINE__)
      passed_to_log("#{msg}")
      true
    end
  else
    if skip_fail
      debug_to_log("#{cls}  text does not contain the text: '#{ptrn}'.  #{desc}")
    else
      failed_to_log("#{msg}")
    end
    #debug_to_log("\n#{myText}")
  end
rescue
  failed_to_log("Unable to validate #{msg} '#{$!}'")
end

#validate_text_in_span_by_id(browser, id, strg = '', desc = '') ⇒ Object



782
783
784
# File 'lib/awetestlib/regression/validations.rb', line 782

def validate_text_in_span_by_id(browser, id, strg = '', desc = '')
  element_contains_text?(browser, :span, :id, id, strg, desc)
end

#validate_textfield_disabled_by_name(browser, strg, desc = '') ⇒ Object Also known as: disabled_textfield_by_name



1077
1078
1079
# File 'lib/awetestlib/regression/validations.rb', line 1077

def validate_textfield_disabled_by_name(browser, strg, desc = '')
  disabled?(browser, :text_field, :name, strg, desc)
end

#validate_textfield_dollar_value(browser, how, what, expected, with_cents = true, desc = '') ⇒ Object



1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'lib/awetestlib/regression/validations.rb', line 1051

def validate_textfield_dollar_value(browser, how, what, expected, with_cents = true, desc = '')
  desc << " Dollar formatting"
  if with_cents
    expected << '.00' if not expected =~ /\.00$/
    desc << ' without cents.'
  else
    expected.gsub!(/\.00$/, '')
    desc << ' with cents.'
  end
  textfield_equals?(browser, how, what, expected, desc)
end

#validate_textfield_empty_by_id(browser, id, message = '') ⇒ Object



1006
1007
1008
# File 'lib/awetestlib/regression/validations.rb', line 1006

def validate_textfield_empty_by_id(browser, id, message = '')
  validate_textfield_empty(browser, :id, id, message)
end

#validate_textfield_empty_by_name(browser, name, message = '') ⇒ Object



1002
1003
1004
# File 'lib/awetestlib/regression/validations.rb', line 1002

def validate_textfield_empty_by_name(browser, name, message = '')
  validate_textfield_empty(browser, :name, name, message)
end

#validate_textfield_empty_by_title(browser, title, message = '') ⇒ Object



1010
1011
1012
# File 'lib/awetestlib/regression/validations.rb', line 1010

def validate_textfield_empty_by_title(browser, title, message = '')
  validate_textfield_empty(browser, :title, title, message)
end

#validate_textfield_enabled_by_name(browser, strg, desc = '') ⇒ Object Also known as: enabled_textfield_by_name



1083
1084
1085
# File 'lib/awetestlib/regression/validations.rb', line 1083

def validate_textfield_enabled_by_name(browser, strg, desc = '')
  enabled?(browser, :text_field, :name, strg, desc)
end

#validate_textfield_not_value_by_id(browser, id, value, desc = '') ⇒ Object Also known as: validate_textfield_no_value_by_id



977
978
979
# File 'lib/awetestlib/regression/validations.rb', line 977

def validate_textfield_not_value_by_id(browser, id, value, desc = '')
  textfield_does_not_equal?(browser, :id, id, value, desc)
end

#validate_textfield_not_value_by_name(browser, name, value, desc = '') ⇒ Object Also known as: validate_textfield_no_value_by_name



970
971
972
# File 'lib/awetestlib/regression/validations.rb', line 970

def validate_textfield_not_value_by_name(browser, name, value, desc = '')
  textfield_does_not_equal?(browser, :name, name, value, desc)
end

#validate_textfield_not_visible_by_name(browser, strg, desc = '') ⇒ Object Also known as: visible_no_textfield_by_name



1089
1090
1091
# File 'lib/awetestlib/regression/validations.rb', line 1089

def validate_textfield_not_visible_by_name(browser, strg, desc = '')
  not_visible?(browser, :text_field, :name, strg, desc)
end

#validate_textfield_value_by_id(browser, id, expected, desc = '') ⇒ Object



1067
1068
1069
# File 'lib/awetestlib/regression/validations.rb', line 1067

def validate_textfield_value_by_id(browser, id, expected, desc = '')
  textfield_equals?(browser, :id, id, expected, desc)
end

#validate_textfield_value_by_name(browser, name, expected, desc = '') ⇒ Object



1063
1064
1065
# File 'lib/awetestlib/regression/validations.rb', line 1063

def validate_textfield_value_by_name(browser, name, expected, desc = '')
  textfield_equals?(browser, :name, name, expected, desc)
end

#validate_textfield_visible_by_name(browser, strg, desc = '') ⇒ Object Also known as: visible_textfield_by_name



1071
1072
1073
# File 'lib/awetestlib/regression/validations.rb', line 1071

def validate_textfield_visible_by_name(browser, strg, desc = '')
  visible?(browser, :text_field, :name, strg, desc)
end

#validate_url(browser, url, message = '') ⇒ Object



786
787
788
789
790
791
792
793
794
795
796
797
# File 'lib/awetestlib/regression/validations.rb', line 786

def validate_url(browser, url, message = '')
  if browser.url.to_s.match(url)
    if validate(browser, @myName, __LINE__)
      passed_to_log('Found "'+url.to_s+'" ' + message)
      true
    end
  else
    failed_to_log('Did not find "'+url.to_s+'" ' + message + " (#{__LINE__})")
  end
rescue
  failed_to_log("Unable to validate that current url is '#{url}': '#{$!}'. (#{__LINE__})")
end

#verify_text_in_table_with_text(table, text, value) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
# File 'lib/awetestlib/regression/validations.rb', line 163

def verify_text_in_table_with_text(table, text, value)
  #TODO This needs clarification, renaming
  msg   = "Table :id=>#{table.id} with text '#{text} contains '#{value}."
  index = get_index_of_row_with_text(table, text)
  if table[index].text =~ value
    passed_to_log(msg)
    true
  else
    failed_to_log(msg)
  end
end

#visible?(browser, element, how, what, desc = '') ⇒ Boolean Also known as: validate_visible

Returns:

  • (Boolean)


175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/awetestlib/regression/validations.rb', line 175

def visible?(browser, element, how, what, desc = '')
  msg  = "#{element.to_s.titlecase} #{how}=>'#{what}' is visible. #{desc}"
  rtrn = false
  case how
    when :index
      target = get_element(browser, element, how, what)
      if target.visible?
        rtrn = true
      end
    else
      if browser.element(how, what).visible?
        rtrn = true
      end
  end
  if rtrn
    passed_to_log("#{msg}")
  else
    failed_to_log("#{msg}")
  end
  rtrn
rescue
  failed_to_log("Unable to verify that #{msg}': '#{$!}'")
end

#window_does_not_exist?(title) ⇒ Boolean Also known as: window_no_exists

Returns:

  • (Boolean)


498
499
500
501
502
503
504
505
506
# File 'lib/awetestlib/regression/validations.rb', line 498

def window_does_not_exist?(title)
  title = translate_popup_title(title)
  if @ai.WinExists(title) == 1
    failed_to_log("Window title:'#{title}' exists")
  else
    passed_to_log("Window title:'#{title}' does not exist")
    true
  end
end

#window_exists?(title) ⇒ Boolean Also known as: window_exists

begin methods using @ai #####

Returns:

  • (Boolean)


486
487
488
489
490
491
492
493
494
# File 'lib/awetestlib/regression/validations.rb', line 486

def window_exists?(title)
  title = translate_popup_title(title)
  if @ai.WinExists(title) == 1
    passed_to_log("Window title:'#{title}' exists")
    true
  else
    failed_to_log("Window title:'#{title}' does not exist")
  end
end