For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

How to Run Cypress Tests on WebKit with TestMu AI


WebKit is a web browser engine based on KHTML that displays and interacts with web pages. It is open-source and used by many web browsers such as Apple's Safari. TestMu AI lets you perform Cypress testing on WebKit, Safari's browser engine, so you can see how your website will run in Safari. You do it by cloning the sample project, setting your credentials, configuring WebKit browsers in lambdatest-config.json, and running the test with the TestMu AI Cypress CLI.

Prerequisites​


Set up the following before you run the test so the CLI can authenticate and locate your project.

Sample repo

Clone the TestMu AI sample Cypress Cloud repo used in this document to follow along with the same files shown here. TestMu AI Cypress Cloud sample repository on GitHub View on GitHub

You can run Cypress tests on WebKit on the TestMu AI platform in a few simple steps.

  1. Clone the TestMu AI Cypress-Cloud GitHub repo and navigate to the cloned directory.
Verified
git clone https://github.com/LambdaTest/Cypress-Cloud.git
cd Cypress-Cloud
  1. To run Cypress tests on WebKit, set your TestMu AI username and access key in the environment variables. You can get them from the TestMu AI Automation Dashboard.

Windows

Verified
set LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
set LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"

macOS/Linux

Verified
export LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
  1. Install Node.js version 12 or higher. You can download it from the official Node.js website.

Running Your First Test in WebKit​


Follow these steps to run your first Cypress test on WebKit on the TestMu AI platform. The steps cover both Cypress v10 and Cypress v9 projects, so pick the tab that matches your setup as you go.

  1. Install the TestMu AI Cypress CLI using the below command.
Verified
npm install -g lambdatest-cypress-cli
  1. Clone the Cypress kitchen sink repo using the following command.
Verified
# Clone the kitchen sink repo
git clone https://github.com/cypress-io/cypress-example-kitchensink.git

# Go to the cloned directory
cd cypress-example-kitchensink

Once you clone the kitchen sink repo, below will be the structure of your Cypress project.

Verified
...
cypress
|-- fixtures
|-- e2e
|-- support
cypress.config.js
...
  1. Install the npm dependencies by passing the below command.
Verified
npm install
  1. Create the lambdatest-config.json file that contains configurations like auth, capabilities, and test settings needed to run successfully on TestMu AI.

Use init command to generate the sample configuration files.

Verified
lambdatest-cypress init

Once you run the above command, below is the project structure for the lambdatest-config.json file. Configure the browsers block for WebKit as shown here.

Verified
{
"lambdatest_auth": {
"username": "<Your LambdaTest username>",
"access_key": "<Your LambdaTest access key>"
},
"browsers": [
{
"browser": "Webkit",
"platform": "Windows 11",
"versions": [
"latest"
]
},
{
"browser": "Webkit",
"platform": "Windows 10",
"versions": [
"latest"
]
},
{
"browser": "Webkit",
"platform": "MacOS Monterey",
"versions": [
"latest"
]
},
{
"browser": "Webkit",
"platform": "MacOS Big sur",
"versions": [
"latest"
]
}
],
"run_settings": {
"cypress_config_file": "cypress.config.js",
"reporter_config_file": "base_reporter_config.json",
"build_name": "build-name",
"parallels": 1,
"specs": "./*.cy.js",
"ignore_files": "",
"network": false,
"headless": false,
"npm_dependencies": {
"cypress": "10.8.0",
"playwright-webkit": "^1.28.1",
"mochawesome": "7.0.1"
}
},
"tunnel_settings": {
"tunnel": false,
"tunnel_name": null
}
}
  1. Pass the below command to run the test.
Verified
lambdatest-cypress run
  1. Visit the TestMu AI Automation dashboard to view your test results. The CLI also prints a link to view the Cypress test build.

Testing Locally Hosted or Privately Hosted Projects​


To test locally hosted websites on the TestMu AI platform, set up the TestMu AI tunnel and run commands using the CLI, or use UnderPass, the TestMu AI GUI-based desktop app. Once the TestMu AI tunnel or UnderPass is set up and started, you can use Cypress to test locally hosted websites.

Next, activate the tunnel capability in the lambdatest-config.json file under the tunnel_settings section as shown below.

Verified
  "tunnel_settings": {
"tunnel": true,
"tunnel_name": "LT_Tunnel"
}

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

Limitations​


  • WebKit only supports the latest version.
  • The following dependencies must be in the lambdatest-config.json file.
Verified
"npm_dependencies": {
"cypress": "10.8.0",
"playwright-webkit": "^1.28.1"
}
  • Works only with Cypress v10.8.0.
  • Supported on Windows - 11 and 10, and macOS - Monterey and Big Sur.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles