diff --git a/README.md b/README.md index 32d74ee..d9a96b9 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,115 @@ -# smartui-playwright-sample -# LambdaTest SmartUI Playwright Sample +# Run SmartUI Visual Tests with Playwright on TestMu AI (Formerly LambdaTest) -This project demonstrates how to use playwright and LambdaTest together to run automated tests on the LambdaTest platform. +
-## Setup +## Getting Started -First, clone this repository to your local machine. +[TestMu AI](https://www.testmuai.com/) (Formerly LambdaTest) is the world's first full-stack AI Agentic Quality Engineering platform that empowers teams to test intelligently, smarter, and ship faster. Built for scale, it offers a full-stack testing cloud with 10K+ real devices and 3,000+ browsers. With AI-native test management, MCP servers, and agent-based automation, TestMu AI supports Selenium, Appium, Playwright, and all major frameworks. + +With TestMu AI (Formerly LambdaTest), you can run SmartUI visual regression tests with Playwright on real browsers. This sample shows how to configure Playwright + SmartUI to run on the TestMu AI cloud. + +- [Sign up on TestMu AI](https://www.testmuai.com/register/) (Formerly LambdaTest). +- Follow the [TestMu AI Documentation](https://www.testmuai.com/support/docs/) for the full setup walkthrough. + +### Prerequisites + +- Node.js and npm (latest stable) +- A TestMu AI (Formerly LambdaTest) account with your username and access key + +### Setup + +Clone and install dependencies: + +```bash +git clone https://github.com/LambdaTest/smartui-playwright-sample && cd smartui-playwright-sample +npm i +``` + +Set your credentials as environment variables. + +**macOS / Linux:** ```bash -git clone https://github.com/LambdaTest/smartui-playwright-sample.git -cd smartui-playwright-sample +export LT_USERNAME="YOUR_USERNAME" +export LT_ACCESS_KEY="YOUR_ACCESS_KEY" +export LT_TUNNEL="YOUR_TUNNEL_NAME" +export PROJECT_TOKEN="YOUR_PROJECT_TOKEN" ``` -Next, install the necessary dependencies: +**Windows:** ```bash -npm i +set LT_USERNAME="YOUR_USERNAME" +set LT_ACCESS_KEY="YOUR_ACCESS_KEY" +set LT_TUNNEL="YOUR_TUNNEL_NAME" +set PROJECT_TOKEN="YOUR_PROJECT_TOKEN" ``` -You'll need to set your LambdaTest username and access key as environment variables. They can be found on your LambdaTest profile. +### Run tests ```bash -export LT_USERNAME="Your LambdaTest Username" -export LT_ACCESS_KEY="Your LambdaTest Access Key" +node playwright-smartui.js ``` -## About the Test +View results on your TestMu AI dashboard. -The test navigates to the LambdaTest homepage and checks the page title. After the title check, it will take a full-page screenshot for visual regression testing. +### Local testing with TestMu AI Tunnel -## About SmartUI Webhook +To test locally hosted apps, set up the TestMu AI tunnel. OS-specific guides: -LambdaTest's SmartUI uses a webhook to call the `smartui.takeScreenshot` function. This function captures a screenshot of the full page and uses it for visual regression testing. The function is called using the `page.evaluate` method with the `lambdatest_action` parameter. +- [Local Testing on Windows](https://www.testmuai.com/support/docs/local-testing-for-windows/) +- [Local Testing on macOS](https://www.testmuai.com/support/docs/local-testing-for-macos/) +- [Local Testing on Linux](https://www.testmuai.com/support/docs/local-testing-for-linux/) -Here's an example of how to use the `smartui.takeScreenshot` function: +Add the following to your capabilities: -```javascript -await page.evaluate((_) => {}, - `lambdatest_action: ${JSON.stringify({ action: 'smartui.takeScreenshot', arguments: { fullPage: true, screenshotName: '