LambdaTest Cypress CLI
The `lambdatest-cypress-cli` is a command-line interface developed by LambdaTest to facilitate running Cypress end-to-end tests on the LambdaTest cloud-based cross-browser testing platform. Currently stable at version 3.0.50, the package demonstrates an active release cadence with frequent minor updates and fixes, as seen in its detailed changelog, which often includes multiple releases within short periods. Its core functionality involves configuring and executing Cypress test suites across a vast array of browser and operating system combinations provided by LambdaTest's online Selenium Grid, differentiating it from local Cypress test runners by offering scalable cloud execution and comprehensive test analytics. Users interact with the CLI to initialize configuration files, set up authentication credentials, define target browsers, and manage test execution parameters like parallel sessions and Cypress versions.
Common errors
-
LT_USERNAME and LT_ACCESS_KEY are not set. Please set the environment variables.
cause The LambdaTest username or access key environment variables (`LT_USERNAME`, `LT_ACCESS_KEY`) are not defined in the shell where the CLI is being executed.fixBefore running `lambdatest-cypress`, execute `export LT_USERNAME="your_username"` and `export LT_ACCESS_KEY="your_access_key"` (replace placeholders with actual credentials) or use a `.env` file loader. -
Error: Configuration file (lambdatest-cypress.json) not found. Please run 'lambdatest-cypress init' to create one.
cause The required `lambdatest-cypress.json` configuration file is missing from the current working directory.fixRun `lambdatest-cypress init` in your project's root directory to generate the default configuration file, then customize it as needed. -
command not found: lambdatest-cypress
cause The `lambdatest-cypress` command is not available in your system's PATH, typically because the package was not installed globally or `npx` is not being used.fixInstall the package globally using `npm install -g lambdatest-cypress-cli` or execute the command using `npx lambdatest-cypress run` (for local installation). -
Error: tunneling socket could not be established, cause=self signed certificate in certificate chain
cause This error often indicates issues with proxy configuration, specifically when a corporate proxy uses a self-signed certificate that Node.js does not trust by default.fixUpgrade to `lambdatest-cypress-cli@3.0.50-prod` or higher, which defaults `reject_unauthorized` to `false` for proxy compatibility. Alternatively, configure your Node.js environment to trust the proxy's certificate, or set `NODE_TLS_REJECT_UNAUTHORIZED=0` (use with caution in production).
Warnings
- gotcha Authentication to LambdaTest requires setting `LT_USERNAME` and `LT_ACCESS_KEY` environment variables. Failing to set these will prevent tests from running on the platform.
- gotcha The `lambdatest-cypress.json` configuration file is crucial for defining browsers, OS, Cypress versions, and other test parameters. Running `lambdatest-cypress run` without this file, or with an improperly configured one, will lead to errors.
- breaking Support for authenticated proxies and resilience for feature flags were improved in version `3.0.50-prod`. Specifically, `reject_unauthorized` now defaults to `false` for proxy compatibility. This change might subtly alter behavior for users with custom proxy configurations, potentially resolving or introducing certificate-related issues depending on their setup.
- gotcha The `cypress_version` specified in your `lambdatest-cypress.json`'s `run_settings` must be compatible with or match the Cypress version used in your local project for accurate test execution on the LambdaTest grid. Mismatches can lead to unexpected failures or behavior.
Install
-
npm install lambdatest-cypress-cli -
yarn add lambdatest-cypress-cli -
pnpm add lambdatest-cypress-cli
Imports
- lambdatest-cypress run
node path/to/cli.js
lambdatest-cypress run
- lambdatest-cypress init
npx lambdatest-cypress setup
lambdatest-cypress init
- npx lambdatest-cypress
lambdatest-cypress run (if not globally installed)
npx lambdatest-cypress run
Quickstart
npm install -g lambdatest-cypress-cli # Set LambdaTest credentials as environment variables export LT_USERNAME="$LT_USERNAME" export LT_ACCESS_KEY="$LT_ACCESS_KEY" # Initialize the configuration file (lambdatest-cypress.json) lambdatest-cypress init # Edit lambdatest-cypress.json to configure browsers, OS, and test settings. # Example modification (after init creates the file): # Ensure your project's Cypress version matches 'cypress_version' in run_settings. # Run your Cypress tests on LambdaTest lambdatest-cypress run