Run a sample Percy build on Automate
Get hands-on experience on running BrowserStack Percy with BrowserStack Automate using our sample repository
Prerequisites
Before you start, ensure that you have:
- Installed Git and Node 14+ with npm
- The following, if your test scripts are in Java:
- TestNG v6.8+
- Java v8+
- Selenium v2.5+ (W3C/JSON Wire)
- Maven (installed, environment variables set, and bin added to the system path)
Run your Percy build on Automate
Export token
Create a Percy on Automate project and export the Percy token.
Set BrowserStack credentials
Get your BrowserStack credentials and update the sample script.
- Sign up with BrowserStack for a free trial or purchase a plan.
- Get your
username
andaccess key
from the BrowserStack profile page. - Use the
userName
andaccessKey
variables to set BrowserStack environment variables to authenticate your tests.
Alternatively, update USER_NAME
and ACCESS_KEY
in the test file.
Run the first build
Run your first Percy build on Automate by using the following command:
Your first Percy on Automate build is created. As this is the first build, no comparisons are available yet. You must approve the first build to have a base build for future comparisons.
The Percy screenshot command is used to capture screenshots in your Automate session. Refer to the tests mentioned in the git repository.
Modify the sample application
To modify the sample application, perform one of the following:
-
Directly run the
after_test.py
test file provided in the project using the run command in Step 4. In this case, you can skip Step 6 and directly visit the Automate and the Percy dashboards to see your functional and visual builds. -
Search for the below line in the test file and replace the @id=”1” to @id=”3”:
Commit changes
Commit the changes that you made to the sample application.
Run the second build
Follow Step 4 to generate your second build.
After the script execution is finished, the current build is compared to the previously approved build.
View results
Visit the Automate and the Percy dashboards to see your functional and visual builds.
Congratulations!
You’ve successfully run the sample Percy build. As you’ve seen, Percy helps you capture visual differences in your application that go undetected with functional testing alone.
This was just a sneak peek. Percy can do a lot more. To make the best out of it, integrate Percy with your test suite. To know more check out the related topics.
Related topic
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!