Skip to main content

Getting started with Lambdatest's Smart UI CLI


Welcome to the LambdaTest SmartUI CLI documentation!

With SmartUI CLI, you can seamlessly perform visual regression testing on the LambdaTest platform using your command line, identifying Visual UI Regression bugs effortlessly. This guide will walk you through the process of uploading and comparing images using the SmartUI CLI.

Prerequisites for running SmartUI CLI

  • Basic understanding of Command Line Interface is required.
  • Login to LambdaTest SmartUI with your credentials.

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

Create a SmartUI Web-Project

The first step is to create a project with the application in which we will combine all your builds run on the project. To create a SmartUI Project, follow these steps:

  1. Go to Projects page
  2. Click on the new project button
  3. Select the platform as CLI for executing your CLI tests.
  4. Add name of the project, approvers for the changes found, tags for any filter or easy navigation.
  5. Click on the Submit.

Steps to run your first test

Step 1: Install the Dependencies

Install required NPM modules for LambdaTest Smart UI CLI in your Frontend project.

npm install @lambdatest/smartui-cli

Step 2: Configure your Project Token

Setup your project token show in the SmartUI app after, creating your project.

export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
cmd

Step 3: Upload the required directory of images

npx smartui upload <directoryName> 

The screenshots in the directory name will be uploaded to SmartUI.

For ignoring the resolutions of the images

By default, SmartUI captures and considers image resolutions. If you prefer to ignore resolutions and compare images solely based on their names, use the following flag:

npx smartui upload <directoryName> --ignoreResolutions

SmartUI CLI Upload Options

Please read the following table for more information about the options available to upload a directory of static images to SmartUI.

Config Key ShortcutConfiguration Key    DescriptionUsage    
-R--ignoreResolutionsIgnores resolutions to compare only based on screenshot namesnpx smartui upload <directoryName> -R
-F--files extensionsComma-separated list of allowed file extensionsnpx smartui upload <directoryName> -F jpg,png
-E--removeExtensionsStrips file extensions from snapshot namesnpx smartui upload <directoryName> -E
-i--ignoreDir patternsComma-separated list of directories to ignorenpx smartui upload <directoryName> -i
note

You may use the smartui upload --help command in case you are facing issues during the execution of SmartUI Upload options in the CLI.

Setup with Continuous Integration (CI)

If you are using the Continuous Integration (CI) pipeline for your application and want to integrate SmartUI CLI execution then the following are the steps needs to be added to your .yaml file:

steps:
- name: Running SmartUI CLI Tests
- run: |
npm install @lambdatest/smartui-cli
npx playwright install-deps
npx smartui upload <Directory Name> --removeExtensions

SmartUI CLI Options and Keys

The following are supported CLI (Command Line Interface) options for Visual Regression Testing with SmartUI:

CLI Flag KeyDescriptionUsage
--configThis is the reference configuration file containing the SmartUI Cloud ConfigurationOptional
--helpThis will print all help information for the SmartUI CLI optionsOptional

View SmartUI Results

You can see the Smart UI dashboard to view the results. This will help you identify the Mismatches from the existing Baseline build and do the required visual testing.

cmd

For additional information about SmartUI APIs please explore the documentation here

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles