Skip to end of metadata
Go to start of metadata

There are three types of links you can create to provide access to your tests. These links will let whoever you share them with view the Test Details page for that test, but the test results will not appear in their dashboard. You can also create links by setting the Sharing options on the Test Details page, and then sharing the link to that page. 

Links to Jobs that Require a Login to View

In Selenium, when a client requests a new browser session, the server returns a session ID, which is used to identify that session throughout the test. The session ID is stored as a member variable of the instantiated Selenium object and named sessionId or session_id, depending on the client library. Sauce uses that session ID as the job id for accessing test results.

To directly access a specific job, you will first need to note the session ID locally, usually by writing it to a log file. You can then use it to create a URL with the following format and replace YOUR_JOB_ID with the session ID.

http://saucelabs.com/jobs/YOUR_JOB_ID

 

Notice that links to jobs in this format will only work if you are logged in with the account that ran the job or if that account is a sub-account of yours. For generating public links, see the next section.

Links to Jobs that Don't Require a Login to View

The links you create to your jobs in can be constructed in a way that doesn't require anonymous viewers to login and use your credentials. This is based on authentication tokens.

Auth tokens are generated on a per-job basis and give the receiver access using an hmac-based algorithm. You can also find hmac implementations for different programming languages.

The digest algorithm to use is MD5. The message and key used to generate the token should be the following:

  • Key: sauceUsername:sauceAccessKey
  • Message: job-id

Here's an example in Python for generating the token in the Python interpreter for a job with id: 5f9fef27854ca50a3c132ce331cb6034

>>> import hmac
>>> from hashlib import md5
>>> hmac.new("YOUR_SAUCE_USERNAME:YOUR_ACCESS_KEY", "5f9fef27854ca50a3c132ce331cb6034", md5).hexdigest()

Once the auth token has been obtained, you can use it to build a link in this format: https://saucelabs.com/jobs/YOUR_JOB_ID?auth=AUTH_TOKEN.


Temporary Links to Jobs

You can extend the links generated with authentication tokens to make them work for either one day or one hour duration, based on parameters that you set. During the hmac generation, set the key like this:

  • Key: YOUR_USERNAME:YOUR_ACCESS_KEY:YOUR_DATE_RANGE

The date range can take two formats: YYYY-MM-DD-HH and YYYY-MM-DD. These should be set in UTC time and will only work during the date or hour you set.

 

 

  • No labels
Write a comment…