You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to use LambdaTest Tunnel with SmartUI SDK for testing internal, development, and staging environments
6
6
keywords:
@@ -15,75 +15,148 @@ slug: smartui-sdk-tunnel/
15
15
16
16
# Using LambdaTest Tunnel with SmartUI SDK
17
17
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.
19
19
20
20
:::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/).
22
24
:::
23
25
24
26
## Prerequisites
25
27
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
28
33
29
-
## Configuration
34
+
## Configuration Options
30
35
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:
32
41
33
42
```json
34
43
{
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
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:
55
81
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
61
97
62
-
## Example Usage
98
+
}
99
+
}
100
+
```
63
101
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
+
```
65
120
121
+
### Manual Tunnel Setup
66
122
```json
67
123
{
68
124
"web": {
69
125
"browsers": ["chrome", "firefox"],
70
-
"viewports": [
71
-
[1920, 1080],
72
-
[1366, 768]
73
-
]
126
+
"viewports": [[1920, 1080], [1366, 768]]
74
127
},
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
+
}
78
134
}
79
135
```
80
136
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
82
159
83
160
:::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/).
0 commit comments