5

I have the following configuration in my nightwatch.json file

"saucelabsChrome": {
  "selenium_host": "ondemand.saucelabs.com",
  "selenium_port": 80,
  "username": "example",
  "access_key": "--REDACTED---",
  "desiredCapabilities": {
    "acceptsSslCerts": true,
    "name": "chrome",
    "browserName": "chrome",
    "platform": "OS X 10.11",
    "version": "45.0"
  }
},

However, when I run nightwatch with sauce labs

node nightwatch  ---args '{"beta": "true", "env": "stage"}' --test tests/example.js -e saucelabsChrome

I get an error

Couldn't find element signUpAdobe

Two questions

  • Where can I see the nightwatch command running on Saucelabs?
  • What is the best way to integrate saucelabs with nightwatch?
Brown A
  • 849
  • 3
  • 13
  • 21

2 Answers2

3

Here is an example of my nightwatch.json file configured to run parallel tests on Sauce Labs.

{
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "custom_commands",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : false,
    "server_path" : "",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.ie.driver" : ""
    }
  },

  "test_workers" : {"enabled" : true, "workers" : "auto"},

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "selenium_port"  : 80,
      "selenium_host"  : "ondemand.saucelabs.com",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "username" : "${SAUCE_USERNAME}",
      "access_key" : "${SAUCE_ACCESS_KEY}",

      "desiredCapabilities": {
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

    "chrome": {
      "desiredCapabilities": {
        "platform": "XP",
        "browserName": "chrome",
        "version": "41"
      }
    },

    "firefox" : {
      "desiredCapabilities": {
        "platform": "XP",
        "browserName": "firefox",
        "version": "33"
      }
    },

    "internet_explorer_10" : {
      "desiredCapabilities": {
        "platform": "Windows 7",
        "browserName": "internet explorer",
        "version": "10"
      }
    }
  }
}

Here is a link to the entire project if you would like to take a look:

https://github.com/saucelabs-sample-test-frameworks/JS-Nightwatch.js

As to your second question. You can see the tests running in the Sauce Labs dashboard. Login at www.saucelabs.com and click on the tests tab in the top left corner.

oboeCoder
  • 186
  • 6
  • are the nightwatch parallel tests that fast? Comparing webdriverIO to nightwatch is night and day :) webdriver is blazing fast, and nightwatch is very slow – zero_cool Apr 23 '19 at 17:55
0

I realize it's been a few years, but when I was searching I came across this post and found a newer guide for how to use SauceLabs with Nightwatch

Hopefully this helps anyone ending up here like I did :D

EdgeCase
  • 115
  • 1
  • 10