diff --git a/README.md b/README.md index ac7697f..063e467 100644 --- a/README.md +++ b/README.md @@ -1,373 +1,141 @@ -# TestCafe Integration With LambdaTest +# Run TestCafe Tests on TestMu AI (Formerly LambdaTest) -![TestCafe Integration With LambdaTest](https://cdn.lambdatest.com/support/docs/wp-content/uploads/2019/08/npm-testcafe-integration.jpg) +

+ Made by TestMu AI + npm version + Community +

-### Testcafe is a node.js tool to automate end-to-end web testing . +## Getting Started -Interesting part is that we don’t need an external driver to run end-to-end tests in the browser. Instead, the page can run all the test scripts that emulate user actions. This would allow for true cross-browser and cross-platform tests that run on any device that has a modern browser. +[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. -## Prerequisites for Testcafe +With TestMu AI (Formerly LambdaTest), you can run TestCafe end-to-end browser tests across real browsers and operating systems. This sample shows how to configure TestCafe tests to run on the TestMu AI cloud using the LambdaTest browser provider plugin. -1. Download Visual Studio code (IDE) for writing code script : [https://code.visualstudio.com/download](https://code.visualstudio.com/download) +- [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. -2.Node.js and Package Manager (npm) : Install Node.js from their [official website](https://nodejs.org/en/download/) Or Install -**Node:** js using command line. Go to the terminal or command prompt & run the below command. +### Prerequisites -`$ install node` +- [Node.js](https://nodejs.org/en/download/) (LTS version recommended) and npm +- [TestCafe](https://devexpress.github.io/testcafe/) installed globally: - To verify the node version - - ` $ node -v ` - -If node isn’t of the latest version then you can update it using the below command. - -`$ npm install npm@latest -g` - -3. Testcafe Package Module : npm to install Testcafe - -`$ npm init` - -Install the testcafe using npm - -`$ npm install -g testcafe` - -4. Install LambdaTest npm plugin For TestCafe - -`$ npm install testcafe-browser-provider-lambdatest` - -Get all available and supported configurations - -`$ testcafe -b lambdatest` - -5. LambdaTest Credentials - - * Set LambdaTest username and access key in environment variables. It can be obtained from LambdaTest dashboard -example: - -For linux/mac : - -`$export LT_USERNAME="YOUR_USERNAME" - $export LT_ACCESS_KEY="YOUR ACCESS KEY"` - - -For Windows: - -`$ set LT_USERNAME="YOUR_USERNAME" - $ set LT_ACCESS_KEY="YOUR ACCESS KEY"` - - -6. Install Dependencies - -`$ npm install` - -## 5.IDE setup - - **Step 1 :** After installation, Create a Folder in your local system to save all the projects. - - **Step 2 :** Install some essential extensions for javascript from ‘Extensions’ in VScode Editor like: - - * Code Runner - * JavaScript( ES6) code snippet - * ES Lint - -**Step 3 :** press ‘control+shift+P’---search for git:clone - -**Step 4 :**--paste the copied ( [https://github.com/LambdaTest/testcafe-sample.git](https://github.com/LambdaTest/testcafe-sample.git) ) repo -press ENTER and save testcafe project in the above created folder. - -**Step 5:** open testcafe project directory testcafe-sample in VScode. - -## Executing Testcafe Testing Script - -We will create a project directory named **testcafe-sample** and then we will create two files **page-model.js** and **test.js** in it. - -Finally, we will initialize our project by hitting the command **npm init**. This will create a **package.json** file in an interactive way, which will contain all our required project configurations. It will be required to execute our test script **test.js**. - -Here is the snapshot of **package.json** +```bash +npm install -g testcafe +``` - ```javascript - { - "name": "testcafe-sample", - "version": "1.0.0", - "description": "TestCafe API Sample", - "main": "test.js", - "scripts": { - "test": "testcafe all test.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/LambdaTest/testcafe-sample.git" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/LambdaTest/testcafe-sample/issues" - }, - "homepage": "https://github.com/LambdaTest/testcafe-sample#readme", - "devDependencies": { - "testcafe": "*" - }, - "dependencies": { - "testcafe-browser-provider-lambdatest": "^2.0.1" - } -} +- LambdaTest npm plugin for TestCafe: - ``` +```bash +npm install testcafe-browser-provider-lambdatest +``` -## Test Scenario +- A TestMu AI (Formerly LambdaTest) account — [sign up here](https://www.testmuai.com/register/) -In the Demonstration,we will be creating a script to launch a web application and perform various actions on the webpage like : -‘Text typing basics','Click an array of labels and then check their states','Moving the slider',Dealing with text using keyboard','Dealing with text using selection''Handle native confirmation dialog', 'Pick option from select', 'Filling a form' -on the webpage ,and will be using assertions to verify the test cases. If assert returns true, the test cases pass successfully and show up in the automation logs dashboard, else if assert returns false, the test case fails, and the errors will be displayed in the automation log. +### Setup -Single Test- On a single environment (Windows 10) and single browser (Chrome) +Clone the repository: -For this, -create one **page-model.js** file with a Selector function imported from the testcafe module which will identify webpage elements in the test and inspect elements stated on the page. +```bash +git clone https://github.com/LambdaTest/testcafe-sample.git +cd testcafe-sample +``` -Let’s have a look on this file. +Install project dependencies: +```bash +npm install ``` -import { Selector } from 'testcafe'; - -const label = Selector('label'); - -class Feature { - constructor (text) { - this.label = label.withText(text); - this.checkbox = this.label.find('input[type=checkbox]'); - } -} - -export default class Page { - constructor () { - this.nameInput = Selector('#developer-name'); - this.triedTestCafeCheckbox = Selector('#tried-test-cafe'); - this.populateButton = Selector('#populate'); - this.submitButton = Selector('#submit-button'); - this.results = Selector('.result-content'); - this.macOSRadioButton = Selector('input[type=radio][value=MacOS]'); - this.commentsTextArea = Selector('#comments'); - - this.featureList = [ - new Feature('Support for testing on remote devices'), - new Feature('Re-using existing JavaScript code for testing'), - new Feature('Easy embedding into a Continuous integration system') - ]; - - this.slider = { - handle: Selector('.ui-slider-handle'), - tick: Selector('.slider-value') - }; - - this.interfaceSelect = Selector('#preferred-interface'); - this.interfaceSelectOption = this.interfaceSelect.find('option'); - } -} -``` +Set your TestMu AI credentials as environment variables: -Now, create one **test.js** file to execute the test cases. For This, TestCafe must be organized in the form of Fixture(can also have more than one Fixture in the Testcafe test) , multiple test functions with test controller object **‘t’** which exposes the test API's methods. Here is ,,**test.js** file that imports above page-model.js -Let's have a look at **test.js** script. - -```JavaScript -import Page from './page-model'; - -fixture `A set of examples that illustrate how to use TestCafe API` - .page `https://devexpress.github.io/testcafe/example/`; - -// Page model -const page = new Page(); - -// Tests -test('Text typing basics', async t => { - await t - .typeText(page.nameInput, 'Peter') // Type name - .typeText(page.nameInput, 'Paker', { replace: true }) // Replace with last name - .typeText(page.nameInput, 'r', { caretPos: 2 }) // Correct last name - .expect(page.nameInput.value).eql('Parker'); // Check result -}); - - -test('Click an array of labels and then check their states', async t => { - for (const feature of page.featureList) { - await t - .click(feature.label) - .expect(feature.checkbox.checked).ok(); - } -}); - - -test('Dealing with text using keyboard', async t => { - await t - .typeText(page.nameInput, 'Peter Parker') // Type name - .click(page.nameInput, { caretPos: 5 }) // Move caret position - .pressKey('backspace') // Erase a character - .expect(page.nameInput.value).eql('Pete Parker') // Check result - .pressKey('home right . delete delete delete') // Pick even shorter form for name - .expect(page.nameInput.value).eql('P. Parker'); // Check result -}); - - -test('Moving the slider', async t => { - const initialOffset = await page.slider.handle.offsetLeft; - - await t - .click(page.triedTestCafeCheckbox) - .dragToElement(page.slider.handle, page.slider.tick.withText('9')) - .expect(page.slider.handle.offsetLeft).gt(initialOffset); -}); - - -test('Dealing with text using selection', async t => { - await t - .typeText(page.nameInput, 'Test Cafe') - .selectText(page.nameInput, 7, 1) - .pressKey('delete') - .expect(page.nameInput.value).eql('Tfe'); // Check result -}); - - -test('Handle native confirmation dialog', async t => { - await t - .setNativeDialogHandler(() => true) - .click(page.populateButton); - - const dialogHistory = await t.getNativeDialogHistory(); - - await t.expect(dialogHistory[0].text).eql('Reset information before proceeding?'); - - await t - .click(page.submitButton) - .expect(page.results.innerText).contains('Peter Parker'); -}); - - -test('Pick option from select', async t => { - await t - .click(page.interfaceSelect) - .click(page.interfaceSelectOption.withText('Both')) - .expect(page.interfaceSelect.value).eql('Both'); -}); - - -test('Filling a form', async t => { - // Fill some basic fields - await t - .typeText(page.nameInput, 'Bruce Wayne') - .click(page.macOSRadioButton) - .click(page.triedTestCafeCheckbox); - - // Let's leave a comment... - await t - .typeText(page.commentsTextArea, "It's...") - .wait(500) - .typeText(page.commentsTextArea, '\ngood'); - - // I guess, I've changed my mind - await t - .wait(500) - .selectTextAreaContent(page.commentsTextArea, 1, 0) - .pressKey('delete') - .typeText(page.commentsTextArea, 'awesome!!!'); - - // Let's submit our form - await t - .wait(500) - .click(page.submitButton) - .expect(page.results.innerText).contains('Bruce Wayne'); -}); +**Linux/macOS:** +```bash +export LT_USERNAME="YOUR_USERNAME" +export LT_ACCESS_KEY="YOUR_ACCESS_KEY" ``` -We are all set with the script structure, and now need to run the **test.js** file from the terminal or command prompt to initiate the test on the LambdaTest platform . +**Windows:** +```bash +set LT_USERNAME="YOUR_USERNAME" +set LT_ACCESS_KEY="YOUR_ACCESS_KEY" +``` -### Running the Test : +### Run tests -1. In the terminal,Go to the Directory location: cd testcafe-sample +Run a single test on a specific browser and OS: -2. Set your Username and Accesskey +```bash +testcafe "lambdatest:Chrome@85.0:Windows 10" "test.js" +``` -Here is the snapshot for above steps: +Run parallel tests on the same configuration (use `-c N` for N parallel sessions): +```bash +testcafe -c 2 "lambdatest:Chrome@102.0:Windows 10" "test.js" ``` -C:\Users\Admin\Desktop\vscode\testcafe-sample> set LT_USERNAME= shwetas -C:\Users\Admin\Desktop\vscode\testcafe-sample>set LT_ACCESS_KEY= 5657878ghyg +Run parallel tests on multiple configurations: + +```bash +testcafe "lambdatest:Chrome@102.0:Windows 10","lambdatest:Firefox@102.0:Windows 8.1","lambdatest:Chrome@101.0:macOS Mojave" "test.js" ``` -Now it’s time to enter the command for executing the test on desired configuration +List all available browser configurations: +```bash +testcafe -b lambdatest ``` -C:\Users\Admin\Desktop\vscode\testcafe-sample>testcafe "lambdatest:Chrome @85.0:Windows 10" "test.js" -``` -Tunnel established connection internally after authentication of credentials: -![](https://www.lambdatest.com/blog/wp-content/uploads/2020/04/test2.png) +### Local testing with TestMu AI Tunnel -Assertions passed and the test succeeded. +To test locally hosted apps, set up the TestMu AI tunnel. OS-specific guides: -![](https://www.lambdatest.com/blog/wp-content/uploads/2020/04/test3.png) +- [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/) -## Parallel Testing for Testcafe JavaScript +Once the tunnel is running, the `testcafe-browser-provider-lambdatest` plugin routes traffic through it automatically when tunnel capabilities are set. -`For 2 parallel tests with same configurations` +## Contributions -For running 2 parallel on same configuration-: add flag -c 2 - Here c 2( concurrency 2) signifies you are running 2 parallel tests on same configuration +Contributions are welcome. Open an issue to discuss your idea before submitting a pull request. When reporting bugs, include your Node.js version, OS, and Angular CLI version. -``` -C:\Users\Admin\Desktop\vscode\testcafe-sample>testcafe -c 2 "lambdatest:Chrome @102.0:Windows 10" "test.js" -``` +## TestMu AI (Formerly LambdaTest) Community -Similarly you can run N number of tests in parallel tests on same configuration( N depends upon the plan subscription) +Connect with testers and developers in the [TestMu AI Community](https://community.testmuai.com/). Ask questions, share what you are building, and discuss best practices in test automation and DevOps. + +## TestMu AI (Formerly LambdaTest) Certifications -**Note:** The total parallel sessions should be less than or equals to the subscribed plan. - - For parallel tests on different configurations: - - ``` - C:\Users\Admin\Desktop\vscode\testcafe-sample>testcafe "lambdatest:Chrome@102.0:Windows 10","lambdatest:Firefox@102.0:Windows 8.1","lambdatest:Chrome@101.0:macOS Mojave" "test.js" -``` +Earn free [TestMu AI Certifications](https://www.testmuai.com/certifications/) for testers, developers, and QA engineers. Validate your skills in Selenium, Cypress, Playwright, Appium, Espresso and more. Industry-recognized, shareable on LinkedIn, and built by practitioners, not marketers. -Tunnel established connection internally after authentication of credentials: +## Learning Resources by TestMu AI (Formerly LambdaTest) -![](https://www.lambdatest.com/blog/wp-content/uploads/2020/04/test7.png) +Learn modern testing through tutorials, guides, videos, and weekly updates: -All the parallel tests initiated simultaneously on the Lambdatest platform in Running state. -Here is the snapshot +* [TestMu AI Blog](https://www.testmuai.com/blog/) +* [TestMu AI Learning Hub](https://www.testmuai.com/learning-hub/) +* [TestMu AI on YouTube](https://www.youtube.com/@TestMuAI) +* [TestMu AI Newsletter](https://www.testmuai.com/newsletter/) + +## LambdaTest is Now TestMu AI -![](https://www.lambdatest.com/blog/wp-content/uploads/2020/04/test8.png) +On **January 12, 2026**, [LambdaTest evolved to TestMu AI](https://www.testmuai.com/lambdatest-is-now-testmuai/), the world's first fully autonomous **Agentic AI Quality Engineering Platform**. -After completion of all test cases in all the parallel tests , assertions passed and test executed successfully on .With the video provided for each test , test cases would be verified. +Same team. Same infrastructure. Same customer accounts. All existing LambdaTest logins, scripts, capabilities, and integrations continue to work without change. -**Additional Configuration Parameters:** +ð Find the new home for [LambdaTest](https://www.testmuai.com). -Set values to below variables if required , +### How LambdaTest Evolved into TestMu AI -Values | ------------- | - LT_TEST_NAME | -LT_BUILD | -LT_CAPABILITY_PATH | -LT_RESOLUTION | -LT_LOGFILE | -LT_VERBOSE | -LT_PROXY_HOST | -LT_PROXY_PORT | -LT_PROXY_USER | -LT_DIR | -LT_SELENIUM_VERSION | +In 2017, we launched LambdaTest with a simple mission: make testing fast, reliable, and accessible. As LambdaTest grew, we expanded into Test Intelligence, Visual Regression Testing, Accessibility Testing, API Testing, and Performance Testing, covering the full depth of the testing lifecycle. -Assign flag as true or false to below variables if required: +As software development entered the AI era, testing had to evolve, too. We rebuilt the architecture to be AI-native from the ground up, with autonomous agents that **plan, author, execute, analyze, and optimize tests** while keeping humans in the loop. The platform integrates with your repos, CI, IDEs, and terminals, continuously learning from every code change and development signal. -variables | ------------- | - LT_CONSOLE | -LT_NETWORK | -LT_VIDEO | -LT_SCREENSHOT | -LT_TIMEZONE | +That evolution earned a new name: **TestMu AI**, built for an AI-first future of quality engineering. TestMu is not a new name for us. It is the name of our annual community conference, which has brought together 100,000+ quality engineers to discuss how AI would reshape testing, long before that became an industry norm. +What started as a high-performance cloud testing platform has transformed into an AI-native, multi-agent system powering a connected, end-to-end quality layer. That evolution defined a new identity: LambdaTest evolved into TestMu AI, built for an AI-first future of quality engineering. -## About LambdaTest +## Support -[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel. +Got a question? Email [support@testmuai.com](mailto:support@testmuai.com) or chat with us 24x7 from our chat portal.