Cucumber.js with Playwright Advanced Configuring
Using Node.js Runtime on Sauce Cloud
Since saucectl v0.185.0, you can specify a Node.js runtime version on Sauce Cloud.
Only supported test runners can use configurable Node.js versions. Check the following pages for supported framework versions.
Supported Node.js Versions
Sauce Labs supports the following Node.js versions:
| Node.js Version | Alias | End of Life | Removal Date |
|---|---|---|---|
| 22.11.0 | jod, lts | April 30, 2027 | July 30, 2027 |
| 20.18.1 | iron, maintenance | April 30, 2026 | July 30, 2026 |
| 20.14.0 | April 30, 2026 | July 30, 2026 |
Using a Tunnel With Cucumber for Playwright
When using a tunnel with Cucumber for Playwright, you need to explicitly tell Playwright to use it.
Its value is stored in the HTTP_PROXY env var.
Example:
loading...
Environment Variable Expansion
All values in your saucectl configuration support environment variable expansion. $var in config.yml will be replaced according to your shell's environment variables. References to undefined variables will be replaced with an empty string.
Predefined Environment Variables
The following environment variables are available during test execution.
| Environment Variable | Description |
|---|---|
| SAUCE_JOB_ID | Job ID |
| SAUCE_SUITE_NAME | Suite Name |
| SAUCE_ARTIFACTS_DIRECTORY | Absolute path to the artifacts directory. Files placed in this folder are persisted with the Job. |
Tailoring Your Test File Bundle
The saucectl command line bundles your root directory (rootDir parameter of config.yml) and transmits it to the Sauce Labs cloud, then unpacks the bundle and runs the tests. This functionality is partly what allows Sauce Control to operate in a framework-agnostic capacity. However, you can and should manage the inclusion and exclusion of files that get bundled to optimize performance and ensure security.
Excluding Files from the Bundle
The .sauceignore file allows you to designate certain files to be excluded from bundling.
Add any files that are not direct test dependencies to .sauceignore to reduce the size of your bundle, improve test speed, and protect sensitive information.
Examples of what can be included in .sauceignore:
# .sauceignore
# Ignore node_modules
node_modules/
# Ignore all log files
*.log
# Ignore executables/binaries
*.exe
*.bin
**/*/bin
# Ignore media files
*.png
*.jpeg
*.jpg
*.mp4
# Ignore documentation
*.rst
*.md
# Ignore sensitive data
credentials.yml
Sometimes it's easier to do the inverse: Including files for the bundle.
# Ignore all files by default.
/*
# Re-include files we selectively want as part of the payload by prefixing the lines with '!'.
!/node_modules
!/cypress
!cypress.config.js
# Since the whole '/cypress' folder is now included, this would also include any
# subdirectories that potentially contain auto-generated test artifacts from
# the local dev environment.
# It'd be wasteful to include them in the payload, so let's ignore those subfolders.
/cypress/videos/
/cypress/results/
/cypress/screenshots/
Including Node Dependencies
The default .sauceignore file lists node_modules/ so locally installed node dependencies are excluded from the bundle. If your tests require node dependencies to run, you can either:
Remove "node_modules" from .sauceignore
Delete or comment out node_modules/ in your .sauceignore file to bundle your node dependencies. For example,
# Do NOT exclude node_modules from bundle
# node_modules/
Node dependencies can increase your bundle by potentially hundreds of megabytes, so consider including only the required dependencies rather than the entire node_modules directory. The following sections provide some methods for limiting the scope of dependencies you must include.
Install "devDependencies" Only
Consider only installing NPM devDependencies if your tests do not require all prod dependencies.
# Only install dev dependencies
npm install --only=dev
saucectl run
Uninstall Nonessential Dependencies
If your standard install includes dependencies that aren't needed to run your tests, uninstall them prior to bundling.
# Install node dependencies
npm ci # or "npm install"
# Remove unneeded dependencies
npm uninstall appium
npm uninstall express
saucectl run