diff --git a/rb/lib/selenium/webdriver/safari.rb b/rb/lib/selenium/webdriver/safari.rb index 53977018c97ac..d1a125650b5d7 100644 --- a/rb/lib/selenium/webdriver/safari.rb +++ b/rb/lib/selenium/webdriver/safari.rb @@ -30,7 +30,7 @@ def technology_preview end def technology_preview! - self.driver_path = technology_preview + Service.driver_path = technology_preview end def path=(path) diff --git a/rb/spec/integration/selenium/webdriver/action_builder_spec.rb b/rb/spec/integration/selenium/webdriver/action_builder_spec.rb index 4259a9d5e8a08..34846a9200ade 100644 --- a/rb/spec/integration/selenium/webdriver/action_builder_spec.rb +++ b/rb/spec/integration/selenium/webdriver/action_builder_spec.rb @@ -31,7 +31,7 @@ module WebDriver end describe 'Key actions' do - it 'sends keys to the active element', except: {browser: :safari} do + it 'sends keys to the active element', except: {browser: %i[safari safari_preview]} do driver.navigate.to url_for('bodyTypingTest.html') keylogger = driver.find_element(id: 'body_result') @@ -44,7 +44,7 @@ module WebDriver expect(driver.find_element(id: 'result').text.strip).to be_empty end - it 'can send keys with shift pressed', except: {browser: :safari} do + it 'can send keys with shift pressed', except: {browser: %i[safari safari_preview]} do driver.navigate.to url_for('javascriptPage.html') event_input = driver.find_element(id: 'theworks') @@ -149,7 +149,7 @@ module WebDriver expect(text).to eq('Dropped!') end - it 'double clicks an element', except: {browser: :chrome} do + it 'double clicks an element', except: {browser: %i[chrome safari safari_preview]} do driver.navigate.to url_for('javascriptPage.html') element = driver.find_element(id: 'doubleClickField') diff --git a/rb/spec/integration/selenium/webdriver/driver_spec.rb b/rb/spec/integration/selenium/webdriver/driver_spec.rb index 29e6ffc114149..5c43df8f51879 100644 --- a/rb/spec/integration/selenium/webdriver/driver_spec.rb +++ b/rb/spec/integration/selenium/webdriver/driver_spec.rb @@ -23,7 +23,7 @@ module Selenium module WebDriver describe Driver do it_behaves_like 'driver that can be started concurrently', except: [{browser: :edge}, - {driver: :safari}, + {browser: :safari}, {browser: :safari_preview}] it 'should get the page title' do @@ -293,7 +293,8 @@ def save_screenshot_and_assert(path) end # Edge BUG - https://connect.microsoft.com/IE/feedback/details/1849991/ - it 'times out if the callback is not invoked', except: [{browser: :edge}] do + # Safari raises TimeoutError instead + it 'times out if the callback is not invoked', except: {browser: %i[edge safari safari_preview]} do expect { # Script is expected to be async and explicitly callback, so this should timeout. driver.execute_async_script 'return 1 + 2;' diff --git a/rb/spec/integration/selenium/webdriver/element_spec.rb b/rb/spec/integration/selenium/webdriver/element_spec.rb index f3b719ad7162c..be078241af43b 100644 --- a/rb/spec/integration/selenium/webdriver/element_spec.rb +++ b/rb/spec/integration/selenium/webdriver/element_spec.rb @@ -35,9 +35,16 @@ module WebDriver .to raise_error(Selenium::WebDriver::Error::UnknownError, error) end - it 'should not raise if element is only partially covered', only: {browser: %i[safari]} do + # Safari returns "click intercepted" error instead of "element click intercepted" + it 'should raise if different element receives click', except: {browser: %i[chrome safari safari_preview]} do driver.navigate.to url_for('click_tests/overlapping_elements.html') - expect { driver.find_element(id: 'other_contents').click }.not_to raise_error + expect { driver.find_element(id: 'contents').click }.to raise_error(Error::ElementClickInterceptedError) + end + + # Safari returns "click intercepted" error instead of "element click intercepted" + it 'should raise if element is partially covered', except: {browser: %i[chrome safari safari_preview]} do + driver.navigate.to url_for('click_tests/overlapping_elements.html') + expect { driver.find_element(id: 'other_contents').click }.to raise_error(Error::ElementClickInterceptedError) end it 'should submit' do @@ -173,7 +180,7 @@ module WebDriver end # IE - https://github.com/SeleniumHQ/selenium/pull/4043 - it 'should drag and drop', except: {browser: %i[edge ie safari safari_preview]} do + it 'should drag and drop', except: {browser: %i[edge ie]} do driver.navigate.to url_for('dragAndDropTest.html') img1 = driver.find_element(id: 'test1') diff --git a/rb/spec/integration/selenium/webdriver/manage_spec.rb b/rb/spec/integration/selenium/webdriver/manage_spec.rb index 3b1fc8cdd9d4e..a3e265e02e33d 100644 --- a/rb/spec/integration/selenium/webdriver/manage_spec.rb +++ b/rb/spec/integration/selenium/webdriver/manage_spec.rb @@ -88,7 +88,7 @@ module WebDriver expect(driver.manage.all_cookies).to be_empty end - it 'should use DateTime for expires', except: {browser: %i[safari safari_preview]} do + it 'should use DateTime for expires' do driver.navigate.to url_for('xhtmlTest.html') expected = DateTime.new(2039) diff --git a/rb/spec/integration/selenium/webdriver/safari/driver_spec.rb b/rb/spec/integration/selenium/webdriver/safari/driver_spec.rb index 9a6dd54ee5c1d..4f94094b49a13 100644 --- a/rb/spec/integration/selenium/webdriver/safari/driver_spec.rb +++ b/rb/spec/integration/selenium/webdriver/safari/driver_spec.rb @@ -22,7 +22,7 @@ module Selenium module WebDriver module Safari - describe Driver, only: {driver: :safari_preview} do + describe Driver, only: {driver: %i[safari safari_preview]} do it 'gets and sets permissions' do driver.permissions = {'getUserMedia' => false} expect(driver.permissions).to eq('getUserMedia' => false) diff --git a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb index 1103bbdf6d845..7899419043f12 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb @@ -74,7 +74,6 @@ def quit_driver @driver_instance.quit ensure - `pkill -f "Safari --automation"` if browser == :safari @driver_instance = nil end diff --git a/rb/spec/integration/selenium/webdriver/target_locator_spec.rb b/rb/spec/integration/selenium/webdriver/target_locator_spec.rb index 7f8425ccc2060..d4f87c03e705f 100644 --- a/rb/spec/integration/selenium/webdriver/target_locator_spec.rb +++ b/rb/spec/integration/selenium/webdriver/target_locator_spec.rb @@ -36,7 +36,7 @@ module WebDriver end # Doesn't switch to frame by id directly - it 'should switch to a frame directly', except: {browser: %i[safari safari_preview]} do + it 'should switch to a frame directly', except: {browser: :safari} do driver.navigate.to url_for('iframes.html') driver.switch_to.frame('iframe1') @@ -295,8 +295,7 @@ module WebDriver expect { driver.switch_to.alert }.to raise_error(Selenium::WebDriver::Error::NoSuchAlertError) end - # Safari - Raises wrong error - context 'unhandled alert error', except: {browser: %i[safari safari_preview]} do + context 'unhandled alert error' do after { reset_driver! } it 'raises an UnexpectedAlertOpenError if an alert has not been dealt with' do diff --git a/rb/spec/integration/selenium/webdriver/timeout_spec.rb b/rb/spec/integration/selenium/webdriver/timeout_spec.rb index ac08f80600f9a..a403453f90ecb 100644 --- a/rb/spec/integration/selenium/webdriver/timeout_spec.rb +++ b/rb/spec/integration/selenium/webdriver/timeout_spec.rb @@ -30,7 +30,7 @@ module WebDriver after { driver.manage.timeouts.implicit_wait = 0 } - it 'should implicitly wait for a single element', except: {browser: :edge} do + it 'should implicitly wait for a single element', except: {browser: %i[edge safari_preview]} do driver.manage.timeouts.implicit_wait = 6 driver.find_element(id: 'adder').click diff --git a/rb/spec/integration/selenium/webdriver/window_spec.rb b/rb/spec/integration/selenium/webdriver/window_spec.rb index ec9250d52c56d..187eca7602aae 100644 --- a/rb/spec/integration/selenium/webdriver/window_spec.rb +++ b/rb/spec/integration/selenium/webdriver/window_spec.rb @@ -60,7 +60,7 @@ module WebDriver expect(pos.y).to be >= 0 end - it 'sets the position of the current window', except: {browser: :safari_preview} do + it 'sets the position of the current window' do pos = window.position target_x = pos.x + 10 @@ -75,7 +75,7 @@ module WebDriver expect(new_pos.y).to eq(target_y) end - it 'gets the rect of the current window', only: {browser: %i[firefox ie chrome]} do + it 'gets the rect of the current window', only: {browser: %i[firefox ie chrome safari safari_preview]} do rect = window.rect expect(rect).to be_a(Rectangle) @@ -86,7 +86,7 @@ module WebDriver expect(rect.height).to be >= 0 end - it 'sets the rect of the current window', only: {browser: %i[firefox ie chrome]} do + it 'sets the rect of the current window', only: {browser: %i[firefox ie chrome safari safari_preview]} do rect = window.rect target_x = rect.x + 10 @@ -118,7 +118,7 @@ module WebDriver # Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/ # https://github.com/mozilla/geckodriver/issues/1281 - it 'can make window full screen', only: {window_manager: true, browser: %i[chrome ie firefox]}, + it 'can make window full screen', only: {window_manager: true, browser: %i[chrome ie firefox safari_preview]}, exclude: [{driver: :remote, browser: :firefox, platform: :linux}, {browser: :chrome}] do window.size = old_size = Dimension.new(200, 200) @@ -132,7 +132,7 @@ module WebDriver # Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/ # https://github.com/mozilla/geckodriver/issues/1281 - it 'can minimize the window', only: {window_manager: true, browser: %i[ie firefox]}, + it 'can minimize the window', only: {window_manager: true, browser: %i[ie firefox safari safari_preview]}, exclude: {driver: :remote, browser: :firefox, platform: :linux} do window.minimize expect(driver.execute_script('return document.hidden;')).to be true