Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 2x 9x 3x 6x 6x 6x 6x 6x 6x 5x 3x 5x 3x 2x 2x 4x 2x 2x 6x 6x 6x 6x 2x 1x 1x | import logger from '@wdio/logger' import SauceConnectLauncher from 'sauce-connect-launcher' const log = logger('@wdio/sauce-service') export default class SauceLauncher { /** * modify config and launch sauce connect */ onPrepare (config, capabilities) { if (!config.sauceConnect) { return } this.sauceConnectOpts = Object.assign({ username: config.user, accessKey: config.key, logger: log.debug }, config.sauceConnectOpts) config.protocol = 'http' config.hostname = 'localhost' config.port = this.sauceConnectOpts.port || 4445 const sauceConnectTunnelIdentifier = this.sauceConnectOpts.tunnelIdentifier if (sauceConnectTunnelIdentifier) { if (Array.isArray(capabilities)) { capabilities.forEach(capability => { if (capability['sauce:options'] === undefined) { capability.tunnelIdentifier = capability.tunnelIdentifier || sauceConnectTunnelIdentifier } else { capability['sauce:options'].tunnelIdentifier = capability['sauce:options'].tunnelIdentifier || sauceConnectTunnelIdentifier } }) } else { Object.keys(capabilities).forEach(browser => { if (capabilities[browser].capabilities['sauce:options'] === undefined) { capabilities[browser].capabilities.tunnelIdentifier = capabilities[browser].capabilities.tunnelIdentifier || sauceConnectTunnelIdentifier } else { capabilities[browser].capabilities['sauce:options'].tunnelIdentifier = capabilities[browser].capabilities['sauce:options'].tunnelIdentifier || sauceConnectTunnelIdentifier } }) } } return new Promise((resolve, reject) => SauceConnectLauncher(this.sauceConnectOpts, (err, sauceConnectProcess) => { /* istanbul ignore if */ if (err) { return reject(err) } this.sauceConnectProcess = sauceConnectProcess return resolve() })) } /** * shut down sauce connect */ onComplete () { if (!this.sauceConnectProcess) { return } return new Promise(resolve => this.sauceConnectProcess.close(resolve)) } } |