Skip to main content

Running Your First Cypress Test On LambdaTest Platform


To demonstrate Cypress testing on the LambdaTest platform, we will use the Cypress Cloud repo in the demo below.

Step-1: Clone the LambdaTest-Cypress Cloud GitHub repo and switch to the cloned directory.

git clone https://github.com/LambdaTest/Cypress-Cloud.git
cd Cypress-Cloud

Step-2: Setup the LambdaTest-Cypress CLI and configure the configuration file, as shown in the Prerequisites before. A file named lambdatest-config.json is generated in your project using the below command:

lambdatest-cypress init

Here, we have used the below configuration as default and generated it in the lambdatest-config.json file. You need to set up the authentication by using LambdaTest credentials. You can check here for more details about authentication.

{
"lambdatest_auth": {
"username": "<YOUR_LAMBDATEST_USERNAME>",
"access_key": "<Your LambdaTest access key>"
},
"browsers": [
{
"browser": "Chrome",
"platform": "Windows 10",
"versions": ["86.0"]
},
{
"browser": "Firefox",
"platform": "Windows 10",
"versions": ["82.0"]
}
],
"run_settings": {
"cypress_config_file": "cypress.json",
"build_name": "build-name",
"parallels": 1,
"specs": "./*.spec.js",
"ignore_files": "",
"npm_dependencies": {
"cypress": "6.1.0"
},
"feature_file_suppport": false
},
"tunnel_settings": {
"tunnel": false,
"tunnelName": null
}
}
info

Also in run-settings section you need to specify the path of your spec.js file on which you want to run the test on. Here we will pass the path of a sample to do spec.js file for our demo.

"specs": "./cypress/integration/1-getting-started/todo.spec.js"
Note

In this demo, all occurrences of http://localhost:8080 have been replaced with https://example.cypress.io to prevent running the Cypress tests locally. Alternatively, if you want to run your tests locally, refer to the Run locally section below.

Step-3: Execute your tests using the following command in the terminal:

lambdatest-cypress run

View Your Cypress Testing Results On LambdaTest Platform


As soon as the tests starts executing, you can view them running. Just visit your LambdaTest Automation Dashboard.

Image
info

For each test, you can view the live video feed, screenshots for each test run, console logs, terminal logs and do much more using the LambdaTest platform.

If the test gets executed successfully, you will see a green tick on the Timeline view and a "Completed" message on the Automation logs view of your Automation dashboard. If not, then you will see a red cross and a "Failed" message respectively.

Image

Running Your Cypress Tests Locally On LambdaTest Platform


To run your tests locally on the LambdaTest platform, you need to setup LambdaTest tunnel, and execute commands using the CLI, or Download UnderPass, our GUI based desktop app. Once you have the LambdaTest tunnel or Underpass set up and started, you can use the LambdaTest platform to run your Cypress tests locally.

Now you need to activate the tunnel capability in the lambdatest_config.json file under the section "connection_settings" as shown below:

lambdatest_config.json
  "connection_settings": {
"tunnel": true,
"tunnel_name": "lt-cypress-tunnel"
},

You can provide the name of the LambdaTest tunnel as per your requirements.

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles