If you already have existing JavaScript unit tests as part of your build cycle, you can run them on Sauce using the REST API.
What You'll Need
- The SAUCE_USERNAME and SAUCE_ACCESS_KEY specific to your Sauce Labs account
Use Sauce Connect Proxy for your Local JavaScript Unit Tests
Are you hosting your tests on your local area network (LAN) or your laptop? You'll need to run Sauce Connect Proxy to bridge the Sauce Labs platform to your local network. The optional parameters related to Sauce Connect Proxy include:
tunnelIdentifier
: specifies the ID of a specific tunnel when using multiple Sauce Connect tunnels.parentTunnel
: specifies the username of a parent account whose shared Sauce Connect tunnel your tests should use.
Any other optional Test Configuration Options get passed on to the local Selenium server.
REST API Methods
Base API REST URL: https://saucelabs.com/rest/v1/, for more information about the API endpoints, refer to The Sauce Labs REST API.
Method | Description | URL | Method Type | Request Fields | Example Request |
---|---|---|---|---|---|
Start JS Unit Tests | Starts your JavaScript unit tests on one, or multiple browsers. | :username/js-tests | POST |
The Supported Jasmine Version Only the Jasmine 2 framework is supported. |
|
Get JS Unit Test Status | Gets the status of your JS unit tests. | :username/js-tests/status | POST |
|
Make the request multiple times as the tests run until the response contains |
1 Comment
Anonymous
This mentions a framework=mocha parameter in the REST API and mentions a
window.global_test_results variable for the "custom" framework but
mentions no such thing for Mocha, implying that Sauce Labs "just
works" with Mocha. This page should link to (and better organize) these: Getting Started with JavaScript Unit Testing Example