Skip to main content

Getting Started With Uploading Screenshots through API for Visual Regression Testing

info

This is the guide to setup the version 2 of the SmartUI upload API.

Pre-requisites for running Smart UI

  • Basic understanding of HTTP APIs is required.
  • Go to LambdaTest SmartUI and login along with your credentials.
  • Copy LT_USERNAME and LT_ACCESS_KEY credentials from Access Key button on the top right of the dashboard.

The following steps will guide you in running your first Visual Regression test on LambdaTest SmartUI platform -

Create a SmartUI Project

To create a SmartUI Project, follow these steps:

  • Go to Projects page
  • Click on the new project button
  • Add name of the project, approvers for the changes found, tags for any filter or easy navigation.
  • Click on Submit.

Once, the project is created then you copy the Project Token from the application, here is a sample project token:

projectToken = "123456#1234abcd-****-****-****-************"

Upload screenshots via API

Once you have created a SmartUI Project, you can upload your local screenshots to the projects which will create a build.

Follow the below steps to upload screenshots -

Step 1: Copy the below API endpoint to your project.

API_URL="https://api.lambdatest.com/automation/smart-ui/v2/upload"
NOTE

For more information, please visit our API documentation.

Step 2: Add the following information to your API payload form-body:

VariableTypeDescriptionIs Mandatory?
filesarrayYou can add the path to the files which will be uploaded.
files : [ "path/to/file-1", ""path/to/file-2"]
True
projectTokenstringProject token needs to be specified to upload the files and validate the project .
projectToken:123456#1234abcd-****-****-****-************
True
buildNamestringName anything of your choice specified for the uploaded screenshots to a build.
buildName : #<Build_Name>
Optional
baselinebooleanAn option to make your build as a baseline build for comparison .
baseline : true/false
Optional
screenshotName new stringPass the unique screenshot name in order to compare it.Optional
NOTE

We only support the following formats: .png .jpeg .jpg

Please see the below screenshot for adding your screenshots which needs to be uploaded for your project to generate a build.

cmdcmd