The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Analytics

External Resources

More Info


Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Prerequisites

...

Instant Test

Download this script from the GitHub repo to your local machine, provide the information for SAUCE_USERNAME and SAUCE_ACCESS_CODE as indicated in the script, and then save and run the script. If you log in to saucelabs.com before you run the script, you'll be able to watch the script's progress as it executes.

View Git file
pathREADME.md
lastline10
repository-id38
firstline3
branchrefs/remotes/origin/master

Prerequisites

Clone from: https://github.com/saucelabs-training/demo-js/blob/master/web-tests/instant-sauce-mocha-test1.js

Expand
titleClick here to view expand the example script
content
View Git file
path
web-tests/instant-sauce-mocha-test1.js
prerequisites.md
lastline125
repository-id38
firstline3
branchrefs/remotes/origin/master

To find your Sauce Labs access key:

  1. Sign in to https://saucelabs.com with the username you set up when you created your account. 
    You will use this same username in your test script. 
  2. To find your access key:
    1. Click your name in the Account Profile menu in the upper-right corner.
    2. Click User Settings.
    3. Scroll down to Access Key and click Show.
    4. Enter the password you use to sign in to Sauce Labs to view the access key.
    5. Click the Copy icon.

...

linenumberstrue


Sauce Labs Test Setup

This example script follows the best practice of using environment variables in place of hardcoded authentication credentials. Once you've been able to successfully run the instant test with hardcoded credentials, you can use this test to make sure that you've correctly set up your environment variables for authentication.

...

view

...

-

...

git-file
path

...

README.md
lastline59
repository-id38
firstline24
branchrefs/remotes/origin/master

Instant Test with Best Practices and Sauce Labs Reporting

This example script illustrates the use of several best practices in test design, and will report Pass/Fail status to the Sauce Labs dashboard.

Expand
titleClick here to view the example script

Clone from: https://github.com/saucelabs-training/demo-js/blob/master/web-tests/instant-sauce-mocha-test4.js

View Git file
pathweb-tests/instant-sauce-mocha-test4.js
repository-id38
branchrefs/remotes/origin/master

Choosing the Correct Data Center

Include Page
_endpoints
_endpoints

Running Local Tests

Include Page
_sauce_connect_description
_sauce_connect_description

...