Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
lambda-tunnel: lambdatest/lambda-tunnel@1.0.5
Use lambda-tunnel
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Open lambdatest tunnel and run sample nightwatchjs test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: 2.1
orbs:
lambda-tunnel: lambdatest/lambda-tunnel@volatile
workflows:
browser_test:
jobs:
- lambdatest/with_tunnel:
tunnel_name: chrome
lambdatest_email: user@lambdatest.com
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e chrome
Open lambdatest tunnel and run sample nightwatchjs test in parallel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
version: 2.1
orbs:
lambda-tunnel: lambdatest/lambda-tunnel@volatile
workflows:
browser_tests:
jobs:
- lambdatest/with_tunnel:
name: Chrome test
tunnel_name: chrome
lambdatest_email: user@lambdatest.com
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e chrome
- lambdatest/with_tunnel:
name: Firefox test
tunnel_name: firefox
lambdatest_email: user@lambdatest.com
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e firefox
Job to run LambdaTest tunnel for testing locally or privately hosted web apps
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
docker | - | No | cimg/node:current | string |
lambdatest_email | Specify your LambdaTest email | Yes | - | string |
lambdatest_key | Specify environment var holding LambdaTest Access Key | No | LAMBDATEST_KEY | env_var_name |
tunnel_name | Specify a tunnel name to uniquely identify your tunnel on LambdaTest platform | Yes | - | string |
shared_tunnel | Sharing tunnel among team members | No | false | boolean |
mitm | Run tunnel in man-in-the-middle mode | No | false | boolean |
load_balanced | Run tunnel in load balanced mode | No | false | boolean |
proxy_host | You may specify a proxy host if connecting tunnel via proxy | No | '' | string |
proxy_port | You may specify a proxy port if connecting tunnel via proxy | No | '' | string |
proxy_user | You may specify a proxy username if connecting tunnel via proxy that has authentication enabled | No | '' | string |
proxy_pass | You may specify a proxy password if connecting tunnel via proxy that has authentication enabled | No | '' | string |
no_proxy | Comma separated list of hosts to bypass proxy when using tunnel | No | '' | string |
egress_only | Uses proxy settings only for outbound requests | No | false | boolean |
ingress_only | Uses proxy settings only for inbound requests | No | false | boolean |
verbose | Enable verbose logging | No | false | boolean |
steps | Steps to execute once the LambdaTest Tunnel is available | Yes | - | steps |
Launches the tunnel binary in background
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
lambdatest_email | Specify your LambdaTest email | Yes | - | string |
lambdatest_key | Specify environment var holding LambdaTest Access Key | No | LAMBDATEST_KEY | env_var_name |
tunnel_name | Specify a tunnel name to uniquely identify your tunnel on LambdaTest platform | Yes | - | string |
shared_tunnel | Sharing tunnel among team members | No | false | boolean |
mitm | Run tunnel in man-in-the-middle mode | No | false | boolean |
load_balanced | Run tunnel in load balanced mode | No | false | boolean |
proxy_host | You may specify a proxy host if connecting tunnel via proxy | No | '' | string |
proxy_port | You may specify a proxy port if connecting tunnel via proxy | No | '' | string |
proxy_user | You may specify a proxy username if connecting tunnel via proxy that has authentication enabled | No | '' | string |
proxy_pass | You may specify a proxy password if connecting tunnel via proxy that has authentication enabled | No | '' | string |
no_proxy | Comma separated list of hosts to bypass proxy when using tunnel | No | '' | string |
egress_only | Uses proxy settings only for outbound requests | No | false | boolean |
ingress_only | Uses proxy settings only for inbound requests | No | false | boolean |
verbose | Enable verbose logging. | No | false | boolean |
Waits for the tunnel connection to be established with the tunnel server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Seamlessly integrate Lambda Tunnel with CircleCI pipelines and
run Selenium tests on 2000+ browsers for your locally hosted or
privately hosted pages with LambdaTest Selenium Grid.
display:
home_url: https://www.lambdatest.com/
source_url: https://github.com/LambdaTest/Lambdatest-circleci-orb
commands:
install:
description: |
Install and setup tunnel binary
steps:
- run:
name: "Download and Extract tunnel binary"
command: |
sudo apt-get update && sudo apt-get install -y curl unzip iproute2 psmisc
curl -O https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip
unzip LT_Linux.zip
rm LT_Linux.zip
chmod +x LT
open_tunnel:
description: |
Launches the tunnel binary in background
parameters:
lambdatest_email:
description: Specify your LambdaTest email
type: string
lambdatest_key:
description: Specify environment var holding LambdaTest Access Key
type: env_var_name
default: LAMBDATEST_KEY
tunnel_name:
description: Specify a tunnel name to uniquely identify your tunnel on LambdaTest platform
type: string
shared_tunnel:
description: Sharing tunnel among team members
type: boolean
default: false
mitm:
description: Run tunnel in man-in-the-middle mode
type: boolean
default: false
load_balanced:
description: Run tunnel in load balanced mode
type: boolean
default: false
proxy_host:
description: You may specify a proxy host if connecting tunnel via proxy
type: string
default: ""
proxy_port:
description: You may specify a proxy port if connecting tunnel via proxy
type: string
default: ""
proxy_user:
description: You may specify a proxy username if connecting tunnel via proxy that has authentication enabled
type: string
default: ""
proxy_pass:
description: You may specify a proxy password if connecting tunnel via proxy that has authentication enabled
type: string
default: ""
no_proxy:
description: Comma separated list of hosts to bypass proxy when using tunnel
type: string
default: ""
egress_only:
description: Uses proxy settings only for outbound requests
type: boolean
default: false
ingress_only:
description: Uses proxy settings only for inbound requests
type: boolean
default: false
verbose:
description: Enable verbose logging.
type: boolean
default: false
steps:
- run:
name: "Executing the tunnel binary"
background: true
command: |
if [ -z "$<<parameters.lambdatest_key>>" ]; then
echo "Error: The parameter lambdatest_key is empty. Please ensure the environment variable LAMBDATEST_KEY has been added."
exit 1
fi
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range
PORT=$LOWERPORT
while [ $PORT -lt $UPPERPORT ]; do
ss -lpn | grep -q ":$PORT " || break
let PORT=PORT+1
done
echo "$PORT" > /tmp/port
./LT --user <<parameters.lambdatest_email>> --key ${<<parameters.lambdatest_key>>} --controller circleci --infoAPIPort $PORT \
<<# parameters.tunnel_name >> --tunnelName <<parameters.tunnel_name>> \
<</ parameters.tunnel_name>>
<<# parameters.proxy_host >> --proxy-host <<parameters.proxy_host>> \
<</ parameters.proxy_host>>
<<# parameters.proxy_port >> --proxy-port <<parameters.proxy_port>> \
<</ parameters.proxy_port>>
<<# parameters.proxy_user >> --proxy-user <<parameters.proxy_user>> \
<</ parameters.proxy_user>>
<<# parameters.proxy_pass >> --proxy-pass <<parameters.proxy_pass>> \
<</ parameters.proxy_pass>>
<<# parameters.no_proxy >> --no-proxy <<parameters.no_proxy>> \
<</ parameters.no_proxy>>
<<# parameters.egress_only >> --egress-only \
<</ parameters.egress_only>>
<<# parameters.ingress_only >> --ingress-only \
<</ parameters.ingress_only>>
<<# parameters.shared_tunnel >> --shared-tunnel \
<</ parameters.shared_tunnel>>
<<# parameters.mitm >> --mitm \
<</ parameters.mitm>>
<<# parameters.load_balanced >> -l \
<</ parameters.load_balanced>>
<<# parameters.verbose >> -v \
<</ parameters.verbose>>
/
wait_tunnel:
description: |
Waits for the tunnel connection to be established with the tunnel server
steps:
- run:
name: Wait for LambdaTest Tunnel
command: |
while [ ! -f /tmp/port ]; do sleep 0.5; done
PORT=$(head -1 /tmp/port)
curl --silent --retry-connrefused --connect-timeout 5 --max-time 5 --retry 30 --retry-delay 2 --retry-max-time 60 http://127.0.0.1:$PORT/api/v1.0/info 2>&1 > /dev/null
close_tunnel:
description: |
Quitting the tunnel after test suite has been run
steps:
- run:
name: Close LambdaTest Tunnel
command: |
PORT=$(head -1 /tmp/port)
status_code=$(curl --request DELETE --write-out %{http_code} --silent --output /dev/null http://127.0.0.1:$PORT/api/v1.0/stop)
if [[ "$status_code" -ne 200 ]] ; then
killall LT
fi
rm /tmp/port
jobs:
with_tunnel:
description: Job to run LambdaTest tunnel for testing locally or privately hosted web apps
parameters:
docker:
type: string
default: "cimg/node:current"
lambdatest_email:
description: Specify your LambdaTest email
type: string
lambdatest_key:
description: Specify environment var holding LambdaTest Access Key
type: env_var_name
default: LAMBDATEST_KEY
tunnel_name:
description: Specify a tunnel name to uniquely identify your tunnel on LambdaTest platform
type: string
shared_tunnel:
description: Sharing tunnel among team members
type: boolean
default: false
mitm:
description: Run tunnel in man-in-the-middle mode
type: boolean
default: false
load_balanced:
description: Run tunnel in load balanced mode
type: boolean
default: false
proxy_host:
description: You may specify a proxy host if connecting tunnel via proxy
type: string
default: ""
proxy_port:
description: You may specify a proxy port if connecting tunnel via proxy
type: string
default: ""
proxy_user:
description: You may specify a proxy username if connecting tunnel via proxy that has authentication enabled
type: string
default: ""
proxy_pass:
description: You may specify a proxy password if connecting tunnel via proxy that has authentication enabled
type: string
default: ""
no_proxy:
description: Comma separated list of hosts to bypass proxy when using tunnel
type: string
default: ""
egress_only:
description: Uses proxy settings only for outbound requests
type: boolean
default: false
ingress_only:
description: Uses proxy settings only for inbound requests
type: boolean
default: false
verbose:
description: Enable verbose logging
type: boolean
default: false
steps:
type: steps
description: Steps to execute once the LambdaTest Tunnel is available
docker:
- image: <<parameters.docker>>
steps:
- checkout
- install
- open_tunnel:
lambdatest_email: <<parameters.lambdatest_email>>
lambdatest_key: <<parameters.lambdatest_key>>
tunnel_name: <<parameters.tunnel_name>>
shared_tunnel: <<parameters.shared_tunnel>>
mitm: <<parameters.mitm>>
load_balanced: <<parameters.load_balanced>>
proxy_host: <<parameters.proxy_host>>
proxy_port: <<parameters.proxy_port>>
proxy_user: <<parameters.proxy_user>>
proxy_pass: <<parameters.proxy_pass>>
no_proxy: <<parameters.no_proxy>>
egress_only: <<parameters.egress_only>>
ingress_only: <<parameters.ingress_only>>
verbose: <<parameters.verbose>>
- wait_tunnel
- steps: << parameters.steps >>
- close_tunnel
examples:
sample_test:
description: Open lambdatest tunnel and run sample nightwatchjs test
usage:
version: 2.1
orbs:
lambda-tunnel: lambdatest/lambda-tunnel@volatile
workflows:
browser_test:
jobs:
- lambdatest/with_tunnel:
tunnel_name: "chrome"
lambdatest_email: "user@lambdatest.com"
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e chrome
parallel_tests:
description: Open lambdatest tunnel and run sample nightwatchjs test in parallel
usage:
version: 2.1
orbs:
lambda-tunnel: lambdatest/lambda-tunnel@volatile
workflows:
browser_tests:
jobs:
- lambdatest/with_tunnel:
name: "Chrome test"
tunnel_name: "chrome"
lambdatest_email: "user@lambdatest.com"
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e chrome
- lambdatest/with_tunnel:
name: "Firefox test"
tunnel_name: "firefox"
lambdatest_email: "user@lambdatest.com"
steps:
- run:
command: |
npm install
export LAMBDATEST_USERNAME=user
node_modules/.bin/nightwatch -e firefox