Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚙️ [i32] - resolve selenium error #750

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ services:
environment:
- JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
- VIRTUAL_PORT=7900
- VIRTUAL_HOST=chrome.ams.test
- VIRTUAL_HOST=chrome.hyku.test
Copy link
Collaborator Author

@ShanaLMoore ShanaLMoore Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: I don't understand why this change fixes it. And I also don't understand why we can connect to hyku.test when it's not defined in our docker setup. 🤔

No other docker projects are running so this must be coming from gbh's setup somehow. I think it's ok to proceed for now since it unblocks us however Rob/devops should prob look into it.

51 changes: 36 additions & 15 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,46 @@

ENV['WEB_HOST'] ||= `hostname -s`.strip
if ENV['CHROME_HOSTNAME'].present?
# Uses faster rack_test driver when JavaScript support not needed
Capybara.default_max_wait_time = 8
# Capybara.default_driver = :rack_test

capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
}
)
if App.rails_5_1?
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
}
)

Capybara.register_driver :chrome do |app|
d = Capybara::Selenium::Driver.new(app,
browser: :remote,
desired_capabilities: capabilities,
url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub")
# Fix for capybara vs remote files. Selenium handles this for us
d.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
Capybara.register_driver :chrome do |app|
d = Capybara::Selenium::Driver.new(app,
browser: :remote,
desired_capabilities: capabilities,
url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub")
# Fix for capybara vs remote files. Selenium handles this for us
d.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end
d
end
else
chrome_options = Selenium::WebDriver::Chrome::Options.new(
args: %w[--disable-gpu --no-sandbox --whitelisted-ips --window-size=1400,1400]
)

Capybara.register_driver :chrome do |app|
d = Capybara::Selenium::Driver.new(app,
browser: :remote,
options: chrome_options,
url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub")
# Fix for capybara vs remote files. Selenium handles this for us
d.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end
d
end
d
end
Capybara.server_host = '0.0.0.0'
Capybara.server_port = 3001
Expand Down
Loading