The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

We expose all of our captured performance data, including the calculated baselines via our API. You can use it to build your own internal performance dashboards to have a more custom overview on your performance data.

See the following sections for more information: 

Download Data

Currently we only provide a package in Node.js to access the data via a programmable interface. You can always use a curl command to access the API.

Using node-saucelabs

If you want to use Node.js you can use our saucelabs NPM package to access the API endpoints. The package has an interface to access performance data as well as other Rest API endpoints.

You can install the package via:

Install node-saucelabs
$ npm install saucelabs

You can then, e.g. fetch the performance data of a test via:

Performance API Query Example
const SauceLabs = require('./build').default

const api = new SauceLabs({
    user: process.env.SAUCE_USERNAME,
    key: process.env.SAUCE_ACCESS_KEY,
})

api.getPerformanceMetricsByJobId(
    '73b1ad4e397e48cbb972e07018280260',
    { full: true }
).then(
    (data) => console.log(JSON.stringify(data, null, 4))
    /**
     * outputs:
     *
     * {
         "items": [{
             "job_id": "73b1ad4e397e48cbb972e07018280260",
             "job_owner": "cb-onboarding",
             "job_name_hash": "df6f7aaaf4e4ec9a2a503b9360a2cf0ce607262d",
             "metric_data": {
                 "firstVisualChange": 494,
                 "score": 0.9996662118223446,
                 "speedIndex": 1436,
                 ...
             },
             "page_url": "https://www.instagram.com/accounts/login",
             ...
             "links": {
                 ...
             }
         },
         {
             ...
         }]
     * }
     */
)

You can find more information on other supported functions in the package documentation.

Using CURL

To query the data using the curl command, run:

Curl Example
curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY https://api.us-west-1.saucelabs.com/v2/performance/metrics/73b1ad4e397e48cbb972e07018280260/

API Documentation


tbd..

  • No labels