Getting Started with LambdaTest's SmartUI Figma-App CLI
SmartUI Figma-App CLI lets you compare mobile app screenshots captured on real devices with your Figma design frames to detect visual mismatches and ensure accurate implementation of mobile UI.
Prerequisites
- Node.js and npm installed
- LambdaTest SmartUI account with App Automation plan
- Real device screenshots captured via Appium, SDK, or SmartUI platform
- Figma Personal Access Token (how to get one)
Understanding Figma Tokens
| Token | Where It’s Used | Description |
|---|---|---|
FIGMA_TOKEN | Env Variable | Your Figma Personal Access Token to authenticate with the Figma API |
figma_file_token | designs.json | Figma file ID, extracted from the Figma file URL |
figma_ids | designs.json | List of frame or node IDs you want to compare visually |
Example Figma URL:
https://www.figma.com/file/abc12345/file-name?node-id=2417-58969
figma_file_token:abc12345figma_ids:2417-58969
Step-by-Step Guide
1. Create a SmartUI Project
- Visit smartui.lambdatest.com
- Click New Project
- Select Real Devices as the platform
- Enter:
- Project Name
- Approvers (optional)
- Tags (optional)
- Click Submit
2. Install SmartUI CLI
npm install @lambdatest/smartui-cli
3. Generate and Edit Configuration
Run the following to create your initial design file:
npx smartui config:create-figma-app designs.json
Sample designs.json
designs.json
{
"mobile": [
{
"name": "Pixel 8",
"platform": ["Android 14"],
"orientation": "portrait"
}
],
"figma": {
"depth": 2,
"configs": [
{
"figma_file_token": "abc12345",
"figma_ids": ["2417-58969"],
"screenshot_names": ["homepage"]
}
]
}
}
4. Set Environment Variables
export PROJECT_TOKEN="your_smartui_project_token"
export FIGMA_TOKEN="your_figma_personal_token"