Local Testing Using Playwright
TestMu AI tunnel feature lets you test private server URLs, locally hosted web apps, and websites on 3000+ real browsers and operating systems. On TestMu AI, you can test plain HTML, CSS, PHP, Python, and other similar web files saved locally. When connecting to corporate firewalls or proxy settings, no restrictions apply to the new TestMu AI tunnel binary. To establish a secure and unique tunnel connection between your system and TestMu AI cloud servers, the TestMu AI tunnel utilizes various protocols like Web Sockets, HTTPS, SSH(Secure Shell), etc.
Learn how to perform local testing using Playwright across 40+ real browsers and operating systems.
Playwright Testing Of Locally Hosted Websites
You can run Playwright testing of locally hosted websites and web apps via TestMu AI tunnel binary.
-
Clone the TestMu AI-Playwright repository on your system.
-
Install the npm dependencies.
npm install
- In order to run your Playwright tests, you will need to set your TestMu AI username and access key in the environment variables.
Windows
set LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
set LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
macOS/Linux
export LT_USERNAME="YOUR_LAMBDATEST_USERNAME"
export LT_ACCESS_KEY="YOUR_LAMBDATEST_ACCESS_KEY"
- To establish a tunnel connection between your local device and TestMu AI, download the binary file based on your OS.
-
Extract the downloaded binary file.
-
Navigate to the directory or folder where you extracted the binary file in the Command Prompt.
-
Run the below command in the terminal.
./LT --user {user's login email} --key {user's access key} --tunnelName {user's tunnel name}
- In desired capability, add the capability
tunnel: true.
If multiple tunnels are running, you can add tunnel and tunnel ID capabilities.
const { chromium } = require('playwright')
const { expect } = require('@playwright/test');
(async () => {
const capabilities = {
'browserName': 'Chrome', // Browsers allowed: `Chrome`, `MicrosoftEdge`, `pw-chromium`, `pw-firefox` and `pw-webkit`
'browserVersion': 'latest',
'LT:Options': {
'platform': 'Windows 10',
'build': 'Playwright Sample Build',
'name': 'Playwright Sample Test',
'user': process.env.LT_USERNAME,
'accessKey': process.env.LT_ACCESS_KEY,
'tunnel': false, // Add tunnel configuration if testing locally hosted webpage
'tunnelName': '' // Optional
}
}
You can view test reports for your local tests on the TestMu AI automation dashboard.
