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

Add "--proxy-bypass-list=<-loopback>" flag to default chrome args #3049

Merged
merged 9 commits into from
Jan 30, 2019
6 changes: 6 additions & 0 deletions packages/server/lib/browsers/chrome.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ utils = require("./utils")

LOAD_EXTENSION = "--load-extension="
CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING = "66 67".split(" ")
CHROME_VERSION_INTRODUCING_PROXY_BYPASS_ON_LOOPBACK = 72

pathToExtension = extension.getPathToExtension()
pathToTheme = extension.getPathToTheme()
Expand Down Expand Up @@ -157,6 +158,11 @@ module.exports = {
if majorVersion in CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING
args.push("--disable-blink-features=RootLayerScrolling")

## https://chromium.googlesource.com/chromium/src/+/da790f920bbc169a6805a4fb83b4c2ab09532d91
## https://github.com/cypress-io/cypress/issues/1872
if majorVersion >= CHROME_VERSION_INTRODUCING_PROXY_BYPASS_ON_LOOPBACK
args.push("--proxy-bypass-list=<-loopback>")

args

open: (browserName, url, options = {}, automation) ->
Expand Down
4 changes: 4 additions & 0 deletions packages/server/lib/browsers/electron.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ module.exports = {
new Promise (resolve) ->
webContents.session.setProxy({
proxyRules: proxyServer
## this should really only be necessary when
## running Chromium versions >= 72
## https://github.com/cypress-io/cypress/issues/1872
proxyBypassRules: "<-loopback>"
}, resolve)

open: (browserName, url, options = {}, automation) ->
Expand Down
2 changes: 2 additions & 0 deletions packages/server/lib/util/ci_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,11 @@ const commitDefaults = function (existingInfo) {
debug(existingInfo)

const providerName = provider()

debug('detected provider name: %s', providerName)

let commitParamsObj = commitParams()

if (!commitParamsObj) {
debug('could not get commit param object, using empty one')
commitParamsObj = {}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/4_window_open_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe.skip "e2e window.open", ->

## skipping this for now due to
## snap-shot-it monkey patching
## .only causing test failures
## causing test failures
# it "passes", ->
# e2e.exec(@, {
# spec: "window_open_spec.coffee"
Expand Down
21 changes: 21 additions & 0 deletions packages/server/test/unit/browsers/chrome_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,24 @@ describe "lib/browsers/chrome", ->
disabledRootLayerScrolling("66", true)
disabledRootLayerScrolling("67", true)
disabledRootLayerScrolling("68", false)

## https://github.com/cypress-io/cypress/issues/1872
it "adds <-loopback> proxy bypass rule in version 72+", ->
arg = "--proxy-bypass-list=<-loopback>"

chromeVersionHasLoopback = (version, bool) ->
args = chrome._getArgs({
browser: {
majorVersion: version
}
})

if bool
expect(args).to.include(arg)
else
expect(args).not.to.include(arg)

chromeVersionHasLoopback("71", false)
chromeVersionHasLoopback("72", true)
chromeVersionHasLoopback("73", true)

1 change: 1 addition & 0 deletions packages/server/test/unit/browsers/electron_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,5 @@ describe "lib/browsers/electron", ->
.then ->
expect(webContents.session.setProxy).to.be.calledWith({
proxyRules: "proxy rules"
proxyBypassRules: "<-loopback>"
})