nightwatchjs / nightwatch-docs

Source for https://nightwatchjs.org website
https://nightwatchjs.org
MIT License
95 stars 191 forks source link

Docs: saucelabs + tunnel identifier #18

Open timmywil opened 8 years ago

timmywil commented 8 years ago

I found documentation for connecting to saucelabs, but I don't see any documentation for where to put the tunnel identifier. I've seen a couple other repos put it in "desiredCapabilities", like so...

"test_settings": {
  "default": {
  ...
    "desiredCapabilities": {
      "tunnel-identifier": uuid,
      "browserName": "chrome"
      ...
    }
  }
}

If that is the right place, please document.

mattpardee commented 8 years ago

AFAICT, you don't put the tunnel identifier anywhere. First you start up the tunnel to connect to saucelabs. Your configuration should be normal:

bin/sc -u username -k key

My nightwatch.json config section dedicated to using the tunnel looks like this:

"saucelocal": {
  "launch_url": "http://www.localsite.org:3000",
  "selenium_host": "localhost",
  "selenium_port": 4445,
  "username": "[username]",
  "access_key": "[key]",
  "start_process": false,

  "desiredCapabilities": {
    "browserName": "Internet Explorer",
    "version": "10",
    "platform": "Windows 7",
    "javascriptEnabled": true,
    "acceptSslCerts": true,
    "screenResolution": "1280x1024"
  }
}

Not sure all those details are necessary, but the point is it connects to your local tunnel instance running at localhost:4445 (be sure to double-check your sc instance details as YMMV) and those commands get piped to the saucelabs cloud selenium instance, which tunnels instructions back down to your local server.

With these configs in place, you would start up Nightwatch on the command-line perhaps like this:

node_modules/nightwatch/bin/nightwatch --env saucelocal
timmywil commented 8 years ago

@mattpardee This is for when a tunnel is started with an identifier. You're not using one. See saucelabs docs for more info.

mattpardee commented 8 years ago

Aha. I didn't realize what they were for. SauceLabs' docs on this topic are woefully incomplete/indirect.

kirankabadi7 commented 7 years ago

@timmywil Did you get any solution for the issue? I am using sauce labs with Nightwatch, but not sure of how to use sauceconnect to use my private URL.

wibily commented 7 years ago

In case anyone is having the same problem, you need to start sauce connect with the -i flag to create a named tunnel ie sc -u ${sauce labs username} -k ${sauce labs access key} -i ${tunnel name}

Then inside your nightwatch config, in the desiredCapabilities section, you add in the following key "desiredCapabilities": { "tunnelIdentifier": ${tunnel name}, ...

Krinkle commented 3 years ago

For those of you migrating from Travis CI to GitHub Actions and noticing that Nightwatch tests are failing in a confusing way (e.g. timeouts and 404 errors), it might be because the tunnel isn't being started. On Travis CI this happened declaratively via the sauce_connect addon.

On GitHub Actions, you'll have to do this manually. Either by using the sc command as described above (from the saucelabs npm package), and taking care to run in the background and cleaning it up afterwards. Or, by using the SauceLabs "action" that does this for you: https://github.com/saucelabs/sauce-connect-action.