Skip to content

Commit 9f74d0d

Browse files
authored
Merge pull request #1556 from JeeveshJ7/stage
Auto tunneling support doc
2 parents f987c3d + 0630bd9 commit 9f74d0d

File tree

2 files changed

+113
-40
lines changed

2 files changed

+113
-40
lines changed

docs/smartui-layout-comparison.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('Layout Structure Test', () => {
182182

183183
// Configure options to focus only on layout structure
184184
let options = {
185-
ignoreType: "layout"
185+
ignoreType: ["layout"]
186186
};
187187

188188
// Take screenshot with layout comparison

docs/smartui-sdk-tunnel.md

Lines changed: 112 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: smartui-sdk-tunnel
3-
title: Using LambdaTest Tunnel with SmartUI SDKs
3+
title: Using LambdaTest Tunnel with SmartUI SDK
44
sidebar_label: Tunnel Configuration
55
description: Learn how to use LambdaTest Tunnel with SmartUI SDK for testing internal, development, and staging environments
66
keywords:
@@ -15,75 +15,148 @@ slug: smartui-sdk-tunnel/
1515

1616
# Using LambdaTest Tunnel with SmartUI SDK
1717

18-
LambdaTest Tunnel allows you to test your internal, development, or staging environments securely using SmartUI SDK. This guide explains how to configure and use LambdaTest Tunnel with SmartUI SDK.
18+
LambdaTest Tunnel enables secure testing of your local, development, or privately hosted environments using SmartUI SDK. This guide explains how to configure and use LambdaTest Tunnel with SmartUI SDK.
1919

2020
:::warning Important
21-
Tunnel configuration is only supported with the `exec` mode of SmartUI SDK. It is not compatible with `capture`, `upload`, or `figma` commands. For more information about exec mode, refer to our [SmartUI CLI Exec documentation](/support/docs/smartui-cli-exec/).
21+
Tunnel configuration is only supported with the `exec` mode of SmartUI SDK. It is not compatible with
22+
`capture`, `upload`, or `figma` commands. For more information about exec mode, refer to our [SmartUI CLI Exec
23+
documentation](/support/docs/smartui-cli-exec/).
2224
:::
2325

2426
## Prerequisites
2527

26-
1. The tunnel should be started by the same user who created the SmartUI project
27-
2. The tunnel must remain active throughout the entire SmartUI execution steps, from authentication to build completion
28+
- Working knowledge of npm CLI commands
29+
- Understanding of tunneling concepts for local testing
30+
- Valid LambdaTest credentials (username and access key)
31+
- Familiarity with SmartUI CLI configuration files
32+
- SmartUI CLI installed and configured
2833

29-
## Configuration
34+
## Configuration Options
3035

31-
To enable tunnel testing with SmartUI SDK, add the following configuration to your `.smartui.json` file:
36+
LambdaTest Tunnel supports two configuration modes:
37+
38+
### 1. Automatic Tunnel Configuration
39+
40+
For automatic tunnel setup, add the following configuration to your `.smartui.json` file:
3241

3342
```json
3443
{
35-
"tunnel": true,
36-
"tunnelName": "my-tunnel"
44+
"tunnel": {
45+
"type": "auto",
46+
"user": "<lambdatest-user>", // Optional: Overrides LT_USERNAME if present in env
47+
"key": "<lambdatest-accesskey>", // Optional: Overrides LT_ACCESS_KEY if present in env
48+
"port": "<port>", // Optional: Default port if not specified
49+
"proxyHost": "127.0.0.1", // Optional
50+
"proxyPort": "8000", // Optional
51+
"proxyUser": "user", // Optional: Proxy authentication
52+
"proxyPass": "password", // Optional: Proxy authentication
53+
"dir": "<path-to-local-folder>", // Optional: Directory to test
54+
"v": true, // Optional: Enable verbose logging
55+
"logFile": "/path/to/logs.txt" // Optional: Custom log file location
56+
}
3757
}
3858
```
3959

40-
### Configuration Parameters
60+
### 2. Manual Tunnel Configuration
4161

42-
- **tunnel**: Set to `true` to enable tunnel testing
43-
- **tunnelName**: Specify the name of your tunnel instance (must match the name used when starting the tunnel)
62+
For manual tunnel setup, add the following configuration:
4463

45-
## Setting Up LambdaTest Tunnel
64+
```json
65+
{
66+
"tunnel": {
67+
"type": "manual",
68+
"tunnelName": "my-tunnel-name" // Required for manual mode
69+
//Add user and key in case LT_USERNAME and LT_ACCESSKEY not provided in env variables
70+
}
71+
}
72+
```
4673

47-
1. Download and install LambdaTest Tunnel by following the instructions in our [Tunnel documentation](/support/docs/advanced-tunnel-features/)
74+
:::note
75+
Configuration values take precedence over environment variables when both are present.
76+
:::
4877

49-
2. Start the tunnel with a specific name:
50-
```bash
51-
./LT --user {user-name} --key {access-key} --tunnelName my-tunnel
52-
```
78+
## Environment Variables Support
5379

54-
3. Wait for the "Tunnel is connected" message before running your SmartUI tests
80+
The tunnel configuration automatically uses the following environment variables if not specified in the config:
5581

56-
:::warning Important
57-
- Ensure the tunnel remains active throughout your testing session
58-
- The tunnel name in your configuration must match the `tunnelName` used when starting the tunnel
59-
- Only the user who created the SmartUI project can start and use the tunnel for testing
60-
:::
82+
- `LT_USERNAME`: LambdaTest username
83+
- `LT_ACCESS_KEY`: LambdaTest access key
84+
85+
## Example Configurations
86+
87+
### Basic Automatic Setup
88+
```json
89+
{
90+
"web": {
91+
"browsers": ["chrome", "firefox"],
92+
"viewports": [[1920, 1080], [1366, 768]]
93+
},
94+
"tunnel": {
95+
"type": "auto"
96+
//Add user and key in case LT_USERNAME and LT_ACCESSKEY not provided in env variables
6197

62-
## Example Usage
98+
}
99+
}
100+
```
63101

64-
Here's a complete example of a SmartUI configuration file using tunnel:
102+
### Advanced Automatic Setup with Proxy
103+
```json
104+
{
105+
"web": {
106+
"browsers": ["chrome", "firefox"],
107+
"viewports": [[1920, 1080], [1366, 768]]
108+
},
109+
"tunnel": {
110+
"type": "auto",
111+
"user": "<lambdatest-user>", // Optional: Overrides LT_USERNAME if present in env
112+
"key": "<lambdatest-accesskey>", // Optional: Overrides LT_ACCESS_KEY if present in env
113+
"proxyHost": "127.0.0.1",
114+
"proxyPort": "8000",
115+
"dir": "./src",
116+
"v": true
117+
}
118+
}
119+
```
65120

121+
### Manual Tunnel Setup
66122
```json
67123
{
68124
"web": {
69125
"browsers": ["chrome", "firefox"],
70-
"viewports": [
71-
[1920, 1080],
72-
[1366, 768]
73-
]
126+
"viewports": [[1920, 1080], [1366, 768]]
74127
},
75-
"tunnel": true,
76-
"tunnelName": "my-tunnel",
77-
"waitForTimeout": 1000
128+
"tunnel": {
129+
"type": "manual",
130+
"tunnelName": "my-tunnel",
131+
"user": "<lambdatest-user>", // Optional: Overrides LT_USERNAME if present in env
132+
"key": "<lambdatest-accesskey>", // Optional: Overrides LT_ACCESS_KEY if present in env
133+
}
78134
}
79135
```
80136

81-
For more detailed information about LambdaTest Tunnel features and configurations, please refer to our [Advanced Tunnel Features documentation](/support/docs/advanced-tunnel-features/).
137+
138+
## Best Practices
139+
140+
1. **Automatic vs Manual Mode**
141+
- Use automatic mode for simple setups and quick testing
142+
- Use manual mode when you need more control over tunnel lifecycle
143+
144+
2. **Credentials Management**
145+
- Prefer environment variables for sensitive information
146+
- Use config file for non-sensitive settings
147+
148+
3. **Proxy Configuration**
149+
- Specify proxy settings in config when using corporate networks
150+
- Test proxy settings before running full test suite
151+
152+
4. **Logging**
153+
- Enable verbose logging (`"v": true`) for troubleshooting
154+
- Specify custom log file location for persistent logs
155+
156+
5. **Directory Testing**
157+
- Always specify the directory to test when working with local files
158+
- Ensure the directory path is accessible and contains the necessary files
82159

83160
:::tip
84-
When testing with tunnel, make sure to:
85-
1. Start the tunnel before running your tests
86-
2. Use the correct tunnel name in your configuration
87-
3. Keep the tunnel running until all tests are complete
88-
4. Use the same user credentials for both tunnel and SmartUI project
161+
For more detailed information about LambdaTest Tunnel features and configurations, refer to our [Advanced Tunnel Features documentation](/support/docs/advanced-tunnel-features/).
89162
:::

0 commit comments

Comments
 (0)