heroku / heroku-buildpack-google-chrome

Run (headless) Google Chrome on Heroku
296 stars 365 forks source link

Does Chrome window size setting work on Heroku CI? #101

Open daidekman opened 3 years ago

daidekman commented 3 years ago

Thanks for a tremendously helpful buildpack!

This issue relates to the window size setting, which does not seem to be working when running in the Heroku CI environment.

I am using the configuration for setting the window size, like this:

https://stackoverflow.com/questions/59361503/how-to-run-rails-system-tests-in-heroku-ci

and this:

https://stackoverflow.com/questions/18390071/change-default-capybara-browser-window-size

In Heroku CI, the configuration to set the window size does not seem to be honored. Is there another way to set it to have the Heroku CI environment manage the window size?

This is the code in the capybara.rb configuration:

`chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil)

chrome_opts = chrome_bin ? { "chromeOptions" => { "binary" => chrome_bin, "args" => %w[headless disable-gpu window-size=1400x1400] } } : {}

Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new( app, browser: :chrome, desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(chrome_opts) ) end`

Is that the correct way to set window size?