lib/watirloo/locker.rb in watirloo-0.0.7 vs lib/watirloo/locker.rb in watirloo-0.0.8
- old
+ new
@@ -1,6 +1,21 @@
+
module Watirloo
+ require 'singleton'
+
+ class FireLocker
+ include Singleton
+ attr_accessor :browser
+ # reuse browser previously attached to.
+ # ISSUE: if browser is closed we are stuck holding reference to non existing browser
+ def browser
+ @firefox ||= ::FireWatir::Firefox.attach(:url, /.*/)
+ end
+ def clear
+ @firefox = nil
+ end
+ end
# manages references to browsers we care about to run tests agains.
# Saves references to window handles internall to yaml file so we can reuse the browser for tests by reattaching to it between tests.
# you put reference to a browser in storage. Next time you run a test you can restore the browser's reference instead fo staring a new one.
module Locker