webdriverio icon indicating copy to clipboard operation
webdriverio copied to clipboard

Allow passing 'proxy' parameter to 'sauce' service

Open mike-d-davydov opened this issue 5 years ago • 5 comments

Is your feature request related to a problem? Please describe.

If SauceLabs service is behind the firewall and accessible via proxy, I would expect to be able to pass proxy parameter to sauce service, similar to proxy parameter in saucelabs service it is based on: https://www.npmjs.com/package/saucelabs#proxy. Unfortunately, proxy parameter does not seem to be supported.

Describe the solution you'd like

I would like to be able to pass proxy parameter to sauce service like this:

// ...
   services: [
     ['sauce', {proxy: ' http://my-proxy.my-org:8084'}]
   ]
}

Describe alternatives you've considered

Solution we were using before was to set HTTP_PROXY environment variable. Because of the migration of saucelabs service to got from request, this doesn't work anymore.

Other solution, that we are currently migrating to is to use global agent as suggested in WDIO docs: https://webdriver.io/docs/proxy.html

This works, however it lacks granularity - i can't use different proxy servers for SauceLabs and other wdio needs (such as googlapis for selenium-standalone, etc.). Also it requires adding extra dependency. Since saucelabs package already supports proxy out of the box, would be great to be able to make this a sauce service parameter.

Additional context

https://gitter.im/webdriverio/webdriverio?at=5f4e8fb795458c6c3f5d15a3

mike-d-davydov avatar Sep 01 '20 18:09 mike-d-davydov

I suggest to introduce a new option proxy in the webdriver package that is from type string. If set we create a custom agent similar to how it is done in the node-saucelabs package. In the @wdio/sauce-service we propagate this new option into the client so that the settings are the same. To wrap things up an addition to our proxy docs explaining this alternative helps people to decide which proxy setup they want to choose.

Given our current documented way works this is not urgent but an excellent chance for someone to get familiar with the code base. Have a look at our contributing guidelines and reach out if you have any questions. Happy to support anyone taking this on!

christian-bromann avatar Sep 02 '20 09:09 christian-bromann

@christian-bromann Shall I pick this up?

mathew-jithin avatar Sep 02 '20 11:09 mathew-jithin

Feel free.

christian-bromann avatar Sep 02 '20 11:09 christian-bromann

Shouldn't this solve the purpose here:

services: [ ['sauce', { sauceConnect: true, sauceConnectOpts: { proxy: 'my-proxy.my-org:8084, port: 443, tunnelIdentifier: 'POC_TEST' } }] ],

gulatirajat avatar Dec 21 '20 15:12 gulatirajat

@gulatirajat this would ensure that tests still gonna be run through Sauce but the REST API calls to update the job etc. won't be successful. The node-saucelabs package has a proxy option so as I suggested above this information needs to get propagated through it via Sauce service.

christian-bromann avatar Apr 13 '21 09:04 christian-bromann

Any update on this? Facing the same issue, not able to connect to saucelabs via sauce service behind cooperate proxy

shashank1610 avatar Dec 27 '22 05:12 shashank1610

Any update on this?

No updates as you can tell by the labels of this issue, please get involved to help implement this. Thank you!

christian-bromann avatar Dec 27 '22 12:12 christian-bromann