Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/13.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Dec 18, 2023
2 parents 4909d94 + c8b29e1 commit ad2bc8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

require_relative '../../support/pages/my/page'

RSpec.describe 'My spent time widget with a negative time zone', :chrome_headless_new, :js,
RSpec.describe 'My spent time widget with a negative time zone', :js,
driver: :chrome_headless_new,
with_settings: { start_of_week: 1 } do
let(:beginning_of_week) { monday }
let(:end_of_week) { sunday }
Expand Down
30 changes: 15 additions & 15 deletions spec/support/browsers/chrome.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# rubocop:disable Metrics/PerceivedComplexity
def register_chrome(language, name: :"chrome_#{language}", override_time_zone: nil)
def register_chrome(language, name: :"chrome_#{language}", headless: 'old', override_time_zone: nil)
Capybara.register_driver name do |app|
options = Selenium::WebDriver::Chrome::Options.new

Expand All @@ -12,20 +12,7 @@ def register_chrome(language, name: :"chrome_#{language}", override_time_zone: n
end
else
options.add_argument('--window-size=1920,1080')
# Our tests are not that stable with the new headless mode, but since
# Chrome 120 the old headless mode has browser name
# "chrome-headless-shell". This name is not recognized by the current
# selenium-webdriver and so some extensions like `execute_cdp` are
# missing. This wil be fixed in next selenium-webdriver version. See
# https://github.com/SeleniumHQ/selenium/pull/13271 for more information.
#
# In the meantime, the :chrome_headless_new metadata allows activating the
# new headless for tests that need it.
if RSpec.current_example.metadata[:chrome_headless_new]
options.add_argument('--headless=new')
else
options.add_argument('--headless=old')
end
options.add_argument("--headless=#{headless}")
end

options.add_argument('--no-sandbox')
Expand Down Expand Up @@ -109,6 +96,19 @@ def register_chrome(language, name: :"chrome_#{language}", override_time_zone: n
end
end

# Register Chrome with new headless implementation
#
# Our tests are not that stable with the new headless mode, but since
# Chrome 120 the old headless mode has browser name
# "chrome-headless-shell". This name is not recognized by the current
# selenium-webdriver and so some extensions like `execute_cdp` are
# missing. This wil be fixed in next selenium-webdriver version. See
# https://github.com/SeleniumHQ/selenium/pull/13271 for more information.
#
# In the meantime, registering a :chrome_headless_new driver which uses the
# `headless=new` flag for tests that need it.
register_chrome 'en', name: :chrome_headless_new, headless: 'new'

# Register mocking proxy driver
register_chrome 'en', name: :chrome_billy do |options|
options.add_argument("proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")
Expand Down

0 comments on commit ad2bc8f

Please sign in to comment.