UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

83 lines (59 loc) 2.7 kB
/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ Role('Siesta.Launcher.Options.LambdaTest', { override : { getBrowserName : function () { var options = this.options var res = this.SUPER() return res || options.caps.browser }, validate : function () { if (this.SUPER() === false) return false var options = this.options var ltUserName = options[ 'lambdatest-user' ] var ltKey = options[ 'lambdatest-key' ] var ltTunneledDomains var ltShortCut = options[ 'lambdatest' ] || options[ 'lambdatest_' ] if (ltShortCut) { // options w/o values gets `new Boolean(true)` as value var parts = ((ltShortCut instanceof Boolean) && (ltShortCut == true) ? '' : ltShortCut).split(',') ltUserName = parts.shift() || process.env.LT_USER ltKey = parts.shift() || process.env.LT_KEY ltTunneledDomains = parts.join(',') || process.env.SL_TUNNEL if (!ltUserName) { this.printError("No LambdaTest user name found for --lambdatest shortcut") return false } } if (ltUserName && !ltKey) { this.printError("No LambdaTest key provided, for user name: " + ltUserName) return false } if (ltUserName && ltKey) { if (options.host) { this.printError("LambdaTest mode is enaled, but host is already set to: " + options.host) return false } options.host = "https://" + ltUserName + ":" + ltKey + "@hub.lambdatest.com/wd/hub" options.port = 4444 this.debug("--host set to " + options.host.replace(ltKey, 'LAMBDATEST_API_KEY')) options.lt = { userName : ltUserName, key : ltKey, shortCut : ltShortCut, ltTunneledDomains : ltTunneledDomains, noTunnel : Boolean(options[ 'lambdatest_' ]) } if (!options.caps[ 'tunnel' ]) this.addCapability('tunnel', 'true') if (options.build) this.addCapability('build', options.build) } return true } } })