In this 'Auto Healing in Selenium using LambdaTest' repo, we have covered the following use cases:
- Auto Healing of live document
- Auto Healing of document (under development)
The following websites are used for the purpose of demoing the use cases:
- LambdaTest E-commerce Playground Registration Page
- LambdaTest E-commerce Playground Product Page
- Demo Login Page created by Florin Pop
The Demo Login Page is hosted locally and run on port number 8080 (or any other port) that is currently free on the system.
For localhost testing, we need to start the tunnel. To do the same, download Underpass from LambdaTest to establish an SSH tunnel between the OS & LambdaTest cloud server(s).
Load the demo login page by triggering the php -S localhost:8080
command on the terminal.
Before running the tests on LambdaTest Selenium Grid, you need to set the environment variables - LT_USERNAME and LT_ACCESS_KEY. Here is how you can do the same:
Before the tests are run, please set the environment variables LT_USERNAME & LT_ACCESS_KEY from the terminal. The account details are available on your LambdaTest Profile page.
For macOS:
export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY
For Linux:
export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY
For Windows:
set LT_USERNAME=LT_USERNAME
set LT_ACCESS_KEY=LT_ACCESS_KEY
Also, add LT_USERNAME and LT_ACCESS_KEY in the set-env section in the Makefile
Run make set-env
to export the desired environment variables (i.e. LT_USERNAME and LT_ACCESS_KEY).
To start with, we run the tests (with original locators) by invoking make org-test
to execute tests that have locators that have not been modified during the development process. Hence, we will not observe any auto-healing of locators in this test execution cycle.
Test execution is triggered with all three tests running in parallel on LambdaTest Selenium Grid.
Shown below is the execution snapshot which indicates that the test execution was successful.
The test code with modified locators is present in AutoHealingTest.java Run the command make auto-heal
to execute the tests that have locators healed by the auto-healing algorithm.
As seen below, the test execution was successful. However, there is a small bandage icon (for indicating healed tests) next to the respective tests. This indicates that the tests are healed when potential failures are encountered during the course of test execution.
Navigate to the respective test in the LambdaTest dashboard and click on the Bandage icon to view details of the test.
For further reference, please visit Official Documentation of Auto Healing on LambdaTest
Feel free to fork the repo and contribute to make it better! Email to himanshu[dot]sheth[at]gmail[dot]com for any queries or ping me on the following social media sites:
LinkedIn: @hjsblogger
Twitter: @hjsblogger