lib/watirspec.rb in watir-7.1.0 vs lib/watirspec.rb in watir-7.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'tmpdir'
require 'watirspec/guards'
require 'watirspec/implementation'
require 'watirspec/runner'
require 'watirspec/server'
@@ -20,11 +22,11 @@
def url_for(str)
File.join(host, str)
end
def host
- @host ||= "http://#{Server.bind}:#{Server.port}"
+ @host ||= ENV['WATIR_PUBLIC_SERVER'] ? 'http://watir.com/examples' : "http://#{Server.bind}:#{Server.port}"
end
def unguarded?
@unguarded ||= false
end
@@ -59,10 +61,11 @@
klass = WatirSpec.implementation.browser_class
args = Array(WatirSpec.implementation.browser_args).map { |e| e.is_a?(Hash) ? e.dup : e }
instance = klass.new(*args)
print_browser_info_once(instance)
+ instance.window.maximize
instance
end
private
@@ -76,15 +79,15 @@
info << instance.class.name
caps = instance.driver.capabilities
info << caps.browser_name.to_s
- info << caps.version.to_s
+ info << caps.browser_version.to_s
info << @implementation.driver_info
Watir.logger.warn "running watirspec against #{info.join ' '} using:\n#{WatirSpec.implementation.inspect_args}",
id: [:browser_info]
- rescue StandardError
- # ignored
+ rescue StandardError => e
+ Watir.logger.warn("Unable to print browser info: #{e}")
end
end # class << WatirSpec
end # WatirSpec