percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

Pass along proxy environment variables to the browser process #487

Open wwilsman opened 3 years ago

wwilsman commented 3 years ago

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 commented 3 years ago

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"]
AdrianLThomas commented 2 years ago

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!

Robdel12 commented 2 years ago

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

AdrianLThomas commented 2 years ago

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!