I am running Cypress component tests for my React Project locally. However, I intend to run those tests on LambdaTest. Is it doable? If so, how?
Hey @GraceLynch
Thank you for reaching out.
You can run your React project on LambdaTest using HyperExecute.
Follow this detailed blog on Cypress Component testing using HyperExecute.
You can also use a simple React project from the Cypress GitHub Repository, specifically the “react-webpack5-js” example.
HyperExecute provides a pre-configured environment for faster testing. It supports Cypress, Selenium, Playwright, Appium, and multiple languages like Python, Java, C#, PHP, and Go.
You need to get the YAML file , this file must be created under your project root folder and within, you need to create matrix.yml with the following configuration:
---
version: 0.1
runson: ${matrix.os}
cypress: true
cypressOps:
Build: "[Matrix] Cypress Component Testing"
Tags: ["HYP-Cypress", "macOS", "Matrix", "Accessibility"]
BuildTags: ["HYP-Cypress-v10"]
pre:
- npm install
- npm install cypress --save-dev
- npm i lambdatest-cypress-cli
matrix:
os: [linux]
browser: ["chrome"]
files: ["Welcome.cy.js", "LoginForm.cy.js", "InputField.cy.js", "Button.cy.js"]
parallelism: 5
testSuites:
- npx cypress run --component --spec ./src/components/$files --browser=$browser --headed --config video=true
jobLabel: [cypress-v10, mac, matrix]
Download the HyperExecute CLI for your OS and place it in your project root. It reads the YAML configuration and uses your LambdaTest credentials.
Once your YAML is ready , Run this command in your terminal to upload and run your tests on HyperExecute:
./hyperexecute --config yaml/matrix.yml --force-clean-artifacts --download-artifacts --user <user_name> --key <access_key>