2

I would like to run tests with protractor and browserstack. I have followed this post I am behind a proxy. I have installed browserstack local and I run it with this command:

BrowserStackLocal.exe -v -proxyHost proxy -proxyPort port QgNaPBMSMoZ5s5dx1WFH localhost,9000,0

Everything seems to work beacause I have this message:

BrowserStackLocal v4.3

Setting up proxy connection to cornillon:8000
Proxy is configured

Connecting to BrowserStack using WebSocket protocol...
Platform supports WebSocket connections.

You can now access your local server(s) in our remote browser.

***
Please ensure your browser is configured to bypass proxy for "bs-local.com".
***

Press Ctrl-C to exit

Then I run my gulp task protractor and I have this error:

C:\Users\toto\Desktop\myapp3>gulp protractor
[16:11:44] Using gulpfile ~\Desktop\myapp3\gulpfile.js
[16:11:44] Starting 'protractor'...
[16:11:44] Finished 'protractor' after 6.9 ms
Using the selenium server at http://hub.browserstack.com/wd/hub
[launcher] Running 1 instances of WebDriver

C:\Users\toto\Desktop\myapp3\node_modules\selenium-webdriver\http\index.js:174
  callback(new Error(message));
           ^
Error: ETIMEDOUT connect ETIMEDOUT 208.52.180.201:80
    at ClientRequest.<anonymous>       (C:\Users\toto\Desktop\myapp3\node_modules\selenium-webdriver\http\index.js:174:16)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:259:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\Users\toto\Desktop\myapp3\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (C:\Users\toto\Desktop\myapp3\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:30)
at [object Object].Builder.build (C:\Users\toto\Desktop\myapp3\node_modules\selenium-webdriver\builder.js:445:22)
at [object Object].DriverProvider.getNewDriver (C:\Users\toto\Desktop\myapp3\node_modules\protractor\lib\driverProviders\driverProvider.js:38:7)
at [object Object].Runner.createBrowser (C:\Users\toto\Desktop\myapp3\node_modules\protractor\lib\runner.js:186:37)
at C:\Users\toto\Desktop\myapp3\node_modules\protractor\lib\runner.js:276:21
at _fulfilled (C:\Users\toto\Desktop\myapp3\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\toto\Desktop\myapp3\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\toto\Desktop\myapp3\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\toto\Desktop\myapp3\node_modules\protractor\node_modules\q\q.js:525:49
[launcher] Process exited with error code 1

C:\Users\toto\Desktop\myapp3\gulpfile.js:352
    .on('error', function(e) { throw e; });
                               ^
Error: protractor exited with code 1

This is my protractor.conf.js file:

var proxy = 'http://proxy:port';

exports.config = {
   capabilities: {
       proxy: {
           proxyType: 'manual',
           httpProxy: proxy,
           sslProxy: proxy,
           noProxy: 'bs-local.com'
       },

       'browserstack.user': 'toto',
       'browserstack.key': 'key', // show on BrowserStack

       // Needed for testing localhost
       'browserstack.local' : 'true',

       // Settings for the browser you want to test
       // (check docs for difference between `browser` and `browserName`
       'browserName' : 'chrome',
       'version' : '43.0',
       'os' : 'OS X',
       'os_version' : 'Yosemite',
       'resolution' : '1024x768'
   },
   seleniumAddress: 'http://hub.browserstack.com/wd/hub',
   specs: ['./src/app/**/*.spec.e2e.js']
};

It seems to be a network issue, so probably proxy badly configured.

Can I have your help please ?

Thanks

Community
  • 1
  • 1
user2401221
  • 439
  • 1
  • 7
  • 19

1 Answers1

0

Since you wish to run tests on BrowserStack through your local proxy, setting the proxy parameters via capabilities would not help since it sets the proxy on the remote VM. As per the conf file you shared, I believe you wish to only configure proxy host and proxy port parameters. I would suggest you use global-tunnel Node module to setup proxy in your Protractor tests. This should help you run Protractor tests on BrowserStack through the proxy in your network.

Nishant
  • 66
  • 4