awetestlib 0.1.29pre3 → 0.1.29pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README.md +16 -8
  2. data/awetestlib.windows.gemspec +42 -41
  3. data/awetestlib_osx.gemspec +41 -47
  4. data/bin/awetestlib-android-setup.rb +2 -1
  5. data/bin/awetestlib-cucumber-setup.rb +2 -1
  6. data/bin/awetestlib-driver-setup.rb +1 -0
  7. data/bin/awetestlib-helpers.rb +2 -2
  8. data/bin/awetestlib-mobile-app-setup.rb +1 -0
  9. data/bin/awetestlib-netbeans-setup.rb +2 -1
  10. data/bin/awetestlib-regression-setup.rb +26 -12
  11. data/bin/awetestlib-rubymine-setup.rb +9 -4
  12. data/images/netbeans1.jpg +0 -0
  13. data/images/netbeans2.jpg +0 -0
  14. data/images/netbeans3.jpg +0 -0
  15. data/images/netbeans4.jpg +0 -0
  16. data/images/netbeans5.jpg +0 -0
  17. data/images/rubymine1.jpg +0 -0
  18. data/images/rubymine2.jpg +0 -0
  19. data/images/rubymine3.jpg +0 -0
  20. data/images/rubymine4.jpg +0 -0
  21. data/images/scripting1.png +0 -0
  22. data/images/scripting2.png +0 -0
  23. data/images/scripting3.png +0 -0
  24. data/images/scripting4.png +0 -0
  25. data/lib/awetestlib/logging.rb +6 -6
  26. data/lib/awetestlib/regression/browser.rb +15 -12
  27. data/lib/awetestlib/regression/drag_and_drop.rb +421 -421
  28. data/lib/awetestlib/regression/runner.rb +311 -307
  29. data/lib/awetestlib/regression/tables.rb +627 -627
  30. data/lib/awetestlib/regression/user_input.rb +576 -576
  31. data/lib/awetestlib/regression/utilities.rb +1056 -1046
  32. data/lib/awetestlib/regression/validations.rb +2 -1
  33. data/lib/version.rb +2 -2
  34. data/netbeans_setup.md +30 -30
  35. data/rubymine_setup.md +24 -24
  36. data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +303 -25
  37. metadata +160 -34
  38. checksums.yaml +0 -7
data/README.md CHANGED
@@ -3,9 +3,7 @@ Awetestlib
3
3
 
4
4
  Run automated regression and mobile tests
5
5
 
6
- After completing this guide you will be able to run tests locally from command line or from an IDE
7
-
8
- v0.1.29pre3 fixes an issue with running scripts against Safari on OSX
6
+ After completing this guide you will be able to run tests locally from command line or from an IDE.
9
7
 
10
8
  ------------
11
9
 
@@ -18,21 +16,23 @@ You can check your Ruby version using:
18
16
 
19
17
  ruby -v
20
18
 
21
- Additionally, you will need to install DevKit to compile a few dependent gems. You can download DevKit
19
+ Additionally, for Windows, you will need to install the RubyInstaller DevKit to compile a few dependent gems. You can download DevKit
22
20
  [here](http://rubyinstaller.org/downloads/)
21
+ and the installation directions can be found
22
+ [here](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)
23
23
 
24
24
  ## Install
25
25
 
26
- In a terminal or command prompt, install the awetestlib gem
26
+ In a terminal or command prompt, install the awetestlib gem:
27
27
 
28
28
  gem install awetestlib --no-ri --no-rdoc
29
29
 
30
- Note: This could take up to 5 minutes for first time installs and you may need to use 'sudo'
30
+ Note: This could take up to 5 minutes for first time installs. You may need to use 'sudo' on OSX
31
31
 
32
32
 
33
33
  ## Setup Regression Module
34
34
 
35
- To setup the regression module, run the following command and verify the step
35
+ Run the following command and verify the step
36
36
 
37
37
  awetestlib regression_setup
38
38
 
@@ -99,10 +99,18 @@ The full list of parameters for the command line currently are:
99
99
 
100
100
  Usage: awetestlib <script_file> [parameters] [options]
101
101
  -b, --browser BROWSER Specify a browser (IE, FF, S, C)
102
- -l, --library LIBRARY Specify a library to be loaded
103
102
  -r, --root_path ROOT_PATH Specify the root path
103
+ -l, --library LIBRARY Specify a library to be loaded
104
104
  -x, --excel EXCEL_FILE Specify an excel file containing variables to be loaded
105
105
  -v, --version VERSION Specify a browser version
106
+ -e, --environment_url URL Specify the environment URL
107
+ -f, --environment_nodename NODE Specify the environment node name
108
+ -n, --environment_name NAME Specify the environment name
109
+ -u, --selenium_remote_url URL Specify the device's remote url and port
110
+ -s, --screencap_path PATH Specify the path where screenshots will be saved
111
+ -o, --output_to_log Write to log file
112
+ --log_path_subdir SUBDIR Specify log path relative to root_path
113
+ --report_all_test_refs Include list of all error/test case reference ids actually validated
106
114
 
107
115
  To start writing your own script, refer to the [Scripting Guide/Wiki](https://github.com/3qilabs/awetestlib/wiki/Getting-Started---Scripting) wiki
108
116
 
@@ -1,41 +1,42 @@
1
- # -*- encoding: utf-8 -*-
2
- require "lib/version"
3
-
4
- Gem::Specification.new do |s|
5
-
6
- s.name = %q{awetestlib}
7
- s.version = Awetestlib::VERSION
8
- s.date = Awetestlib::VERSION_DATE
9
- s.platform = Gem::Platform::CURRENT
10
-
11
- #s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Anthony Woo", "Patrick Neve"]
13
- s.email = %q{patrick@3qilabs.com}
14
- s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
- s.homepage = %q{http://3qilabs.com}
16
- s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
-
18
- s.add_dependency('watir-webdriver')
19
- s.add_dependency('watir', '1.8.1')
20
- s.add_dependency('commonwatir', '1.8.1')
21
- s.add_dependency('firewatir', '1.8.1')
22
- s.add_dependency('activesupport', '~> 3.0.0')
23
- s.add_dependency('i18n')
24
- s.add_dependency('andand')
25
- s.add_dependency('watirloo')
26
- s.add_dependency('win32-process', '0.6.6')
27
- s.add_dependency('win32screenshot')
28
- s.add_dependency('spreadsheet', '0.6.8')
29
- s.add_dependency('google-spreadsheet-ruby', '0.1.6')
30
- s.add_dependency('roo', '1.10.1')
31
- s.add_dependency('selenium-webdriver')
32
- s.add_dependency('pry')
33
- s.add_dependency('rdoc', '~> 3.11')
34
- s.add_dependency('cucumber')
35
- s.add_dependency('calabash-android', '0.4.2')
36
- s.require_paths = ["lib"]
37
- s.files = `git ls-files`.split("\n")
38
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
39
-
40
- end
41
-
1
+ # -*- encoding: utf-8 -*-
2
+ require "lib/version"
3
+
4
+ Gem::Specification.new do |s|
5
+
6
+ s.name = %q{awetestlib}
7
+ s.version = Awetestlib::VERSION
8
+ s.date = Awetestlib::VERSION_DATE
9
+ s.platform = Gem::Platform::CURRENT
10
+
11
+ #s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Anthony Woo", "Patrick Neve"]
13
+ s.email = %q{patrick@3qilabs.com}
14
+ s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
+ s.homepage = %q{http://3qilabs.com}
16
+ s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
+
18
+ s.add_dependency('watir-webdriver')
19
+ s.add_dependency('watir', '1.8.1')
20
+ s.add_dependency('commonwatir', '1.8.1')
21
+ s.add_dependency('firewatir', '1.8.1')
22
+ s.add_dependency('activesupport', '~> 3.0.0')
23
+ s.add_dependency('i18n')
24
+ s.add_dependency('andand')
25
+ s.add_dependency('watirloo')
26
+ s.add_dependency('win32-process', '0.6.6')
27
+ s.add_dependency('win32screenshot')
28
+ s.add_dependency('spreadsheet', '0.6.8')
29
+ s.add_dependency('google-spreadsheet-ruby', '0.1.6')
30
+ s.add_dependency('roo', '1.10.1')
31
+ s.add_dependency('selenium-webdriver')
32
+ s.add_dependency('pry')
33
+ s.add_dependency('rdoc', '~> 3.11')
34
+ s.add_dependency('cucumber')
35
+ s.add_dependency('calabash-android', '0.4.3')
36
+ s.add_dependency('sys-uname')
37
+ s.require_paths = ["lib"]
38
+ s.files = `git ls-files`.split("\n")
39
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
40
+
41
+ end
42
+
@@ -1,47 +1,41 @@
1
- # -*- encoding: utf-8 -*-
2
- require "lib/version"
3
-
4
- Gem::Specification.new do |s|
5
-
6
- s.name = %q{awetestlib}
7
- s.version = Awetestlib::VERSION
8
- s.date = Awetestlib::VERSION_DATE
9
- s.platform = Gem::Platform::RUBY
10
-
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Anthony Woo", "Patrick Neve"]
13
- s.email = %q{patrick@3qilabs.com}
14
- s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
- s.homepage = %q{http://3qilabs.com}
16
- s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
-
18
- s.add_dependency('watir-webdriver')
19
- #s.add_dependency('watir', '1.8.1')
20
- #s.add_dependency('commonwatir', '1.8.1')
21
- #s.add_dependency('firewatir', '1.8.1')
22
- s.add_dependency('activesupport', '~> 3.0.0')
23
- s.add_dependency('andand')
24
- #s.add_dependency('watirloo')
25
- #s.add_dependency('win32-process')
26
- #s.add_dependency('win32screenshot')
27
- s.add_dependency('spreadsheet', '0.6.8')
28
- s.add_dependency('google-spreadsheet-ruby', '0.1.6')
29
- s.add_dependency('roo', '1.10.1')
30
- s.add_dependency('multipart-post', '1.1.4')
31
- s.add_dependency('selenium-webdriver')
32
- s.add_dependency('nokogiri')
33
- s.add_dependency('i18n')
34
- s.add_dependency('rb-appscript')
35
- #s.add_dependency('json', '1.6.1') #for safari support
36
- s.add_dependency('pry')
37
- s.add_dependency('cucumber')
38
- s.add_dependency('calabash-cucumber')
39
- s.require_paths = ["lib"] #,"ext"]
40
- s.files = `git ls-files`.split("\n")
41
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
42
-
43
- #This line tells rubygems to look for an extension to install
44
- #s.extensions = ["ext\\mkrf_conf.rb"]
45
-
46
- end
47
-
1
+ # -*- encoding: utf-8 -*-
2
+ require "lib/version"
3
+
4
+ Gem::Specification.new do |s|
5
+
6
+ s.name = %q{awetestlib}
7
+ s.version = Awetestlib::VERSION
8
+ s.date = Awetestlib::VERSION_DATE
9
+ s.platform = Gem::Platform::RUBY
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Anthony Woo", "Patrick Neve"]
13
+ s.email = %q{patrick@3qilabs.com}
14
+ s.summary = %q{Awetest DSL for automated testing of browser-based applications.}
15
+ s.homepage = %q{http://3qilabs.com}
16
+ s.description = %q{Awetest DSL for automated testing of browser-based applications.}
17
+
18
+ s.add_dependency('watir-webdriver')
19
+ s.add_dependency('activesupport', '~> 3.0.0')
20
+ s.add_dependency('andand')
21
+ s.add_dependency('spreadsheet', '0.6.8')
22
+ s.add_dependency('google-spreadsheet-ruby', '0.1.6')
23
+ s.add_dependency('roo', '1.10.1')
24
+ s.add_dependency('multipart-post', '1.1.4')
25
+ s.add_dependency('selenium-webdriver')
26
+ s.add_dependency('nokogiri')
27
+ s.add_dependency('i18n')
28
+ s.add_dependency('rb-appscript')
29
+ s.add_dependency('pry')
30
+ s.add_dependency('cucumber')
31
+ s.add_dependency('calabash-cucumber')
32
+ s.add_dependency('sys-uname')
33
+ s.require_paths = ["lib"] #,"ext"]
34
+ s.files = `git ls-files`.split("\n")
35
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
36
+
37
+ #This line tells rubygems to look for an extension to install
38
+ #s.extensions = ["ext\\mkrf_conf.rb"]
39
+
40
+ end
41
+
@@ -16,6 +16,7 @@ def awetestlib_android_setup
16
16
  msg("Question") do
17
17
  puts "I'm about to create an android project named #{@proj_dir} in this directory"
18
18
  puts "Please hit return to confirm that's what you want."
19
+ puts "Enter anything else and hit return to abort."
19
20
  puts "NOTE: You may need to run this command as an administrator."
20
21
  end
21
22
  exit 2 unless STDIN.gets.chomp == ''
@@ -24,4 +25,4 @@ def awetestlib_android_setup
24
25
  puts "Configuring files and settings"
25
26
  end
26
27
 
27
- end
28
+ end
@@ -16,6 +16,7 @@ def awetestlib_cucumber_setup
16
16
  msg("Question") do
17
17
  puts "I'm about to create a cucumber project named #{@proj_dir} in this directory"
18
18
  puts "Please hit return to confirm that's what you want."
19
+ puts "Enter anything else and hit return to abort."
19
20
  puts "NOTE: You may need to run this command as an administrator."
20
21
  end
21
22
  exit 2 unless STDIN.gets.chomp == ''
@@ -26,4 +27,4 @@ def awetestlib_cucumber_setup
26
27
  puts "cucumber yahoo_mail.feature"
27
28
  end
28
29
 
29
- end
30
+ end
@@ -9,6 +9,7 @@ def awetestlib_driver_setup
9
9
  puts "I'm about to put the chromedriver and IEDriverServer in this directory"
10
10
  puts "If it already exists, we will overwrite it"
11
11
  puts "Please hit return to confirm that's what you want."
12
+ puts "Enter anything else and hit return to abort."
12
13
  puts "NOTE: You may need to run this command as an administrator."
13
14
  end
14
15
  exit 2 unless STDIN.gets.chomp == ''
@@ -10,7 +10,7 @@ def print_usage
10
10
  Usage Options:
11
11
 
12
12
  awetestlib regression_setup
13
- setup awetest regression and register autoitx3.dll
13
+ setup awetest regression and register autoitx3.dll in Windows
14
14
 
15
15
  awetestlib rubymine_setup <project_name>
16
16
  setup a rubymine project
@@ -39,4 +39,4 @@ def check_script_type(options)
39
39
  options[:script_type] = 'Regression'
40
40
  options[:script_file] = ARGV[0]
41
41
  end
42
- end
42
+ end
@@ -17,6 +17,7 @@ def awetestlib_mobile_app_setup
17
17
  puts "I'm about to create a mobile app project named #{ARGV[1]} in this directory" if ARGV[1]
18
18
  puts "I'm about to create a mobile app project named sample_mobile_app in this directory" if ARGV[1].nil?
19
19
  puts "Please hit return to confirm that's what you want."
20
+ puts "Enter anything else and hit return to abort."
20
21
  puts "NOTE: You may need to run this command as an administrator."
21
22
  end
22
23
  exit 2 unless STDIN.gets.chomp == ''
@@ -43,6 +43,7 @@ def awetestlib_netbeans_setup
43
43
  puts "I'm about to create a netbeans project named #{ARGV[1]} in this directory" if ARGV[1]
44
44
  puts "I'm about to create a netbeans project named sample_netbeans in this directory" if ARGV[1].nil?
45
45
  puts "Please hit return to confirm that's what you want."
46
+ puts "Enter anything else and hit return to abort."
46
47
  puts "NOTE: You may need to run this command as an administrator."
47
48
  end
48
49
  exit 2 unless STDIN.gets.chomp == ''
@@ -56,4 +57,4 @@ def awetestlib_netbeans_setup
56
57
  puts "Configuring files and settings"
57
58
  end
58
59
 
59
- end
60
+ end
@@ -1,16 +1,30 @@
1
1
  def awetestlib_regression_setup
2
- msg("Question") do
3
- puts "I'm about to setup awetest regression support and register the AutoIt.dll"
4
- puts "Please hit return to confirm that's what you want."
5
- puts "NOTE: You may need to run this command as an administrator."
6
- end
7
- exit 2 unless STDIN.gets.chomp == ''
8
-
9
- autoit_file = File.join(File.dirname(__FILE__),"AutoItX3.dll")
10
- system("regsvr32 #{autoit_file}")
2
+ using_windows = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM =~ /mswin|mingw/))
3
+ using_osx = RUBY_PLATFORM =~ /darwin/
4
+
5
+ if using_windows
6
+ msg("Question") do
7
+ puts "I'm about to setup awetest regression support and register the AutoItX3.dll"
8
+ puts "Please hit return to confirm that's what you want."
9
+ puts "Enter anything else and hit return to abort."
10
+ puts "NOTE: You may need to run this command as an administrator."
11
+ end
12
+ exit 2 unless STDIN.gets.chomp == ''
13
+
14
+ autoit_file = File.join(File.dirname(__FILE__),"AutoItX3.dll")
15
+ system("regsvr32 #{autoit_file}")
11
16
 
12
- msg("Info") do
13
- puts "Configuring files and settings"
17
+ msg("Info") do
18
+ puts "Configuring files and settings for Windows"
19
+ end
20
+ elsif using_osx
21
+ msg("Info") do
22
+ puts "Currently nothing needed to configure settings for OSX"
23
+ end
24
+ else
25
+ msg("Error") do
26
+ puts "Unsupported operating system: #{RUBY_PLATFORM}"
27
+ end
14
28
  end
15
29
 
16
- end
30
+ end
@@ -20,21 +20,26 @@ def awetestlib_rubymine_setup
20
20
  @source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_rubymine')
21
21
 
22
22
  if File.exists?(@rubymine_dir)
23
- puts "Rubymine project directory already exists."
23
+ puts "Rubymine project directory (#{@rubymine_dir}) already exists."
24
24
  exit 1
25
25
  end
26
26
 
27
27
  msg("Question") do
28
- puts "I'm about to create a rubymine project named #{ARGV[1]} in this directory" if ARGV[1]
29
- puts "I'm about to create a rubymine project named sample_rubymine in this directory" if ARGV[1].nil?
28
+ if ARGV[1]
29
+ puts "I'm about to create a rubymine project named #{ARGV[1]} in this directory"
30
+ else
31
+ puts "I'm about to create a rubymine project named sample_rubymine in this directory"
32
+ end
30
33
  puts "Please hit return to confirm that's what you want."
34
+ puts "Enter anything else and hit return to abort."
31
35
  puts "NOTE: You may need to run this command as an administrator."
32
36
  end
33
37
  exit 2 unless STDIN.gets.chomp == ''
38
+
34
39
  FileUtils.cp_r(@source_dir, @rubymine_dir)
35
40
  edit_config_file
36
41
  msg("Info") do
37
42
  puts "Configuring files and settings"
38
43
  end
39
44
 
40
- end
45
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -182,12 +182,12 @@ module Awetestlib
182
182
 
183
183
  # @param [String] message The text to place in the log and report
184
184
  # @return [void]
185
- def failed_to_log(message, lnbr = nil, dbg = false)
186
- message << " \n#{get_debug_list}" if dbg or @debug_calls or @debug_calls_fail_only
185
+ def failed_to_log(message, lnbr = nil, dbg = false, exception = nil)
186
+ message << " \n#{get_debug_list}" if dbg.to_s == 'true' or @debug_calls or @debug_calls_fail_only
187
187
  @my_failed_count += 1 if @my_failed_count
188
188
  parse_error_references(message, true)
189
189
  @report_class.add_to_report("#{message}" + " [#{get_caller(lnbr)}]", "FAILED") unless Awetestlib::Runner.nil?
190
- log_message(WARN, "#{message}", FAIL, lnbr)
190
+ log_message(WARN, "#{message}", FAIL, lnbr, nil, exception)
191
191
  end
192
192
 
193
193
  alias validate_failed_tolog failed_to_log
@@ -198,13 +198,13 @@ module Awetestlib
198
198
 
199
199
  # @param [String] message The text to place in the log and report
200
200
  # @return [void]
201
- def fatal_to_log(message, lnbr = nil, dbg = false)
202
- message << " \n#{get_debug_list}" if dbg or (@debug_calls and not @debug_calls_fail_only)
201
+ def fatal_to_log(message, lnbr = nil, dbg = false, exception = nil)
202
+ message << " \n#{get_debug_list}" if dbg.to_s == 'true' or (@debug_calls and not @debug_calls_fail_only)
203
203
  @my_failed_count += 1 if @my_failed_count
204
204
  parse_error_references(message, true)
205
205
  @report_class.add_to_report("#{message}" + " [#{get_caller(lnbr)}]", "FAILED") unless Awetestlib::Runner.nil?
206
206
  debug_to_report("#{__method__}:\n#{dump_caller(lnbr)}")
207
- log_message(FATAL, "#{message} (#{lnbr})", FAIL, lnbr)
207
+ log_message(FATAL, "#{message} (#{lnbr})", FAIL, lnbr, nil, exception)
208
208
  end
209
209
 
210
210
  alias fatal_tolog fatal_to_log
@@ -720,7 +720,9 @@ module Awetestlib
720
720
  # @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
721
721
  # @param [String] title The title of the window to be closed. Matched from beginning of string.
722
722
  # @param [String] button The display name of the button to be clicked.
723
- # @param [String] text The text of the window to be closed. Matched from beginning of string.
723
+ # @param [String] text The text of the window to be closed. Matched from beginning of string in Windows
724
+ # with Internet Explorer (regular expressions will fail). Use enough of beginning of the text string, in quotes,
725
+ # to assure the correct modal is found. This will give best portability.
724
726
  # @param [String] side A string identifying which mouse button to click.
725
727
  # @param [Fixnum] wait Number of seconds to wait for the popup to be seen.
726
728
  def close_modal(browser, title="", button="OK", text='', side = 'primary', wait = WAIT)
@@ -743,17 +745,18 @@ module Awetestlib
743
745
  end
744
746
 
745
747
  # TODO: Logging
746
- # Close a Safari modal popup by closing the frontmost Safari dialog. MacOS only
748
+ # Close a Safari modal popup by closing the frontmost Safari dialog. Mac OSX only.
747
749
  def close_modal_s
748
750
  # simply closes the frontmost Safari dialog
749
- Appscript.app("Safari").activate; Appscript.app("System Events").processes["Safari"].key_code(52)
751
+ Appscript.app("Safari").activate
752
+ Appscript.app("System Events").processes["Safari"].key_code(52)
750
753
  end
751
754
 
752
- # Close an IE modal popup by its title.
755
+ # Close an IE modal popup by its title using AutoItX3. Windows only.
753
756
  # @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
754
757
  # @param [String] title The title of the window to be closed. Matched from beginning of string.
755
758
  # @param [String] button The display name of the button to be clicked.
756
- # @param [String] text The text of the window to be closed. Matched from beginning of string.
759
+ # @param [String] text The text of the window to be closed. Matched from beginning of string. Do not use regular expression
757
760
  # @param [String] side A string identifying which mouse button to click.
758
761
  # @param [Fixnum] wait Number of seconds to wait for the popup to be seen.
759
762
  # @param [String] desc Contains a message or description intended to appear in the log and/or report output
@@ -762,7 +765,7 @@ module Awetestlib
762
765
  #TODO needs simplifying, incorporating text verification, and debug code cleaned up
763
766
  title = translate_popup_title(title)
764
767
  msg = "Modal window (popup) '#{title}'"
765
- if @ai.WinWait(title, text, wait)
768
+ if @ai.WinWait(title, text, wait) > 0
766
769
  myHandle = @ai.WinGetHandle(title, text)
767
770
  if myHandle.length > 0
768
771
  debug_to_log("hwnd: #{myHandle.inspect}")
@@ -770,7 +773,7 @@ module Awetestlib
770
773
  window_handle = "[HANDLE:#{myHandle}]"
771
774
  sleep_for(0.5)
772
775
  @ai.WinActivate(window_handle)
773
- if @ai.WinActive(window_handle)
776
+ if @ai.WinActive(window_handle) > 0
774
777
  debug_to_log("#{msg} activated.")
775
778
  controlHandle = @ai.ControlGetHandle(title, '', "[CLASS:Button; TEXT:#{button}]")
776
779
  if not controlHandle.length > 0
@@ -779,16 +782,16 @@ module Awetestlib
779
782
  end
780
783
  debug_to_log("Handle for button '#{button}': [#{controlHandle}]")
781
784
  debug_to_log("#{msg} focus gained.")
782
- if @ai.ControlClick(title, '', "[CLASS:Button; TEXT:#{button}]")
785
+ if @ai.ControlClick(title, '', "[CLASS:Button; TEXT:#{button}]") > 0
783
786
  passed_to_log("#{msg} #{side} click on '[CLASS:Button; TEXT:#{button}]' successful.")
784
787
  sleep_for(0.5)
785
- if @ai.WinExists(window_handle)
788
+ if @ai.WinExists(window_handle) > 0
786
789
  debug_to_log("#{msg} close popup failed on click '#{button}'. Trying WinClose. (#{__LINE__})")
787
790
  @ai.WinClose(title, text)
788
- if @ai.WinExists(window_handle)
791
+ if @ai.WinExists(window_handle) > 0
789
792
  debug_to_log("#{msg} close popup failed with WinClose(#{window_handle}). (#{__LINE__})")
790
793
  @ai.WinKill(window_handle)
791
- if @ai.WinExists(window_handle)
794
+ if @ai.WinExists(window_handle) > 0
792
795
  debug_to_log("#{msg} close popup failed with WinKill(#{window_handle}). (#{__LINE__})")
793
796
  else
794
797
  debug_to_log("#{msg} closed successfully with WinKill(#{window_handle}).")
@@ -820,7 +823,7 @@ module Awetestlib
820
823
 
821
824
  # private :close_modal_ie
822
825
 
823
- # Close an IE modal popup by its title. Calls close_modal_ie.
826
+ # Close an Internet Explorer modal popup by its title. Calls close_modal_ie. Windows only.
824
827
  # @deprecated Use close_modal.
825
828
  # @param [String] title The title of the window to be closed. Matched from beginning of string.
826
829
  # @param [String] button The display name of the button to be clicked.