Skip to content

Commit dbdac39

Browse files
authored
Merge pull request #1428 from JeeveshJ7/stage
Documentation for SmartUI Capabilities, App SDK and Exec command
2 parents 59626bc + e96f72a commit dbdac39

File tree

7 files changed

+571
-6
lines changed

7 files changed

+571
-6
lines changed

docs/appium-visual-regression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: appium-visual-regression
33
title: Getting Started With Visual Regression Testing Using Appium On SmartUI Real Devices (NodeJS)
4-
sidebar_label: Appium
4+
sidebar_label: Appium Hooks
55
description: Explore our Appium Visual Regression support documentation for step-by-step guidance! Conduct visual testing, manage apps, and ensure your mobile apps are flawless before launch.
66
keywords:
77
- Visual Regression

docs/smartui-app-sdk.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
---
2+
id: smartui-app-sdk
3+
title: SmartUI App SDK Integration Guide
4+
sidebar_label: Appium Java SDK
5+
description: Learn how to integrate SmartUI App SDK with your existing mobile app testing framework to perform visual regression testing on any cloud provider.
6+
keywords:
7+
- Visual Regression
8+
- Visual Regression Testing Guide
9+
- Visual Regression Test Automation
10+
- Visual Regression Automation Testing
11+
- Running Visual Regression Tests
12+
- Visual Regression Testing Online
13+
- Run Visual Regression
14+
- Visual Regression Run Specific Test
15+
- Visual Regression Testing Environment
16+
- How to Run Visual Regression Tests
17+
- Mobile App Testing
18+
- App Visual Testing
19+
20+
url: https://www.lambdatest.com/support/docs/smartui-app-sdk/
21+
slug: smartui-app-sdk/
22+
---
23+
24+
import Tabs from '@theme/Tabs';
25+
import TabItem from '@theme/TabItem';
26+
import NewTag from '../src/component/newTag';
27+
28+
---
29+
30+
<script type="application/ld+json"
31+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
32+
"@context": "https://schema.org",
33+
"@type": "BreadcrumbList",
34+
"itemListElement": [{
35+
"@type": "ListItem",
36+
"position": 1,
37+
"name": "LambdaTest",
38+
"item": "https://www.lambdatest.com"
39+
},{
40+
"@type": "ListItem",
41+
"position": 2,
42+
"name": "Support",
43+
"item": "https://www.lambdatest.com/support/docs/"
44+
},{
45+
"@type": "ListItem",
46+
"position": 3,
47+
"name": "Smart Visual Testing",
48+
"item": "https://www.lambdatest.com/support/docs/smartui-app-sdk/"
49+
}]
50+
})
51+
}}
52+
></script>
53+
54+
SmartUI App SDK enables you to perform visual regression testing on your mobile applications using any cloud testing provider. This guide will help you integrate SmartUI App SDK with your existing mobile app testing framework.
55+
56+
## Prerequisites
57+
58+
- Basic understanding of mobile app testing and Appium
59+
- Login to [LambdaTest SmartUI](https://smartui.lambdatest.com/) with your credentials
60+
- An active [subscription](https://www.lambdatest.com/pricing) plan with valid screenshots limit
61+
62+
## Create a SmartUI Project
63+
64+
The first step is to create a project that will contain all your builds. To create a SmartUI Project:
65+
66+
1. Go to [Projects page](https://smartui.lambdatest.com/)
67+
2. Click on the `new project` button
68+
3. Select the platform as <b>CLI</b> for executing your `SDK` tests
69+
4. Add name of the project, approvers for the changes found, and tags for filtering
70+
5. Click on **Submit**
71+
72+
## Steps to Run Your First Test
73+
74+
### Step 1: Add the SmartUI SDK Dependency
75+
76+
Add the following dependency to your `pom.xml` file:
77+
78+
```xml
79+
<dependency>
80+
<groupId>io.github.lambdatest</groupId>
81+
<artifactId>lambdatest-java-sdk</artifactId>
82+
<version>1.0.8</version>
83+
</dependency>
84+
```
85+
86+
### Step 2: Configure Your Project Token
87+
88+
You can configure your project token in one of two ways:
89+
90+
1. **Using Environment Variables**:
91+
92+
<Tabs className="docs__val" groupId="language">
93+
<TabItem value="MacOS/Linux" label="MacOS/Linux" default>
94+
95+
```bash
96+
export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
97+
```
98+
99+
</TabItem>
100+
<TabItem value="Windows" label="Windows - CMD">
101+
102+
```bash
103+
set PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
104+
```
105+
106+
</TabItem>
107+
</Tabs>
108+
109+
2. **Directly in the Configuration**:
110+
You can pass the project token directly in your test configuration as shown in Step 3.
111+
112+
### Step 3: Integrate SmartUI in Your Test Script
113+
114+
Import the required SmartUI class and add the screenshot capture code where needed:
115+
116+
```java
117+
import io.github.lambdatest.SmartUIAppSnapshot;
118+
119+
public class YourTestClass {
120+
@Test
121+
public void testMethod() {
122+
// Initialize SmartUI
123+
SmartUIAppSnapshot SmartUI = new SmartUIAppSnapshot();
124+
125+
// Configure screenshot settings
126+
Map<String, String> ssConfig = new HashMap<>();
127+
// Either use environment variable
128+
// ssConfig.put("projectToken", "your-project-token-here"); // Use this if you are not setting the project token in environment variable
129+
ssConfig.put("deviceName", "iPhone 15"); // Required, you can use the variables that you are setting in the cloud capabilities
130+
ssConfig.put("buildName", "First Build"); // Optional
131+
ssConfig.put("platform", "iOS"); // Optional,you can use the variables that you are setting in the cloud capabilities
132+
133+
try {
134+
// Start SmartUI session
135+
SmartUI.start(ssConfig);
136+
137+
// Your test code here
138+
// Your test code here - Example of native app interactions
139+
driver.findElement(MobileBy.AccessibilityId("username-input")).sendKeys("[email protected]");
140+
driver.findElement(MobileBy.AccessibilityId("password-input")).sendKeys("password123");
141+
142+
// Take screenshot of login form
143+
SmartUI.smartuiAppSnapshot(driver, "Login Form", ssConfig);
144+
145+
driver.findElement(MobileBy.AccessibilityId("login-button")).click();
146+
147+
// Wait for home screen to load
148+
WebDriverWait wait = new WebDriverWait(driver, 10);
149+
wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("home-screen")));
150+
151+
// Take screenshot of home screen
152+
SmartUI.smartuiAppSnapshot(driver, "Home Screen", ssConfig);
153+
154+
// More test steps...
155+
156+
} finally {
157+
// Stop SmartUI session
158+
SmartUI.stop();
159+
}
160+
}
161+
}
162+
```
163+
164+
### Step 4: Execute the Tests
165+
166+
Run your tests as you normally would with your cloud provider. SmartUI will automatically capture and process the screenshots for visual regression testing.
167+
168+
```bash
169+
mvn test
170+
```
171+
172+
## Configuration Options
173+
174+
### Screenshot Configuration Options
175+
176+
| Key | Description | Required |
177+
|-----|-------------|----------|
178+
| projectToken | Your SmartUI project token | Yes |
179+
| deviceName | Name of the device being tested | Yes |
180+
| buildName | Custom name for your build | No |
181+
| platform | Platform being tested (iOS/Android) | No |
182+
183+
### Supported Platforms and Devices
184+
185+
The `deviceName` and `platform` parameters in SmartUI App SDK are used as metadata to ensure consistent screenshot comparison across builds. You can use any device name and platform that matches your cloud provider's capabilities:
186+
187+
```java
188+
ssConfig.put("deviceName", "iPhone 15");
189+
ssConfig.put("platform", "iOS");
190+
```
191+
192+
#### Important Notes:
193+
- It is adviced to use the same `deviceName` and `platform` combination across builds to compare screenshots of the same device
194+
- These parameters are metadata tags and don't affect the actual device selection on your cloud provider
195+
196+
Example configurations for different cloud providers:
197+
198+
```java
199+
// For an iOS test on LambdaTest
200+
ssConfig.put("deviceName", "iPhone 12");
201+
ssConfig.put("platform", "iOS");
202+
203+
// For an Android test on BrowserStack
204+
ssConfig.put("deviceName", "Samsung Galaxy S22");
205+
ssConfig.put("platform", "Android");
206+
207+
// For a custom device on any cloud provider
208+
ssConfig.put("deviceName", "Custom Device Name"); // Use the same name consistently
209+
ssConfig.put("platform", "iOS/Android"); // Use the actual platform
210+
```
211+
212+
:::note
213+
The device name and platform you specify here are used only for screenshot organization and comparison. The actual device selection is handled by your cloud provider's capabilities configuration.
214+
:::
215+
216+
## View SmartUI Results
217+
218+
After test execution, visit your SmartUI project dashboard to:
219+
220+
1. View all captured screenshots
221+
2. Compare against baseline images
222+
3. Identify visual regressions
223+
4. Approve or reject changes
224+
5. Manage baseline images
225+
226+
<img loading="lazy" src={require('../assets/images/smart-visual-testing/smartui-sdk-results-primer.webp').default} alt="SmartUI Results" width="768" height="373" className="doc_img"/>
227+
228+
For additional information about SmartUI APIs, please explore the documentation [here](https://www.lambdatest.com/support/api-doc/)
229+
230+
<nav aria-label="breadcrumbs">
231+
<ul className="breadcrumbs">
232+
<li className="breadcrumbs__item">
233+
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com">
234+
Home
235+
</a>
236+
</li>
237+
<li className="breadcrumbs__item">
238+
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/">
239+
Support
240+
</a>
241+
</li>
242+
<li className="breadcrumbs__item breadcrumbs__item--active">
243+
<span className="breadcrumbs__link">SmartUI App SDK</span>
244+
</li>
245+
</ul>
246+
</nav>

docs/smartui-cli-env-variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ In case you are accessing your network using corporate proxies, set the proxies
152152
<TabItem value="MacOS/Linux" label="MacOS/Linux" default>
153153

154154
```bash
155-
export HTTP_PROXY="Required branch"
155+
export HTTP_PROXY="http://<username>:<password>@<domain.com>:<port>/"
156156
```
157157
</TabItem>
158158
<TabItem value="Windows" label="Windows" default>
159159

160160
```bash
161-
set HTTP_PROXY="Required branch"
161+
set HTTP_PROXY="http://<username>:<password>@<domain.com>:<port>/"
162162
```
163163
</TabItem>
164164

0 commit comments

Comments
 (0)