8

I'm trying to test a mobile app written using Ionic and since Ionic is based on Angular, I want to write tests using Protractor and run the tests in mobile emulators using Saucelabs Appium. I invoke protractor using the command:

SAUCE_USERNAME=$(SAUCE_USERNAME) SAUCE_ACCESS_KEY=$(SAUCE_ACCESS_KEY) ./node_modules/.bin/protractor protractorConfig.js

But I get the following error:

UnknownError: Sauce Labs Authentication Error.
You used username 'None' and access key 'None' to authenticate, which are not valid Sauce Labs credentials.

My protractorConfig.js contains:

/* global exports */
/* global process */
exports.config = {
  sauceUser: process.env.SAUCE_USERNAME,
  sauceKey: process.env.SAUCE_ACCESS_KEY,
  capabilities: {
    appiumVersion: "1.0",
    app: "sauce-storage:app.zip",
    platformName: "iOS",
    platformVersion: "7.1",
    deviceName: "iPhone Simulator",
    browserName: ""
  },
  allScriptsTimeout: 30000,
  seleniumAddress: "http://" + 
    process.env.SAUCE_USERNAME + ":"+process.env.SAUCE_ACCESS_KEY+
    "@ondemand.saucelabs.com:80/wd/hub",

  specs: [
    "spec/feature/*.js"
  ]
};

Why is Protractor/Saucelabs saying I'm not providing a user name or access key?

Edit: I based this question and my answer from information in one of the answers in Running e2e tests on Sauce Labs from Protractor on Travis. I made this question and answer in hopes that the information, which took a lot of google searching to find, would be more accessible to others who have the same issue.

Community
  • 1
  • 1
Patrick Canfield
  • 1,575
  • 1
  • 11
  • 17
  • possible duplicate of [Running e2e tests on Sauce Labs from Protractor on Travis](http://stackoverflow.com/questions/20881660/running-e2e-tests-on-sauce-labs-from-protractor-on-travis) – Louis Mar 12 '15 at 17:13

1 Answers1

14

Thanks to this other question I now know that you have to omit the 'seleniumAddress' from the configuration, otherwise Protractor will ignore your Saucelabs authentication. It will correctly generate the 'seleniumAddress' if omitted, though at this point I'm not sure how it knows how to do that.

Community
  • 1
  • 1
Patrick Canfield
  • 1,575
  • 1
  • 11
  • 17
  • 2
    Just wanna say, great props for answering your own question and posting the answer, instead of just "Nevermind, found it!" – Felix Mar 12 '15 at 17:22