protractor: protractor 5.1.1 is unable to run test cases in sauce lab but working fine with 5.0.0 / 4 version perfectly

Bug report

  • Node Version: 6.9.1
  • Protractor Version: 5.1.1
  • Angular Version: 1.6.0
  • Browser(s): saucelab chrome
  • Operating System and Version OS X EI captain 10.11.6
  • Your protractor configuration file find below
  • A relevant example test: I was trying to test my test cases in sauce lab after upgrading it to 5.1.1 it did not work, but when I downgrade it to 4/5.0.0 it worked fine. It did not show any error but did not proceed with the tunnel created
  • Output from running the test: attached below
  • Steps to reproduce the bug change the protractor version and will not run
  • The URL you are running your tests against (if relevant) not relevant

configuration ifle:

exports.config = {
  sauceUser: '<userid>',
  sauceKey: '<key>',
  sauceSeleniumAddress: 'localhost:4445/wd/hub',
  //webDriverProxy: '<proxyurl-commented nto required>',
  /*capabilities: {
   'browserName': 'chrome',
   'tunnel-identifier': 'shepherd',
   'build': 'build-12345',
   'name': 'Shepherd DEV functional',
   }*/

  multiCapabilities: [
    {
      'browserName': 'chrome',
      'tunnel-identifier': 'shepherd',
      'build': 'build-12345',
      'name': 'Shepherd DEV functional',
      'chromeOptions': {
        'args': ['--no-sandbox', '--test-type=browser'],
        'prefs': {
          'download': {
            'prompt_for_download': false,
            'default_directory': '/tmp'
          }
        }
      }
      // 'browserName': 'phantomjs',
      // 'phantomjs.binary.path': require('phantomjs-prebuilt').path,
      // 'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG'],
      // 'phantomjs.page.settings.userName': 'tst_dm_adm',
      // 'phantomjs.page.settings.password': 'CAlsGSV#/HNyAX'
    }
  ],
  allScriptsTimeout: 50000,
  seleniumArgs: ['--ignore_ssl'],
  suites: {
    home: 'home/*.spec.js',
    ...
  },
  framework: 'jasmine2',
  jasmineNodeOpts: {
    // If true, print colors to the terminal.
    showColors: true,
    // Default time to wait in ms before a test fails.
    defaultTimeoutInterval: 50000,
    //remove protractor's default dot reporter
    print: function () {
    }
  },
  onPrepare: function () {
    var SpecReporter = require('jasmine-spec-reporter');
    // add jasmine spec reporter
    jasmine.getEnv().addReporter(new SpecReporter({
      displayStacktrace: 'all',
      prefixes: {success: '* ', failure: 'X ', pending: '* '}
    }));

    var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmineReporters.JUnitXmlReporter(null, true, true, 'testOutput')
    );
  }
};

*** below is the console output after running protractor -c config.js***

C429349HHY3QD:shepherd-test RF886$ ./run-in-saucelab.sh 
Installing..
npm WARN app-tests@0.8.0 No description
npm WARN app-tests@0.8.0 No repository field.
npm WARN app-tests@0.8.0 No license field.
Updating webdriver..
[10:50:54] I/file_manager - creating folder /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium
[10:50:55] I/downloader - curl -o /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.15.0.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-macos.tar.gz
[10:50:55] I/update - geckodriver: unzipping geckodriver-v0.15.0.tar.gz
[10:50:55] I/update - geckodriver: setting permissions to 0755 for /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.15.0
[10:50:56] I/downloader - curl -o /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.28.zip https://chromedriver.storage.googleapis.com/2.28/chromedriver_mac64.zip
[10:50:56] I/downloader - curl -o /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.3.1.jar https://selenium-release.storage.googleapis.com/3.3/selenium-server-standalone-3.3.1.jar
[10:50:58] I/update - chromedriver: unzipping chromedriver_2.28.zip
[10:50:58] I/update - chromedriver: setting permissions to 0755 for /Users/RF886/aniruddhadas9/develop/herd/jan30/shepherd-test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.28
Running tests..
[10:51:00] I/launcher - Running 1 instances of WebDriver
[10:51:00] I/sauce - Using SauceLabs selenium server at https://localhost:4445/wd/hub

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted comments

The way @wswebcreation mentioned worked for me now. Actually the protractor version 4 and 5 takes configuration in different ways.

if you are using protractor 4 then configure your sauce lab the way I did and if you are using protractor 5 or higher then use protractor config the way @wswebcreation in his post

@ashubham and @aniruddhadas9

Strange that the tests are failing for you both. I have the following setup and it works:

  • protractor: 5.1.1
  • Node: 6.9.2
  • OSX 10.12.3
  • Sauce Connect 4.4.3 (higher version doesn’t pull up the connection)

Config:

'use strict';
const path = require('path');
const config = require('./protractor.shared.conf').config;

const SAUCE_USERNAME = '<username>';
const SAUCE_ACCESS_KEY = '<key>';

config.baseUrl = `http://localhost:5555`;

config.seleniumAddress = 'http://localhost:4445/wd/hub';

config.multiCapabilities = [
    {
        browserName: 'chrome',
        platform: "Windows 10",
        version: "latest",
        screenResolution: "1400x1050",
        name: '<Name>',
        username: SAUCE_USERNAME,
        accessKey: SAUCE_ACCESS_KEY,
        'tunnel-identifier': '<tunnel-identifier>',
        shardTestFiles: true
    }
];
exports.config = config;

Biggest difference in the configurations is that:

  • I don’t use sauceUser: '<userid>'
  • I don’t use sauceKey: '<key>'
  • I don’t use sauceSeleniumAddress: 'localhost:4445/wd/hub'

Can you check with my configuration if it works? If so we might have an issue with the default connection that we should use of Protractor for Sauce Labs

Grtz

Wim

FWIW I used the config above by @wswebcreation as my template and it worked with Protractor 5.3.2.

The important things for me were the de-Saucing, if you will, of the three options listed specifically by @wswebcreation.

Another thing to note is that the newly generically named options must be included in each browser config object, as opposed to do the top level. For me, it looks something like this:

const COMMON = {
    platform: 'Windows 7',
    username: process.env.USERNAME,
    accessKey: process.env.ACCESS_KEY,
    build: process.env.BUILD,
    name: process.env.COMMIT + ' (' + process.env.BRANCH + ')',
    'tunnel-identifier': process.env.TUNNEL_ID,
};

exports.config = {
    multiCapabilities: [
        Object.assign(COMMON, {
            browserName: 'chrome',
        }),
        Object.assign(COMMON, {
            browserName: 'firefox',
            version: '58.0',
        }),
    ],

    ...
};

Finally, at first I was getting back this error when running through SauceLabs remotely:

Error: Invalid URL: sauce_a1b2c3d:4445/wd/hub

After I prepended my seleniumAddress with http://, it worked perfectly.

Thanks you @wswebcreation!

After some debugging I put myself on the wrong track, see the linked issue. The solution it pretty simple.

Cause: Between Protractor 4.0.14 and Protractor 5.0.0 there has been a change in the driverProviders. There is now a condition here that will NOT go to the Sauce Labs runner if you provide a custom seleniumAddress.

Solution: You need to change your seleniumAddress-property to sauceSeleniumAddress, then it will work. So don’t keep the seleniumAddress in your config file! Protractor will take care of all the connection between your tests and Sauce Labs, even update the instances in Sauce Labs with the correct status.

I’m going to close the issue for now. Feel free to add more questions in this issue.