Gathering detailed insights and metrics for saucelabs
Gathering detailed insights and metrics for saucelabs
Gathering detailed insights and metrics for saucelabs
Gathering detailed insights and metrics for saucelabs
codeceptjs-saucelabs
CodeceptJS Saucelabs Integration
testcafe-browser-provider-saucelabs
saucelabs TestCafe browser provider plugin.
saucelabs-connector
Helps connect the local machine to SauceLabs and start a remote browser.
karma-sauce-launcher
A Karma plugin. Launch any browser on SauceLabs!
npm install saucelabs
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
93 Stars
431 Commits
44 Forks
16 Watching
11 Branches
34 Contributors
Updated on 03 Sept 2024
JavaScript (98.03%)
Mustache (1.07%)
TypeScript (0.84%)
Shell (0.07%)
Cumulative downloads
Total Downloads
Last day
-7.1%
174,132
Compared to previous day
Last week
-0.2%
935,150
Compared to previous week
Last month
9.7%
4,037,536
Compared to previous month
Last year
-18.4%
48,307,738
Compared to previous year
Wrapper around all Sauce Labs REST APIs for Node.js (v18 or higher) including support for Sauce Connect Proxy and TypeScript definitions.
To install the package run:
1npm install saucelabs
Your Sauce Labs username.
Type: string
Default: process.env.SAUCE_USERNAME
Your Sauce Labs access key.
Type: string
Default: process.env.SAUCE_ACCESS_KEY
Your Sauce Labs datacenter region. The following regions are available:
us-west-1
(short us
)eu-central-1
(short eu
)us-east-4
(real mobile devices only)Type: string
Default: us
If you want to tunnel your API request through a proxy please provide your proxy URL.
Type: string
Default: null
If you want to set request headers, as example {'User-Agent': 'node-saucelabs'}
Type: object
Default: {'User-Agent': 'saucelabs/<VERSION> (nodejs <PLATFORM>)'}
All accessible API commands with descriptions can be found here.
This package if installed globally can be used as CLI tool to access the API from the command line:
1$ npm install -g saucelabs 2... 3$ sl listJobs $SAUCE_USERNAME 5 --region eu 4{ jobs: 5 [ { id: '19dab74f8fd848518f8d2c2cee3a6fbd' }, 6 { id: 'dc08ca0c7fa14eee909a093d11567328' }, 7 { id: '5bc6f70c777b4ae3bf7909a40f5ee41b' }, 8 { id: 'f40fe7b044754eaaa5f5a130406549b5' }, 9 { id: 'd1553f71f910402893f1e82a4dcb6ca6' } ] }
You can find all available commands and options with description by calling:
1$ sl --help 2# show description for specific command 3$ sl listJobs --help
or update the job status by calling:
1$ sl updateJob cb-onboarding 690c5877710c422d8be4c622b40c747f "{\"passed\":false}"
or download a job asset:
1$ sl downloadJobAsset 690c5877710c422d8be4c622b40c747f video.mp4 --filepath ./video.mp4
or upload a job asset:
1$ sl uploadJobAssets 690c5877710c422d8be4c622b40c747f --files ./video.mp4 --files ./log.json
or start Sauce Connect Proxy in EU datacenter:
1# start Sauce Connect tunnel for eu-central-1 region 2$ sl sc --region eu --tunnel-name "my-tunnel" 3# run a specific Sauce Connect version 4$ sl sc --scVersion 4.9.1 5# see all available Sauce Connect parameters via: 6$ sl sc --help
You can see all available Sauce Connect parameters on the Sauce Labs Docs.
The following example shows how to access details of the last job you were running with your account that is being exposed as environment variables as SAUCE_USERNAME
and SAUCE_ACCESS_KEY
. Alternatively you can pass the credentials via options
to the constructor:
1import SauceLabs from 'saucelabs'; 2// if imports are not supported by your Node.js version, import the package as follows: 3// const SauceLabs = require('saucelabs').default; 4 5(async () => { 6 const myAccount = new SauceLabs(); 7 // using constructor options 8 // const myAccount = new SauceLabs({ user: "YOUR-USER", key: "YOUR-ACCESS-KEY"}); 9 10 // get full webdriver url from the client depending on region: 11 console.log(myAccount.webdriverEndpoint); // outputs "https://ondemand.us-west-1.saucelabs.com/" 12 13 // get job details of last run job 14 const jobs = await myAccount.listJobs(process.env.SAUCE_USERNAME, { 15 limit: 1, 16 full: true, 17 }); 18 19 console.log(jobs); 20 /** 21 * outputs: 22 * { jobs: 23 [ { browser_short_version: '72', 24 video_url: 25 'https://assets.saucelabs.com/jobs/dc08ca0c7fa14eee909a093d11567328/video.flv', 26 creation_time: 1551711453, 27 'custom-data': null, 28 browser_version: '72.0.3626.81', 29 owner: '<username-redacted>', 30 id: 'dc08ca0c7fa14eee909a093d11567328', 31 record_screenshots: true, 32 record_video: true, 33 build: null, 34 passed: null, 35 public: 'team', 36 end_time: 1551711471, 37 status: 'complete', 38 log_url: 39 'https://assets.saucelabs.com/jobs/dc08ca0c7fa14eee909a093d11567328/selenium-server.log', 40 start_time: 1551711454, 41 proxied: false, 42 modification_time: 1551711471, 43 tags: [], 44 name: null, 45 commands_not_successful: 1, 46 consolidated_status: 'complete', 47 manual: false, 48 assigned_tunnel_id: null, 49 error: null, 50 os: 'Windows 2008', 51 breakpointed: null, 52 browser: 'googlechrome' } ] } 53 */ 54 55 /** 56 * start Sauce Connect Proxy 57 */ 58 const sc = await myAccount.startSauceConnect({ 59 /** 60 * you can pass in a `logger` method to print Sauce Connect log messages 61 */ 62 logger: (stdout) => console.log(stdout), 63 /** 64 * see all available parameters here: https://docs.saucelabs.com/dev/cli/sauce-connect-proxy/ 65 * all parameters have to be applied camel cased instead of with hyphens, e.g. 66 * to apply the `--tunnel-name` parameter, set: 67 */ 68 tunnelName: 'my-tunnel', 69 }); 70 71 // run a test 72 // ... 73 74 // close Sauce Connect 75 await sc.close(); 76 77 // upload additional log files and attach it to your Sauce job 78 await myAccount.uploadJobAssets('76e693dbe6ff4910abb0bc3d752a971e', [ 79 // either pass in file names 80 './logs/video.mp4', 81 './logs/log.json', 82 // or file objects 83 { 84 filename: 'myCustomLogFile.json', 85 data: { 86 someLog: 'data', 87 }, 88 }, 89 ]); 90})();
You may wonder why
listJobs
requires ausername
as first parameter since you've already defined the process.env. The reason for this is that Sauce Labs supports a concept of Team Accounts, so-called sub-accounts, grouped together. As such functions like the mentioned could list jobs not only for the requesting account, but also for the individual team account. Learn more about it here
webdriverEndpoint
propertyYou can use the webdriverEndpoint
property of the client to get the full WebDriver endpoint to connect to Sauce Labs, e.g.:
1const myAccount = new SauceLabs({ 2 user: 'YOUR-USER', 3 key: 'YOUR-ACCESS-KEY', 4 region: 'eu', // run in EU datacenter 5}); 6 7// get full webdriver url from the client depending on `region` option: 8console.log(myAccount.webdriverEndpoint); 9// outputs: "https://ondemand.eu-central-1.saucelabs.com/"
This module was originally created by Dan Jenkins with the help of multiple contributors (Daniel Perez Alvarez, Mathieu Sabourin, Michael J Feher, and many more). We would like to thank Dan and all contributors for their support and this beautiful module.
Copyright 2012 Sauce Labs, Inc. Licensed Apache-2.0
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 12/22 approved changesets -- score normalized to 5
Reason
6 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More