Run Cypress tests in Cross-browser Using the testing tool LambdaTest

How to run Cypress tests in Cross-browser Using the testing tool LambdaTest

KailashPathak
3 min readApr 24, 2022

Pre-Condition:

  • Cypress is already set up.
  • Some test cases are available to run in LambdaTest.
  • Users already sign up in LambdaTest

About LambdaTest

LambdaTest is a cloud-based cross-browser testing tool that allows you to perform cross-browser testing for web applications across multiple browsers, operating systems, and devices.

Step Up lambdatest for Cypress test case execution :

Step 1: Install the CLI

Install the LambdaTest using Cypress CLI command via npm.

LambdaTest’s command-line interface allows us to run your Cypress tests on LambdaTest.

npm install -g lambdatest-cypress-cli

Step 2: Generate lambdaTest.json

Under the root folder configure the browsers that we want to run the tests.

Use the init command to generate a sample lambdaTest.json file, or alternatively create one from scratch

Use below command

lambdatest-cypress init

In generated lambdatest.json file pass the below information

Fill required values in the sectionlambdatest_auth, browsers, run_settings lambdatest.json to run your tests

Under auth fill below data (*Enter user name / generated access_key) of your LambdaTest account

"lambdatest_auth": {"username": "XXXXXX","access_key": "XXXXX"},

username and access_key we can copy after login into the lambdatest platform

Under the browsers fill browser, os, version detail

"browsers": [{"browser": "Chrome","platform": "Windows 10","versions": ["latest-1"]},{"browser": "Firefox","platform": "Windows 10","versions": ["latest-1"]}],
Under run_settings fill below information"run_settings": {"cypress_config_file": "cypress.json","build_name": "Build 1.1.0","parallels": 1,"specs": "./cypress/integration/1-getting-started/*.spec.js","ignore_files": "","feature_file_suppport": false,"network": false,"headless": false,"reporter_config_file": "","npm_dependencies": {"cypress": "9.0.0"}},

Step 3: Run the cypress tests

Run the below command

lambdatest-cypress run --sync=true

Here we can see that once the test cases are executed in Firefox and Chrome successfully results will display in the terminal.

View Cypress Testing Result On LambdaTest Platform

As we run the above command (i.e lambdatest-cypress run — sync=true), test cases also start to run in the LambdaTest platform.

Below is the screenshot of the LambdaTest platform with a VIDEO of the test case.

Video is helpful during debugging in case any of the test cases fail.

Conclusion

LambdaTest is a cloud web and mobile testing platform to run test cases in multiple browsers, operating systems, and devices.

Reference

https://www.lambdatest.com/

--

--

KailashPathak

|| Cypress.io Ambassador || https://qaautomationlabs.com/blogs || PMI-ACP® |ITIL® || PRINCE2® || Cypress|| Selenium| WebdriverIO |API Automation QATube®