Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add webmock chrome functionality with billy

Oliver Günther4d74b2514190
diff --git a/spec/features/admin/enterprise_spec.rb b/spec/features/admin/enterprise/enterprise_spec.rb
similarity index 100%
rename from spec/features/admin/enterprise_spec.rb
rename to spec/features/admin/enterprise/enterprise_spec.rb
diff --git a/spec/support/browsers/chrome.rb b/spec/support/browsers/chrome.rb
index 0131eb35184..79a180467e6 100644
--- a/spec/support/browsers/chrome.rb
+++ b/spec/support/browsers/chrome.rb
@@ -68,3 +68,28 @@ end
register_chrome_headless 'en'
# Register german locale for custom field decimal test
register_chrome_headless 'de'
+
+# Register mocking proxy driver
+
+Capybara.register_driver :headless_chrome_billy do |app|
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
+ acceptInsecureCerts: true,
+ loggingPrefs: { browser: 'ALL' }
+ )
+ options = Selenium::WebDriver::Chrome::Options.new
+ options.add_argument('--window-size=1920,1080')
+ options.add_argument('--headless')
+ options.add_argument('--disable-gpu')
+ options.add_argument("--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")
+ options.add_argument('--proxy-bypass-list=127.0.0.1;localhost')
+
+ Capybara::Selenium::Driver.new app,
+ browser: :chrome,
+ options: options,
+ desired_capabilities: capabilities,
+ driver_opts: {
+ log_path: Rails.root.join('log/chromedriver.log').to_s,
+ verbose: true,
+ }
+end
+Capybara.javascript_driver = :headless_chrome_billy
\ No newline at end of file