Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use saucelabs with nightwatch?

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?
like image 552
Brown A Avatar asked Oct 19 '22 13:10

Brown A


1 Answers

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.

like image 142
oboeCoder Avatar answered Oct 21 '22 21:10

oboeCoder