Skip to content

Commit 3269f27

Browse files
JeeveshJ7JeeveshJ7
authored andcommitted
Figma App CLI
1 parent 05c6a98 commit 3269f27

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

docs/smartui-cli-figma-app.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
---
2+
id: smartui-cli-figma-app
3+
title: Getting started with LambdaTest's SmartUI Figma-App CLI
4+
sidebar_label: Figma-App CLI
5+
description: Learn how to compare your Figma mobile designs with native app screenshots on real devices using SmartUI CLI.
6+
keywords:
7+
- Visual Regression
8+
- Mobile App Visual Testing
9+
- Figma to App Comparison
10+
- SmartUI CLI
11+
- LambdaTest Mobile
12+
- Design to Production Validation
13+
url: https://www.lambdatest.com/support/docs/smartui-cli/
14+
slug: smartui-cli-figma-app/
15+
---
16+
17+
import Tabs from '@theme/Tabs';
18+
import TabItem from '@theme/TabItem';
19+
import CodeBlock from '@theme/CodeBlock';
20+
21+
---
22+
23+
24+
SmartUI Figma-App CLI allows you to validate your mobile app's implementation against Figma designs by comparing screenshots from real devices with your design files. This guide walks you through setting up and using the CLI to ensure design fidelity in your mobile app development.
25+
26+
---
27+
28+
## Prerequisites
29+
30+
- [ ] Node.js and npm installed
31+
- [ ] LambdaTest SmartUI account with App Automation Plan
32+
- [ ] Knowledge of [visual testing Native Apps](https://www.lambdatest.com/support/docs/appium-visual-regression/) with SmartUI
33+
- [ ] Figma Personal Access Token ([how to get one](https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens))
34+
35+
---
36+
37+
## Step-by-Step Guide
38+
39+
### 1. Create a SmartUI Project
40+
41+
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:
42+
43+
1. Go to [Projects page](https://smartui.lambdatest.com/)
44+
2. Click on the `new project` button
45+
3. Select the platform as <b>Real Devices</b> for executing your `App` tests.
46+
4. Add name of the project, approvers for the changes found, tags for any filter or easy navigation.
47+
5. Click on the **Submit**.
48+
49+
50+
### 2. Install SmartUI CLI
51+
52+
```bash
53+
npm install @lambdatest/smartui-cli
54+
```
55+
---
56+
57+
### 3. Create the Figma-App Configuration File
58+
59+
Generate a starter config:
60+
61+
```bash
62+
npx smartui config:create-figma-app designs.json
63+
```
64+
**Sample `designs.json`:**
65+
66+
```json title="/smartui-cli-figma-app/designs.json"
67+
{
68+
"mobile": [
69+
{
70+
"name": "Pixel 8",
71+
"platform": ["Android 14"],
72+
"orientation": "portrait"
73+
},
74+
{
75+
"name": "iPhone 15",
76+
"platform": ["iOS 16"],
77+
"orientation": "landscape"
78+
}
79+
],
80+
"figma": {
81+
"depth": 2,
82+
"configs": [
83+
{
84+
"figma_file_token": "<token>",
85+
"figma_ids": ["id-1", "id-2"],
86+
"screenshot_names": ["homepage", "about"]
87+
},
88+
{
89+
"figma_file_token": "<token>",
90+
"figma_ids": ["id-3", "id-4"],
91+
"screenshot_names": ["xyz", "abc"]
92+
}
93+
]
94+
}
95+
}
96+
```
97+
98+
#### Config Options:
99+
100+
| Key | Description | Required |
101+
|--------------------|----------------------------------------------------------------------------------------------|----------|
102+
| name | Device name | Yes |
103+
| platform | OS and version (e.g., `["Android 14"]`, `["iOS 16"]`) | Yes |
104+
| orientation | `portrait` or `landscape` (default: portrait) | No |
105+
| figma_file_token | Figma file token | Yes |
106+
| figma_ids | Array of Figma frame/artboard IDs to compare | Yes |
107+
| screenshot_names | Custom names for screenshots (must be unique within a build) | Yes |
108+
| depth | Figma tree depth (optional, default: all nodes) | No |
109+
110+
---
111+
:::note
112+
Please ensure that the platform and device name in your configuration matches the platform and device name in your App Automation tests for accurate comparisons. In case you are using regex `.*` to run tests in App Automation, the comparisons will not run correctly as random device allocation will not work in sync with Figma App CLI
113+
:::
114+
### 4. Set Up Environment Variables
115+
116+
#### Project Token
117+
118+
```bash
119+
export PROJECT_TOKEN="your_project_token"
120+
```
121+
122+
#### Figma Token
123+
124+
```bash
125+
export FIGMA_TOKEN="your_figma_token"
126+
```
127+
---
128+
129+
### 5. Run the Figma-to-App Comparison
130+
131+
```bash
132+
npx smartui upload-figma-app designs.json
133+
```
134+
135+
**Optional flags:**
136+
137+
- `--markBaseline` : Mark this build as the baseline for future comparisons
138+
- `--buildName "<Build_Name>"` : Assign a custom name to the build
139+
140+
**Example:**
141+
142+
```bash
143+
npx smartui upload-figma-app designs.json --buildName "v1.0.0-beta" --markBaseline
144+
```
145+
146+
---
147+
## Best Practices
148+
149+
- Use descriptive screenshot names for easy result navigation
150+
- Ensure Figma designs match device and platform for accurate comparison.
151+
- Validate device/OS availability in LambdaTest before running tests
152+
- Keep Figma frame IDs and tokens secure
153+
154+
---
155+
156+
## Advanced Usage
157+
158+
- **Multiple Devices:** Add as many device objects as needed in the `mobile` array
159+
- **Orientation:** Specify `orientation` per device for portrait/landscape testing
160+
- **CI Integration:** Add CLI commands to your CI pipeline for automated validation
161+
162+
---
163+
164+
## Additional Resources
165+
166+
- [Figma Personal Access Tokens](https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens)
167+
- [SmartUI CLI Documentation](https://www.lambdatest.com/support/docs/smartui-cli/)
168+
---
169+
170+
171+
**Ready to ensure your mobile app matches your Figma designs? Try SmartUI Figma-App CLI today!**

sidebars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,6 +2948,11 @@ module.exports = {
29482948
label: "Figma-Web",
29492949
id: "smartui-cli-figma-web",
29502950
},
2951+
{
2952+
type: "doc",
2953+
label: "Figma-App",
2954+
id: "smartui-cli-figma-app",
2955+
},
29512956
{
29522957
type: "doc",
29532958
label: "Figma-Figma",

0 commit comments

Comments
 (0)