I'm providing 'sauceUser' and 'sauceKey' in my config yet sauce says I'm trying to authenticate with username 'None' and access key 'None'
Asked Answered
I

1

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.

Irish answered 12/3, 2015 at 16:47 Comment(1)
possible duplicate of Running e2e tests on Sauce Labs from Protractor on TravisEldred
I
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.

Irish answered 12/3, 2015 at 16:47 Comment(1)
Just wanna say, great props for answering your own question and posting the answer, instead of just "Nevermind, found it!"Katz

© 2022 - 2024 — McMap. All rights reserved.