unittests/setup.rb in firewatir-1.2.1 vs unittests/setup.rb in firewatir-1.6.2
- old
+ new
@@ -1,35 +1,30 @@
-END {$ff.close if $ff} # close ff at completion of the tests
+$SETUP_LOADED = true
-# libraries used by feature tests
-require 'firewatir'
-require 'test/unit'
-require 'test/unit/ui/console/testrunner'
-require 'firewatir/testUnitAddons'
-require 'unittests/iostring'
+$myDir = File.expand_path(File.dirname(__FILE__))
topdir = File.join(File.dirname(__FILE__), '..')
-Dir.chdir topdir do
- $all_tests = Dir["unittests/*_test.rb"]
+$firewatir_dev_lib = File.join(topdir, 'lib')
+$watir_dev_lib = File.join(topdir, '..', 'watir', 'lib')
+libs = []
+libs << File.join(topdir, '..', 'watir-common', 'lib')
+libs << File.join(topdir, '..', 'watir-common') # for the unit tests
+libs.each { |lib| $LOAD_PATH.unshift File.expand_path(lib) }
+
+require 'watir'
+Watir::Browser.default = 'firefox'
+require 'unittests/setup/lib'
+module Watir::UnitTest
+ alias :uses_page :goto_page
end
-$non_core_tests = [ ].collect {|x| "unittests/#{x}_test.rb"}
-$core_tests = $all_tests - $non_core_tests
+require 'unittests/setup/testUnitAddons'
+require 'unittests/iostring'
-def start_ff_with_logger
- $ff = FireWatir::Firefox.new()
-# $ff.logger = Watir::WatirLogger.new( 'debug.txt', 4, 10000 )
- #$ff.set_fast_speed
+commondir = File.join(topdir, '..', 'watir-common')
+$all_tests = []
+Dir.chdir topdir do
+ $all_tests += Dir["unittests/*_test.rb"]
end
-
-def set_local_dir
- $myDir = File.expand_path(File.dirname(__FILE__))
- $myDir.sub!( %r{/cygdrive/(\w)/}, '\1:/' ) # convert from cygwin to dos
- # if you run the unit tests form a local file system use this line
- $htmlRoot = "file://#{$myDir}/html/"
- # if you run the unit tests from a web server use this line
- # $htmlRoot = "http://localhost:8080/watir/html/"
+Dir.chdir commondir do
+ $all_tests += Dir["unittests/*_test.rb"]
end
-
-start_ff_with_logger
-set_local_dir
-