From b571cd7e358355127ac508588c846c7392039c73 Mon Sep 17 00:00:00 2001 From: titusfortner Date: Sat, 3 Jun 2023 16:09:41 -0500 Subject: [PATCH] [rb] setting log value does not apply to Safari this is easier than implementing log separately in each of the other service classes --- rb/lib/selenium/webdriver/safari/service.rb | 10 ++++++++++ .../unit/selenium/webdriver/safari/service_spec.rb | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/rb/lib/selenium/webdriver/safari/service.rb b/rb/lib/selenium/webdriver/safari/service.rb index 7884bd39e6497..f720b21d4ea70 100644 --- a/rb/lib/selenium/webdriver/safari/service.rb +++ b/rb/lib/selenium/webdriver/safari/service.rb @@ -24,6 +24,16 @@ class Service < WebDriver::Service DEFAULT_PORT = 7050 EXECUTABLE = 'safaridriver' SHUTDOWN_SUPPORTED = false + + def initialize(path: nil, port: nil, log: nil, args: nil) + raise Error::WebDriverError, 'Safari Service does not support setting log output' if log + + super + end + + def log=(*) + raise Error::WebDriverError, 'Safari Service does not support setting log output' + end end # Service end # Safari end # WebDriver diff --git a/rb/spec/unit/selenium/webdriver/safari/service_spec.rb b/rb/spec/unit/selenium/webdriver/safari/service_spec.rb index f142c03d21bc9..f0a4ab5a4e6cc 100644 --- a/rb/spec/unit/selenium/webdriver/safari/service_spec.rb +++ b/rb/spec/unit/selenium/webdriver/safari/service_spec.rb @@ -30,6 +30,12 @@ module Safari allow(Platform).to receive(:assert_executable).and_return(true) end + it 'does not allow log' do + expect { + described_class.new(log: 'anywhere') + }.to raise_exception(Error::WebDriverError, 'Safari Service does not support setting log output') + end + it 'uses default port and nil path' do service = described_class.new @@ -57,6 +63,13 @@ module Safari expect(service.extra_args).to be_empty end + it 'does not allow log=' do + service = described_class.new + expect { + service.log = 'anywhere' + }.to raise_exception(Error::WebDriverError, 'Safari Service does not support setting log output') + end + it 'uses provided args' do allow(Platform).to receive(:find_binary).and_return(service_path)