awetestlib 0.1.13-x86-mingw32 → 0.1.14-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,14 @@
1
1
  module Awetestlib
2
2
  module Regression
3
+ # Miscellaneous helper methods.
4
+ # Includes file save/upload as well as debug methods.
5
+ # Rdoc work in progress.
3
6
  module Utilities
4
7
 
8
+
9
+ # Group by associated DOM object or scripting function?
10
+
11
+
5
12
  # Place holder to prevent method not found error in scripts
6
13
  def set_script_variables
7
14
  # TODO: replace with method_missing?
@@ -43,6 +50,15 @@ module Awetestlib
43
50
  @y_tolerance = 4
44
51
  end
45
52
 
53
+ def build_message(strg1, desc = '', strg2 = '', strg3 = '', strg4 = '')
54
+ msg = "#{strg1}"
55
+ msg << " #{desc}" if desc.length > 0
56
+ msg << " #{strg2}" if strg2.length > 0
57
+ msg << " #{strg3}" if strg3.length > 0
58
+ msg << " #{strg4}" if strg4.length > 0
59
+ msg
60
+ end
61
+
46
62
  def get_trace(lnbr)
47
63
  callertrace = "\nCaller trace: (#{lnbr})\n"
48
64
  Kernel.caller.each_index do |x|
@@ -318,7 +334,7 @@ module Awetestlib
318
334
  end
319
335
 
320
336
  def get_caller_line
321
- last_caller = get_callers[0]
337
+ last_caller = get_call_list[0]
322
338
  line = last_caller.split(':', 3)[1]
323
339
  line
324
340
  end
@@ -442,7 +458,7 @@ module Awetestlib
442
458
  rtrn
443
459
  end
444
460
 
445
- def dump_select_list_options(element)
461
+ def dump_select_list_options(element, report = false)
446
462
  msg = "#{element.inspect}"
447
463
  options = element.options
448
464
  cnt = 1
@@ -450,7 +466,11 @@ module Awetestlib
450
466
  msg << "\n\t#{cnt}:\t'#{o}"
451
467
  cnt += 1
452
468
  end
453
- debug_to_log(msg)
469
+ if report
470
+ debug_to_report(msg)
471
+ else
472
+ debug_to_log(msg)
473
+ end
454
474
  end
455
475
 
456
476
  def dump_all_tables(browser, to_report = false)
@@ -563,14 +583,13 @@ module Awetestlib
563
583
  text
564
584
  end
565
585
 
586
+ # @deprecated
566
587
  def flash_id(browser, strg, count)
567
588
  msg = "Flash link id='#{strg}' #{count} times."
568
589
  msg << " #{desc}" if desc.length > 0
569
590
  browser.link(:id, strg).flash(count)
570
- if validate(browser, @myName, __LINE__)
571
- passed_to_log(msg)
572
- true
573
- end
591
+ passed_to_log(msg)
592
+ true
574
593
  rescue
575
594
  failed_to_log("Unable to #{msg} '#{$!}'")
576
595
  end
@@ -861,27 +880,22 @@ module Awetestlib
861
880
  msg = "Set focus on textfield name='#{strg}' "
862
881
  msg << " #{desc}" if desc.length > 0
863
882
  tf = browser.text_field(:id, strg)
864
- if validate(browser, @myName, __LINE__)
865
- tf.focus
866
- if validate(browser, @myName, __LINE__)
867
- passed_to_log(msg)
868
- true
869
- end
870
- end
883
+ tf.focus
884
+ passed_to_log(msg)
885
+ true
871
886
  rescue
872
887
  failed_to_log("Unable to #{msg} '#{$!}'")
873
888
  end
874
889
 
890
+ # @deprecated
875
891
  def flash_text(browser, strg, count, desc = '')
876
892
  msg = "Flash link text='#{strg}' #{count} times."
877
893
  msg << " #{desc}" if desc.length > 0
878
894
  strgCnt = string_count_in_string(browser.text, strg)
879
895
  if strgCnt > 0
880
896
  browser.link(:text, strg).flash(count)
881
- if validate(browser, @myName, __LINE__)
882
- passed_to_log(msg)
883
- true
884
- end
897
+ passed_to_log(msg)
898
+ true
885
899
  else
886
900
  failed_to_log("#{msg} Link not found.")
887
901
  end
@@ -889,6 +903,15 @@ module Awetestlib
889
903
  failed_to_log("Unable to #{msg} '#{$!}'")
890
904
  end
891
905
 
906
+ def do_taskkill(severity, pid)
907
+ if pid and pid > 0 and pid < 538976288
908
+ info_to_log("Executing taskkill for pid #{pid}")
909
+ log_message(severity, %x[taskkill /t /f /pid #{pid}])
910
+ end
911
+ rescue
912
+ error_to_log("#{$!} (#{__LINE__})")
913
+ end
914
+
892
915
 
893
916
  end
894
917
  end