Grouping Screenshots through Build Names
SmartUI CLI allows you to group screenshots in a build name and append new screenshots to an existing build. This feature enables you to assign build names, add screenshots to existing builds and manage your visual tests efficiently.
Prerequisites
- Basic understanding of Command Line Interface
- Login to LambdaTest SmartUI with your credentials.
- Ensure you are using
@lambdatest/smartui-cli
version 4.0.14 or higher. - A properly configured SmartUI CLI project
Step 1: Install SmartUI CLI
If you haven't already installed SmartUI CLI, install it using npm:
npm i @lambdatest/smartui-cli
Step 2: Configure your Project Token
Setup your project token show in the SmartUI app after, creating your project.
- MacOS/Linux
- Windows - CMD
- Windows-PS
export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
set PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
$Env:PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
Step 3: Execute Tests with custom Build Names
You can add a custom build name by adding the --buildName
flag to your test execution command. Here are different ways to use this feature:
Custom Build Name (Expected Usage)
Specify a custom build name to group your screenshots in the following way:
npx smartui --config .smartui.json exec --buildName "Sample Build Name" -- <execution-command>
Example: For a
Node.js
test script :npx smartui --config .smartui.json exec --buildName "Sample Build Name" -- node test.js
Default Usage
If no buildname is specified, a random build name is added to the builds:
npx smartui --config .smartui.json exec -- <execution-command>
Step 4: Advanced Use Case
If you are running multiple test cases in a single job (e.g., using HyperExecute) and want to club all screenshots under a single build while maintaining consistent Git baseline management, you can do the following:
This can be done as follows:
npx smartui --config .smartui.json exec --buildName $env:JOB_ID -- node test.js
Key Benefits
- Efficient Grouping: Screenshots are grouped by build names, improving organization and traceability.
- Seamless Git Integration: Integrates smoothly with Git to maintain baseline integrity across branches.
- Flexible Updates: Allows appending screenshots to existing builds, enhancing adaptability.
- Optimized Workflows: Supports streamlined operations for both parallel and single-job executions.
Conclusion
This approach provides a structured and efficient way to manage visual tests:
- New Build for Each HyperExecute Job: A dedicated build is created for every HyperExecute job, ensuring clear separation and traceability.
- Consolidated Screenshot Grouping: Screenshots from all tests within the same job are appended to a single build for seamless organization.
- Uninterrupted Git Workflow: Git branching strategies remain unaffected, enabling robust baseline management across branches.