-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.js
373 lines (372 loc) · 10.1 KB
/
index.js
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#!/usr/bin/env node
const argv = require("yargs")
.usage("Usage: $0 <command> [options]")
.command(
"init",
"create an initial config file",
function (yargs) {
return yargs
.option("cv", {
alias: "cypress-version",
describe: "Cypress version",
type: "int",
})
.option("f", {
alias: "config-file-name",
describe: "Init config file name",
type: "string",
});
},
function (argv) {
require("./commands/init").init_implementation(argv);
}
)
.command(
"run",
"run tests on lambdatest",
function (yargs) {
return yargs
.option("ccf", {
alias: "cypress-config-file",
describe: "path of the config file",
type: "string",
})
.option("user", {
alias: "username",
describe: "Lambdatest Username of User",
type: "string",
})
.option("ak", {
alias: "access_key",
describe: "Lambdatest Access Key of User",
type: "string",
})
.option("lcf", {
alias: "lambdatest-config-file",
describe: "path of the lambdatest config file",
type: "string",
})
.option("s", {
alias: "specs",
describe: "path of the spec file or directory or pattern",
type: "string",
})
.option("env", {
alias: "environment",
describe: "environment",
type: "string",
})
.option("bn", {
alias: "build-name",
describe: "build name",
type: "string",
})
.option("t", {
alias: "tags",
describe: "test tags",
type: "string",
})
.option("p", {
alias: "parallels",
describe: "no of parellel sessions",
type: "string",
})
.option("envs", {
alias: "env-variables",
describe: "environment variables",
type: "string",
})
.option("tun", {
alias: "tunnel",
describe: "tunnel",
type: "string",
})
.option("tname", {
alias: "tunnel_name",
describe: "tunnel name",
type: "string",
})
.option("brs", {
alias: "browsers",
describe: "browsers to run test format: platform:browser:version",
type: "string",
})
.option("bi", {
alias: "build-identifier",
describe: "Build Identifier / Build Counter",
type: "string",
})
.option("if", {
alias: "ignore_files",
describe: "Files to ignore in the project zip",
type: "string",
})
.option("sync", {
alias: "sync-mode",
describe: "Sync Build",
type: "string",
})
.option("autostart", {
alias: "tat",
describe: "Tunnel Auto Start",
type: "string",
})
.option("headless", {
alias: "headless-mode",
describe: "Run in headless mode",
type: "boolean",
})
.option("net", {
alias: "network",
describe: "Capture Network logs",
type: "string",
})
.option("fullHar", {
alias: "fullHar",
describe: "Capture Full Har Network logs",
type: "bool",
})
.option("eof", {
alias: "exit-on-failure",
describe: "Exit With Code 1 on failure",
type: "string",
})
.option("cy", {
alias: "cypress_settings",
describe: "Pass Cypress Settings",
type: "string",
})
.option("geo", {
alias: "geo_location",
describe: "Pass Geo Country Code",
type: "string",
})
.option("sof", {
alias: "stop_on_failure",
describe: "Stop other tests if any test in session gets errored out",
type: "bool",
})
.option("ra", {
alias: "reject_unauthorized",
describe:
"Default rejects self signed certificates in external requests",
type: "bool",
})
.option("bt", {
alias: "build-tags",
describe: "build tags",
type: "string",
})
.option("sys-envs", {
alias: "sys-env-variables",
describe: "system environment variables",
type: "string",
})
.option("sys-env-keys", {
alias: "sys-env-keys",
describe: "system environment variables from .env file and os environment in order",
type: "string",
})
.option("envfl", {
alias: "env-file",
describe: "path of .env file",
type: "string",
})
.option("npm-f", {
alias: "npm-force",
describe: "force npm install",
type: "bool",
})
.option("npm-lpd", {
alias: "legacy-peer-deps",
describe: "force npm install",
type: "bool",
})
.option("vip", {
alias: "vi-project",
describe: "visual ui project name",
type: "string",
}).option("vib", {
alias: "vi-build",
describe: "visual ui build name",
type: "string",
}).option("vibase", {
alias: "vi-base",
describe: "visual ui baseline",
type: "bool",
})
.option("res", {
alias: "resolution",
describe: "machine resolution",
type: "string",
})
.option("dp", {
alias: "dedicated_proxy",
describe: "dedicated proxy",
type: "bool",
})
.option("npm_tun", {
alias: "npm_via_tunnel",
describe: "Install npm packages which are behind private VPN. Disclaimer:This will increase the build duration of your tests.",
type: "bool",
})
.option("md", {
alias: "max_duration",
describe: "stops test if it is running more than max_duration minutes.",
type: "string",
})
.option("cmd_log", {
alias: "command_log",
describe: "show command logs on dashboard.",
type: "string",
})
.option("ret_fail", {
alias: "retry_failed",
describe: "run failed tests in a new build.",
type: "bool",
})
.option("net_http2", {
alias: "network_http2",
describe: "Capture Http2 Network logs",
type: "bool",
})
.option("net_ws", {
alias: "network_ws",
describe: "Bypass web socket calls for Network logs",
type: "bool",
})
.option("node18", {
alias: "useNode18",
describe: "Use node version 18 for cypress",
type: "bool",
})
.option("net_sse", {
alias: "network_sse",
describe: "Bypass sse events calls for Network logs",
type: "bool",
})
.option("cypress_accessibility", {
alias: "accessibility",
describe: "enable accessibility testing for cypress.",
type: "bool",
});
},
function (argv) {
require("./commands/run")(argv);
}
)
.command(
"build-info",
"info about the build",
function (yargs) {
return yargs
.option("id", {
alias: "build-id",
describe: "Build Identifier",
type: "string",
demandOption: true,
})
.option("user", {
alias: "username",
describe: "username",
type: "string",
})
.option("ak", {
alias: "access_key",
describe: "Access Key",
type: "string",
})
.option("ra", {
alias: "reject_unauthorized",
describe:
"Default rejects self signed certificates in external requests",
type: "bool",
})
.option("env", {
alias: "environment",
describe: "environment",
type: "string",
});
},
function (argv) {
require("./commands/build_info")(argv);
}
)
.command(
"build-stop",
"stop all tests in the build",
function (yargs) {
return yargs
.option("id", {
alias: "build_id",
describe: "Build Identifier",
type: "string",
})
.option("user", {
alias: "username",
describe: "username",
type: "string",
})
.option("ak", {
alias: "access_key",
describe: "Access Key",
type: "string",
})
.option("env", {
alias: "environment",
describe: "environment",
type: "string",
})
.option("ra", {
alias: "reject_unauthorized",
describe:
"Default rejects self signed certificates in external requests",
type: "bool",
})
.option("slb", {
alias: "stop_last_build",
describe: "stop last build",
type: "bool",
});
},
function (argv) {
require("./commands/build_stop")(argv);
}
)
.command(
"generate-report",
"generate session report",
function (yargs) {
return yargs
.option("user", {
alias: "username",
describe: "Lambdatest Username of User",
type: "string",
})
.option("ak", {
alias: "access_key",
describe: "Lambdatest Access Key of User",
type: "string",
})
.option("sid", {
alias: "session_id",
describe: "Session Id",
type: "string",
})
.option("ra", {
alias: "reject_unauthorized",
describe:
"Default rejects self signed certificates in external requests",
type: "bool",
})
.option("env", {
alias: "environment",
describe: "testing environment",
type: "string",
});
},
function (argv) {
require("./commands/generate_reports").generate_report_command(argv);
}
)
.help().argv;