(config)
| 190 | } |
| 191 | |
| 192 | _validateConfig(config) { |
| 193 | if (!(config.app || config.platform) && !config.browser) { |
| 194 | throw new Error(` |
| 195 | Appium requires either platform and app or a browser to be set. |
| 196 | Check your codeceptjs config file to ensure these are set properly |
| 197 | { |
| 198 | "helpers": { |
| 199 | "Appium": { |
| 200 | "app": "/path/to/app/package" |
| 201 | "platform": "MOBILE_OS", |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | `) |
| 206 | } |
| 207 | |
| 208 | // set defaults |
| 209 | const defaults = { |
| 210 | // webdriverio defaults |
| 211 | protocol: 'http', |
| 212 | hostname: '0.0.0.0', // webdriverio specs |
| 213 | port: 4723, |
| 214 | path: '/wd/hub', |
| 215 | |
| 216 | // config |
| 217 | waitForTimeout: 1000, // ms |
| 218 | logLevel: 'error', |
| 219 | capabilities: {}, |
| 220 | deprecationWarnings: false, |
| 221 | restart: true, |
| 222 | manualStart: false, |
| 223 | // Mobile emulator/device cold starts (esp. on cloud grids like Sauce Labs) |
| 224 | // routinely exceed webdriverio's 2-minute default. Bump to 5 min. |
| 225 | connectionRetryTimeout: 300000, // ms |
| 226 | timeouts: { |
| 227 | script: 0, // ms |
| 228 | }, |
| 229 | } |
| 230 | |
| 231 | // override defaults with config |
| 232 | config = Object.assign(defaults, config) |
| 233 | |
| 234 | config.baseUrl = config.url || config.baseUrl |
| 235 | if (config.desiredCapabilities && Object.keys(config.desiredCapabilities).length) { |
| 236 | config.capabilities = this.appiumV2 === true ? this._convertAppiumV2Caps(config.desiredCapabilities) : config.desiredCapabilities |
| 237 | } |
| 238 | |
| 239 | if (this.appiumV2) { |
| 240 | config.capabilities[`${vendorPrefix.appium}:deviceName`] = config[`${vendorPrefix.appium}:device`] || config.capabilities[`${vendorPrefix.appium}:deviceName`] |
| 241 | config.capabilities[`${vendorPrefix.appium}:browserName`] = config[`${vendorPrefix.appium}:browser`] || config.capabilities[`${vendorPrefix.appium}:browserName`] |
| 242 | config.capabilities[`${vendorPrefix.appium}:app`] = config[`${vendorPrefix.appium}:app`] || config.capabilities[`${vendorPrefix.appium}:app`] |
| 243 | config.capabilities[`${vendorPrefix.appium}:tunnelIdentifier`] = config[`${vendorPrefix.appium}:tunnelIdentifier`] || config.capabilities[`${vendorPrefix.appium}:tunnelIdentifier`] // Adding the code to connect to sauce labs via sauce tunnel |
| 244 | } else { |
| 245 | config.capabilities.deviceName = config.device || config.capabilities.deviceName |
| 246 | config.capabilities.browserName = config.browser || config.capabilities.browserName |
| 247 | config.capabilities.app = config.app || config.capabilities.app |
| 248 | config.capabilities.tunnelIdentifier = config.tunnelIdentifier || config.capabilities.tunnelIdentifier // Adding the code to connect to sauce labs via sauce tunnel |
| 249 | } |
nothing calls this directly
no test coverage detected