2

I want to build a Testsuite for an Angular App. The testsuite should use the framework "Protractor". When I start the testsuite local with protractor local.config.js, then the test are running successful. When I start the testsuite with BrowserStack without proxy, also everything are okay.

Now my question:

What settings do I have to do if I want to perform the test by local browser stack behind a proxy?

Main BrowserStack configuration:

var
  proxy = 'http://proxy.example.com:8888';

exports.config = {
  capabilities: {
    project: 'BrowserStack (beyond Proxy)',
    proxy: {
      proxyType: 'manual',
      httpProxy: proxy,
      sslProxy: proxy,
      },
    loggingPrefs: {
      driver: "FINE",
      server: "OFF",
      browser: "FINE"
    },

    'browserstack.user': 'USER_KEY',
    'browserstack.key': 'ACCESS_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: [
    'test/e2e/**/*.spec.js'
  ]
};

I call the script "BrowserStackLocal" with this parameters:

./BrowserStackLocal -v -proxyHost PROXY_DOMAIN -proxyPort PROXY_PORT $ACCESS_KEY localhost,$PORT,0

Stepts:

  1. start the application on my local computer node app.js
  2. start the script "BrowserStackLocal"
  3. start the protractor with the browserstack configuration from above.
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
Mulder3
  • 55
  • 1
  • 6
  • I have found that I can access from the browser stack "Live" on my application that runs locally. Now it seems to be a problem with the Protractor not work via proxy. How do I configure Protractor so that it can deal behind a proxy? – Mulder3 Jul 02 '15 at 10:26

2 Answers2

1

When you are behind a proxy server, you need to do two things:

  1. If you are testing your local server, you need to setup the Local Testing connection by passing the proxy details, which I assume you are doing.

  2. You have to make sure the Selenium requests made via Protractor also reach BrowserStack. The easiest option would be to use global-tunnel npm package. If your proxy is behind an Authentication, you can try using the tunnel npm module.

Umang Sardesai
  • 762
  • 6
  • 14
  • Same problem here. Do you have an example of a protractor config that uses global-tunnel?? – Juri Jul 31 '15 at 13:26
1

You no longer need to use global-tunnel. There is now a new configuration option webDriverProxy:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  webDriverProxy: 'http://127.0.0.1:8888',
  capabilities: {
    browserName: 'chrome'
  },
  specs: ['*.spec.js'],
};
gregjhogan
  • 2,095
  • 19
  • 21