mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Fix background stubbing
This commit is contained in:
@@ -124,6 +124,8 @@ end
|
||||
register_chrome "en", name: :chrome_billy do |options|
|
||||
options.add_argument("proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}")
|
||||
options.add_argument("proxy-bypass-list=127.0.0.1;localhost;#{Capybara.server_host}")
|
||||
# Reduce background Google service traffic that can crash puffing-billy's parser.
|
||||
options.add_argument("--disable-background-networking")
|
||||
|
||||
options.accept_insecure_certs = true
|
||||
end
|
||||
|
||||
@@ -84,6 +84,8 @@ class WithDirectUploads
|
||||
end
|
||||
|
||||
def stub_frontend(redirect: false)
|
||||
stub_chrome_background_requests
|
||||
|
||||
proxy.stub("https://" + OpenProject::Configuration.remote_storage_upload_host + ":443/", method: "options").and_return(
|
||||
headers: {
|
||||
"Access-Control-Allow-Methods" => "POST",
|
||||
@@ -119,6 +121,21 @@ class WithDirectUploads
|
||||
end)
|
||||
end
|
||||
|
||||
def stub_chrome_background_requests
|
||||
[
|
||||
%r{\Ahttp://clients2\.google\.com:80/},
|
||||
%r{\Ahttps://accounts\.google\.com:443/},
|
||||
%r{\Ahttps://www\.google\.com:443/},
|
||||
%r{\Ahttps://content-autofill\.googleapis\.com:443/},
|
||||
%r{\Ahttps://optimizationguide-pa\.googleapis\.com:443/},
|
||||
%r{\Ahttps://android\.clients\.google\.com:443/}
|
||||
].each do |url_pattern|
|
||||
%w[get post].each do |method|
|
||||
proxy.stub(url_pattern, method:).and_return(code: 204, headers: {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def append_key_query_param(redirect_url, key)
|
||||
delimiter = redirect_url.include?("?") ? "&" : "?"
|
||||
"#{redirect_url}#{delimiter}key=#{CGI.escape(key)}"
|
||||
|
||||
Reference in New Issue
Block a user