cli icon indicating copy to clipboard operation
cli copied to clipboard

Pass along proxy environment variables to the browser process

Open wwilsman opened this issue 4 years ago • 4 comments

Always thought this was handled automatically by the browser with system-level proxies. But that may not always be the case, or system-level proxies might not always be available for some people.

If proxy env vars are defined, we should pass them along to Chromium explicitly with a flag.

wwilsman avatar Aug 10 '21 17:08 wwilsman

If you're running into an issue getting asset discovery to work with proxy settings, the flag can be passed along to Chromium explicitly via a Percy config file option:

version: 2
discovery:
  launch-options:
    args: ["--proxy-server=XXX"]

wwilsman avatar Aug 10 '21 18:08 wwilsman

Thank you @wwilsman that work around worked for me. We run Cypress against an IP whitelisted website, where we use a proxy to run the tests against. However, when running Percy the screenshots indicated a broken layout. Running Percy in verbose mode indicated an error net::ERR_ABORTED for those CSS assets.

Updating the config to pass Chrome the proxy settings resolved the issue. Surprisingly, it also seemed to pass for Firefox (even though Firefox doesn't appear to support passing of a proxy via a command).

I think this should probably be added to the documentation too as it has taken a good chunk of time to get to the bottom of this.

Thanks again for sharing!

AdrianLThomas avatar Oct 28 '21 15:10 AdrianLThomas

Hey @AdrianLThomas! We should be fixing in the near future -- this should be handled automatically.

Surprisingly, it also seemed to pass for Firefox (even though Firefox doesn't appear to support passing of a proxy via a command).

Percy doesn't capture screenshots on your machine. The config that was passed was to the SDKs asset discovery browser, which is there to find & capture the right assets to rerender in Percy's browsers. Here's more info on how Percy works: https://docs.percy.io/docs/debugging-sdks#how-percy-works

Robdel12 avatar Oct 28 '21 16:10 Robdel12

Hey @AdrianLThomas! We should be fixing in the near future -- this should be handled automatically.

Surprisingly, it also seemed to pass for Firefox (even though Firefox doesn't appear to support passing of a proxy via a command).

Percy doesn't capture screenshots on your machine. The config that was passed was to the SDKs asset discovery browser, which is there to find & capture the right assets to rerender in Percy's browsers. Here's more info on how Percy works: https://docs.percy.io/docs/debugging-sdks#how-percy-works

Wonderful, makes sense. Thanks for the response!

AdrianLThomas avatar Oct 28 '21 16:10 AdrianLThomas