question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Bring Back sauceProxy configuration

See original GitHub issue

Bug report

  • Node Version: 6.9.1
  • Protractor Version: 5.1.2
  • Angular Version: ^4.0.0
  • Browser(s): All
  • Operating System and Version Windows 7
  • Your protractor configuration file
const conf = require('./e2e/config/conf.e2e.json');
const { SpecReporter } = require('jasmine-spec-reporter');
const jasmineReporters = require('jasmine-reporters');

const prerun = { "background": true, "executable": "sauce-storage:auth_sauce.exe" };
const shartTestFiles = false;
const maxInstances = 1;

console.log("proxy is " + process.env.HTTP_PROXY + '--------------------------------------');

exports.config = {
  SELENIUM_PROMISE_MANAGER: 0,
  sauceBuild: process.env.JENKINS_BUILD_NUMBER || 'localTestBuildNumber__00',
  sauceUser: process.env.SAUCE_USERNAME || 'test',
  sauceKey: process.env.SAUCE_ACCESS_KEY || 'test',
  sauceSeleniumUseHttp: true,
  sauceSeleniumAddress: 'localhost:4445/wd/hub',
  webDriverProxy: process.env.HTTP_PROXY,
  multiCapabilities: [

    // {
    //   build,
    //   buildName,
    //   "name": "Windows 7 IE 11",
    //   "username": conf.sauceUser,
    //   "accessKey": conf.sauceKey,
    //   "tunnel-identifier": "shepherd-jenkins",
    //   "platform": "Windows 7",
    //   "browserName": "internet explorer",
    //   "version": "11",
    //   "avoid-proxy": true,
    //   "unexpectedAlertBehaviour": "ignore",
    //   maxInstances,
    //  shartTestFiles,
    //   prerun
    // },
    {
      count: 1,
      "name": "Windows 7 chrome 57",
      "tunnel-identifier": "shepherd-jenkins",
      "platform": "Windows 7",
      "browserName": "chrome",
      chromeOptions: {
        prefs: {
          'credentials_enable_service': false,
          'profile': {
            'password_manager_enabled': false
          }
        },
        args: [
          '--disable-cache',
          '--disable-application-cache',
          '--disable-offline-load-stale-cache',
          '--disk-cache-size=0',
          '--v8-cache-options=off'
        ]
      },
      "version": "57",
      shartTestFiles,
      prerun
    },
  ],
  allScriptsTimeout: 11000,
  seleniumArgs: ['--ignore_ssl'],
  specs: [
    './e2e/**/*.e2e-spec.ts',
  ],

  directConnect: true,
  baseUrl: 'my.url.com',
  framework: 'jasmine2',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function () {
    }
  },

  onPrepare() {
    let capabilities
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });

    jasmine.getEnv().addReporter(new SpecReporter({
      spec: { displayStacktrace: true }
    }));

    return browser.getProcessedConfig().then((c) => {
      capabilities = c.capabilities;
      // used to change the namespace for the data.
      process.env.CURRENT_BROWSER = c.capabilities.browserName.replace(new RegExp(' ', 'g'), '-');
      jasmine.getEnv().addReporter(
        new jasmineReporters.JUnitXmlReporter({
          filePrefix: c.capabilities.browserName,
          consolidateAll: true,
          modifySuiteName: function (generatedSuiteName, suite) {
            // this will produce distinct suite names for each capability,
            // e.g. 'firefox.login tests' and 'chrome.login tests'
            return c.capabilities.browserName + '.' + generatedSuiteName;
          }
        }));

      return browser.driver.get(c.baseUrl).then(function () {
        browser.sleep(2000);
      });
    });
  },

  onComplete() {
    return browser.getProcessedConfig().then(function (c) {
      return browser.getSession().then(function (session) {
        // required to be here so saucelabs picks up reports to put in jenkins
        console.log('SauceOnDemandSessionID=' + session.getId() + ' job-name=' + c.capabilities.name);
      });
    });
  }
};

  • A relevant example test Setup Saucelabs in a jenkins build using node version 6.2.1 (i had 6.9.1 on my local)

  • Output from running the test Basically what it boils down to is I need my proxy to make the SauceLabs call to update my tests however I’m running my tests in Jenkins. When I run my tests, I get this problem

03:10:21 <div id="content">
03:10:21 <p>The following error was encountered while trying to retrieve the URL: <a href="http://myusername@localhost:4445/wd/hub/session">http://myusername@localhost:4445/wd/hub/session</a></p>
03:10:21 
03:10:21 <blockquote id="error">
03:10:21 <p><b>Access Denied.</b></p>
03:10:21 </blockquote>

Now I’m not sure if it was because the Jenkins job was running on NODE 6.2.1 or not but I do know it was usingthe webdriver proxy for my connection to the Sauce Selenium Relay but oddly was not including the saucekey. Whenever i got access denied it always only showed myusername only. I’m able using seleniumAddress and setting username / accesskey in each of my capabilities without setting webdriverproxy to run the tests.

Feature Request

My request would be to allow SauceLabs plugin to be configurable separate from the main testing connection like it used to be. Right now there is no way for me to tell Protractor this beucase webDriverProxy is used for the driverProvider config + SauceLabs config.

  • Reasons for adopting new feature
  • Is this a breaking change? (How will this affect existing functionality) It would be a breaking revert to what it previously was but it wouldn’t be that big. I’d be willing to looking into doing the PR when I have time. I just don’t know why sauceProxy was taken out because they are 2 separate usages of the proxy. At the very least have some way that I could maybe slip in my own SauceLabs plugin as we do the sauceAgent.

As a part of a relavant thing it would be also nice if that sauce driverProvider covered console.log(session / job); as you see in my configuration so it would be a more complete integration with saucelabs. (specifically reporting for the jenkins plugin but it doesn’t hurt anything anywhere else)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kenistewardcommented, Aug 1, 2017

That’s exactly it! When I was looking through to code I saw that if webdriverproxy was set it uses it in the get proxy which messes up my tests because I’m using sauelabs in Jenkins with selenium relay so it tries to use the proxy to a driver that is on the Jenkins machine and fails.

On Tue, Aug 1, 2017, 4:37 PM Craig notifications@github.com wrote:

I am having issues with how that is previously phrased. So I’m trying to get onboard but I don’t understand.

You launch your test against saucelabs and need to use the proxy. This is currently defined as webdriverProxy previously defined as sauceProxy. Is it because we are initializing sauce with a proxy in the sauce constructor and then when we get a new driver instance we are trying to proxy again? See sauce constructor https://github.com/angular/protractor/blob/ab1afb093107f3a63f6e15f8f315e33576bb414d/lib/driverProviders/sauce.ts#L61 and get new driver https://github.com/angular/protractor/blob/ab1afb093107f3a63f6e15f8f315e33576bb414d/lib/driverProviders/driverProvider.ts#L54

If that is the case, then I will put a PR to revert this change. We currently do not have a proxy service to test some of these changes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/angular/protractor/issues/4405#issuecomment-319504438, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPLteZDSomb8F1uoxZsD1HXzfYXCcU4ks5sT5qggaJpZM4OjD5d .

1reaction
cnishinacommented, Aug 1, 2017

I can do this right now…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sauce Connect Proxy - Sauce Labs Documentation
We offer several different setup types, from the Basic Sauce Connect Proxy Setup to the High Availability Sauce Connect Proxy Setup.
Read more >
Defining proxy settings | Provar
Provar automatically detects your proxy settings and has a Network Settings feature to manage network and proxy settings in a user-friendly way from...
Read more >
Sauce Labs FAQs | Comparably
Find answers to frequently asked questions on Sauce Labs's FAQ page on ... Configuring Java RemoteWebDriver to Connect to Sauce Labs through a...
Read more >
Setting Up and Using Sauce Connect Proxy - YouTube
This short video provides an introduction to setting up and using Sauce Lab's optional Sauce Connect Proxy for securely testing ...
Read more >
saucelabs - Unable to start sauce connect with proxy
To use BMP (Or WonderProxy or anything else) with Sauce Connect, you need to configure Sauce Connect to establish the secure connection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found