appium-webdriveragent 4.9.1 → 4.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"xcodebuild.js","names":["DEFAULT_SIGNING_ID","PREBUILD_DELAY","RUNNER_SCHEME_IOS","LIB_SCHEME_IOS","ERROR_WRITING_ATTACHMENT","ERROR_COPYING_ATTACHMENT","IGNORED_ERRORS","RUNNER_SCHEME_TV","LIB_SCHEME_TV","xcodeLog","logger","getLogger","XcodeBuild","constructor","xcodeVersion","device","args","log","defaultLogger","realDevice","agentPath","bootstrapPath","platformVersion","platformName","iosSdkVersion","showXcodeLog","xcodeConfigFile","xcodeOrgId","xcodeSigningId","keychainPath","keychainPassword","prebuildWDA","usePrebuiltWDA","useSimpleBuildTest","useXctestrunFile","launchTimeout","wdaRemotePort","updatedWDABundleId","derivedDataPath","mjpegServerPort","prebuildDelay","_","isNumber","allowProvisioningDeviceRegistration","resultBundlePath","resultBundleVersion","init","noSessionProxy","deviveInfo","isRealDevice","udid","xctestrunFilePath","setXctestrunFile","resetProjectFile","updateProjectFile","retrieveDerivedDataPath","_derivedDataPathPromise","stdout","exec","err","warn","message","pattern","match","truncate","length","debug","path","dirname","normalize","reset","prebuild","start","xcodebuild","B","delay","cleanProject","tmpIsTvOS","isTvOS","libScheme","runnerScheme","scheme","getCommand","buildOnly","cmd","buildCmd","testCmd","push","versionMatch","RegExp","process","env","APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS","createSubProcess","setRealDeviceSecurity","generateXcodeConfigFile","join","Object","assign","USE_PORT","WDA_PRODUCT_BUNDLE_IDENTIFIER","WDA_RUNNER_BUNDLE_ID","MJPEG_SERVER_PORT","upgradeTimestamp","getWDAUpgradeTimestamp","UPGRADE_TIMESTAMP","SubProcess","cwd","detached","stdio","logXcodeOutput","logMsg","isBoolean","on","stderr","out","includes","logLocation","first","remove","trim","split","v","startsWith","sep","ignoreError","some","x","_wda_error_occurred","line","EOL","error","_wda_error_message","resolve","reject","code","signal","data","fs","readFile","processExited","Error","timer","timing","Timer","status","waitForStart","msg","currentStatus","retries","parseInt","retryInterval","proxyTimeout","timeout","command","ios","ip","agentUrl","JSON","stringify","getDuration","asMilliSeconds","toFixed","quit","killProcess"],"sources":["../../lib/xcodebuild.js"],"sourcesContent":["import { retryInterval } from 'asyncbox';\nimport { SubProcess, exec } from 'teen_process';\nimport { fs, logger, timing } from 'appium/support';\nimport defaultLogger from './logger';\nimport B from 'bluebird';\nimport {\n setRealDeviceSecurity, generateXcodeConfigFile, setXctestrunFile,\n updateProjectFile, resetProjectFile, killProcess,\n getWDAUpgradeTimestamp, isTvOS } from './utils';\nimport _ from 'lodash';\nimport path from 'path';\nimport { EOL } from 'os';\nimport { WDA_RUNNER_BUNDLE_ID } from './constants';\n\n\nconst DEFAULT_SIGNING_ID = 'iPhone Developer';\nconst PREBUILD_DELAY = 0;\nconst RUNNER_SCHEME_IOS = 'WebDriverAgentRunner';\nconst LIB_SCHEME_IOS = 'WebDriverAgentLib';\n\nconst ERROR_WRITING_ATTACHMENT = 'Error writing attachment data to file';\nconst ERROR_COPYING_ATTACHMENT = 'Error copying testing attachment';\nconst IGNORED_ERRORS = [\n ERROR_WRITING_ATTACHMENT,\n ERROR_COPYING_ATTACHMENT,\n 'Failed to remove screenshot at path',\n];\n\nconst RUNNER_SCHEME_TV = 'WebDriverAgentRunner_tvOS';\nconst LIB_SCHEME_TV = 'WebDriverAgentLib_tvOS';\n\nconst xcodeLog = logger.getLogger('Xcode');\n\n\nclass XcodeBuild {\n constructor (xcodeVersion, device, args = {}, log = null) {\n this.xcodeVersion = xcodeVersion;\n\n this.device = device;\n this.log = log ?? defaultLogger;\n\n this.realDevice = args.realDevice;\n\n this.agentPath = args.agentPath;\n this.bootstrapPath = args.bootstrapPath;\n\n this.platformVersion = args.platformVersion;\n this.platformName = args.platformName;\n this.iosSdkVersion = args.iosSdkVersion;\n\n this.showXcodeLog = args.showXcodeLog;\n\n this.xcodeConfigFile = args.xcodeConfigFile;\n this.xcodeOrgId = args.xcodeOrgId;\n this.xcodeSigningId = args.xcodeSigningId || DEFAULT_SIGNING_ID;\n this.keychainPath = args.keychainPath;\n this.keychainPassword = args.keychainPassword;\n\n this.prebuildWDA = args.prebuildWDA;\n this.usePrebuiltWDA = args.usePrebuiltWDA;\n this.useSimpleBuildTest = args.useSimpleBuildTest;\n\n this.useXctestrunFile = args.useXctestrunFile;\n\n this.launchTimeout = args.launchTimeout;\n\n this.wdaRemotePort = args.wdaRemotePort;\n\n this.updatedWDABundleId = args.updatedWDABundleId;\n this.derivedDataPath = args.derivedDataPath;\n\n this.mjpegServerPort = args.mjpegServerPort;\n\n this.prebuildDelay = _.isNumber(args.prebuildDelay) ? args.prebuildDelay : PREBUILD_DELAY;\n\n this.allowProvisioningDeviceRegistration = args.allowProvisioningDeviceRegistration;\n\n this.resultBundlePath = args.resultBundlePath;\n this.resultBundleVersion = args.resultBundleVersion;\n }\n\n async init (noSessionProxy) {\n this.noSessionProxy = noSessionProxy;\n\n if (this.useXctestrunFile) {\n const deviveInfo = {\n isRealDevice: this.realDevice,\n udid: this.device.udid,\n platformVersion: this.platformVersion,\n platformName: this.platformName\n };\n this.xctestrunFilePath = await setXctestrunFile(deviveInfo, this.iosSdkVersion, this.bootstrapPath, this.wdaRemotePort);\n return;\n }\n\n // if necessary, update the bundleId to user's specification\n if (this.realDevice) {\n // In case the project still has the user specific bundle ID, reset the project file first.\n // - We do this reset even if updatedWDABundleId is not specified,\n // since the previous updatedWDABundleId test has generated the user specific bundle ID project file.\n // - We don't call resetProjectFile for simulator,\n // since simulator test run will work with any user specific bundle ID.\n await resetProjectFile(this.agentPath);\n if (this.updatedWDABundleId) {\n await updateProjectFile(this.agentPath, this.updatedWDABundleId);\n }\n }\n }\n\n async retrieveDerivedDataPath () {\n if (this.derivedDataPath) {\n return this.derivedDataPath;\n }\n\n // avoid race conditions\n if (this._derivedDataPathPromise) {\n return await this._derivedDataPathPromise;\n }\n\n this._derivedDataPathPromise = (async () => {\n let stdout;\n try {\n ({stdout} = await exec('xcodebuild', ['-project', this.agentPath, '-showBuildSettings']));\n } catch (err) {\n this.log.warn(`Cannot retrieve WDA build settings. Original error: ${err.message}`);\n return;\n }\n\n const pattern = /^\\s*BUILD_DIR\\s+=\\s+(\\/.*)/m;\n const match = pattern.exec(stdout);\n if (!match) {\n this.log.warn(`Cannot parse WDA build dir from ${_.truncate(stdout, {length: 300})}`);\n return;\n }\n this.log.debug(`Parsed BUILD_DIR configuration value: '${match[1]}'`);\n // Derived data root is two levels higher over the build dir\n this.derivedDataPath = path.dirname(path.dirname(path.normalize(match[1])));\n this.log.debug(`Got derived data root: '${this.derivedDataPath}'`);\n return this.derivedDataPath;\n })();\n return await this._derivedDataPathPromise;\n }\n\n async reset () {\n // if necessary, reset the bundleId to original value\n if (this.realDevice && this.updatedWDABundleId) {\n await resetProjectFile(this.agentPath);\n }\n }\n\n async prebuild () {\n // first do a build phase\n this.log.debug('Pre-building WDA before launching test');\n this.usePrebuiltWDA = true;\n await this.start(true);\n\n this.xcodebuild = null;\n\n // pause a moment\n await B.delay(this.prebuildDelay);\n }\n\n async cleanProject () {\n const tmpIsTvOS = isTvOS(this.platformName);\n const libScheme = tmpIsTvOS ? LIB_SCHEME_TV : LIB_SCHEME_IOS;\n const runnerScheme = tmpIsTvOS ? RUNNER_SCHEME_TV : RUNNER_SCHEME_IOS;\n\n for (const scheme of [libScheme, runnerScheme]) {\n this.log.debug(`Cleaning the project scheme '${scheme}' to make sure there are no leftovers from previous installs`);\n await exec('xcodebuild', [\n 'clean',\n '-project', this.agentPath,\n '-scheme', scheme,\n ]);\n }\n }\n\n getCommand (buildOnly = false) {\n let cmd = 'xcodebuild';\n let args;\n\n // figure out the targets for xcodebuild\n const [buildCmd, testCmd] = this.useSimpleBuildTest ? ['build', 'test'] : ['build-for-testing', 'test-without-building'];\n if (buildOnly) {\n args = [buildCmd];\n } else if (this.usePrebuiltWDA || this.useXctestrunFile) {\n args = [testCmd];\n } else {\n args = [buildCmd, testCmd];\n }\n\n if (this.allowProvisioningDeviceRegistration) {\n // To -allowProvisioningDeviceRegistration flag takes effect, -allowProvisioningUpdates needs to be passed as well.\n args.push('-allowProvisioningUpdates', '-allowProvisioningDeviceRegistration');\n }\n\n if (this.resultBundlePath) {\n args.push('-resultBundlePath', this.resultBundlePath);\n }\n\n if (this.resultBundleVersion) {\n args.push('-resultBundleVersion', this.resultBundleVersion);\n }\n\n if (this.useXctestrunFile) {\n args.push('-xctestrun', this.xctestrunFilePath);\n } else {\n const runnerScheme = isTvOS(this.platformName) ? RUNNER_SCHEME_TV : RUNNER_SCHEME_IOS;\n args.push('-project', this.agentPath, '-scheme', runnerScheme);\n if (this.derivedDataPath) {\n args.push('-derivedDataPath', this.derivedDataPath);\n }\n }\n args.push('-destination', `id=${this.device.udid}`);\n\n const versionMatch = new RegExp(/^(\\d+)\\.(\\d+)/).exec(this.platformVersion);\n if (versionMatch) {\n args.push(`IPHONEOS_DEPLOYMENT_TARGET=${versionMatch[1]}.${versionMatch[2]}`);\n } else {\n this.log.warn(`Cannot parse major and minor version numbers from platformVersion \"${this.platformVersion}\". ` +\n 'Will build for the default platform instead');\n }\n\n if (this.realDevice && this.xcodeConfigFile) {\n this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`);\n args.push('-xcconfig', this.xcodeConfigFile);\n }\n\n if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) {\n // This sometimes helps to survive Xcode updates\n args.push('GCC_TREAT_WARNINGS_AS_ERRORS=0');\n }\n\n // Below option slightly reduces build time in debug build\n // with preventing to generate `/Index/DataStore` which is used by development\n args.push('COMPILER_INDEX_STORE_ENABLE=NO');\n\n return {cmd, args};\n }\n\n async createSubProcess (buildOnly = false) {\n if (!this.useXctestrunFile && this.realDevice) {\n if (this.keychainPath && this.keychainPassword) {\n await setRealDeviceSecurity(this.keychainPath, this.keychainPassword);\n }\n if (this.xcodeOrgId && this.xcodeSigningId && !this.xcodeConfigFile) {\n this.xcodeConfigFile = await generateXcodeConfigFile(this.xcodeOrgId, this.xcodeSigningId);\n }\n }\n\n const {cmd, args} = this.getCommand(buildOnly);\n this.log.debug(`Beginning ${buildOnly ? 'build' : 'test'} with command '${cmd} ${args.join(' ')}' ` +\n `in directory '${this.bootstrapPath}'`);\n const env = Object.assign({}, process.env, {\n USE_PORT: this.wdaRemotePort,\n WDA_PRODUCT_BUNDLE_IDENTIFIER: this.updatedWDABundleId || WDA_RUNNER_BUNDLE_ID,\n });\n if (this.mjpegServerPort) {\n // https://github.com/appium/WebDriverAgent/pull/105\n env.MJPEG_SERVER_PORT = this.mjpegServerPort;\n }\n const upgradeTimestamp = await getWDAUpgradeTimestamp(this.bootstrapPath);\n if (upgradeTimestamp) {\n env.UPGRADE_TIMESTAMP = upgradeTimestamp;\n }\n const xcodebuild = new SubProcess(cmd, args, {\n cwd: this.bootstrapPath,\n env,\n detached: true,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let logXcodeOutput = !!this.showXcodeLog;\n const logMsg = _.isBoolean(this.showXcodeLog)\n ? `Output from xcodebuild ${this.showXcodeLog ? 'will' : 'will not'} be logged`\n : 'Output from xcodebuild will only be logged if any errors are present there';\n this.log.debug(`${logMsg}. To change this, use 'showXcodeLog' desired capability`);\n xcodebuild.on('output', (stdout, stderr) => {\n let out = stdout || stderr;\n // we want to pull out the log file that is created, and highlight it\n // for diagnostic purposes\n if (out.includes('Writing diagnostic log for test session to')) {\n // pull out the first line that begins with the path separator\n // which *should* be the line indicating the log file generated\n xcodebuild.logLocation = _.first(_.remove(out.trim().split('\\n'), (v) => v.startsWith(path.sep)));\n xcodeLog.debug(`Log file for xcodebuild test: ${xcodebuild.logLocation}`);\n }\n\n // if we have an error we want to output the logs\n // otherwise the failure is inscrutible\n // but do not log permission errors from trying to write to attachments folder\n const ignoreError = IGNORED_ERRORS.some((x) => out.includes(x));\n if (this.showXcodeLog !== false && out.includes('Error Domain=') && !ignoreError) {\n logXcodeOutput = true;\n\n // terrible hack to handle case where xcode return 0 but is failing\n xcodebuild._wda_error_occurred = true;\n }\n\n // do not log permission errors from trying to write to attachments folder\n if (logXcodeOutput && !ignoreError) {\n for (const line of out.split(EOL)) {\n xcodeLog.error(line);\n if (line) {\n xcodebuild._wda_error_message += `${EOL}${line}`;\n }\n }\n }\n });\n\n return xcodebuild;\n }\n\n async start (buildOnly = false) {\n this.xcodebuild = await this.createSubProcess(buildOnly);\n // Store xcodebuild message\n this.xcodebuild._wda_error_message = '';\n\n // wrap the start procedure in a promise so that we can catch, and report,\n // any startup errors that are thrown as events\n return await new B((resolve, reject) => {\n this.xcodebuild.on('exit', async (code, signal) => {\n xcodeLog.error(`xcodebuild exited with code '${code}' and signal '${signal}'`);\n // print out the xcodebuild file if users have asked for it\n if (this.showXcodeLog && this.xcodebuild.logLocation) {\n xcodeLog.error(`Contents of xcodebuild log file '${this.xcodebuild.logLocation}':`);\n try {\n let data = await fs.readFile(this.xcodebuild.logLocation, 'utf8');\n for (let line of data.split('\\n')) {\n xcodeLog.error(line);\n }\n } catch (err) {\n xcodeLog.error(`Unable to access xcodebuild log file: '${err.message}'`);\n }\n }\n this.xcodebuild.processExited = true;\n if (this.xcodebuild._wda_error_occurred || (!signal && code !== 0)) {\n return reject(new Error(`xcodebuild failed with code ${code}${EOL}` +\n `xcodebuild error message:${EOL}${this.xcodebuild._wda_error_message}`));\n }\n // in the case of just building, the process will exit and that is our finish\n if (buildOnly) {\n return resolve();\n }\n });\n\n return (async () => {\n try {\n const timer = new timing.Timer().start();\n await this.xcodebuild.start(true);\n if (!buildOnly) {\n let status = await this.waitForStart(timer);\n resolve(status);\n }\n } catch (err) {\n let msg = `Unable to start WebDriverAgent: ${err}`;\n this.log.error(msg);\n reject(new Error(msg));\n }\n })();\n });\n }\n\n async waitForStart (timer) {\n // try to connect once every 0.5 seconds, until `launchTimeout` is up\n this.log.debug(`Waiting up to ${this.launchTimeout}ms for WebDriverAgent to start`);\n let currentStatus = null;\n try {\n let retries = parseInt(this.launchTimeout / 500, 10);\n await retryInterval(retries, 1000, async () => {\n if (this.xcodebuild.processExited) {\n // there has been an error elsewhere and we need to short-circuit\n return;\n }\n const proxyTimeout = this.noSessionProxy.timeout;\n this.noSessionProxy.timeout = 1000;\n try {\n currentStatus = await this.noSessionProxy.command('/status', 'GET');\n if (currentStatus && currentStatus.ios && currentStatus.ios.ip) {\n this.agentUrl = currentStatus.ios.ip;\n }\n this.log.debug(`WebDriverAgent information:`);\n this.log.debug(JSON.stringify(currentStatus, null, 2));\n } catch (err) {\n throw new Error(`Unable to connect to running WebDriverAgent: ${err.message}`);\n } finally {\n this.noSessionProxy.timeout = proxyTimeout;\n }\n });\n\n if (this.xcodebuild.processExited) {\n // there has been an error elsewhere and we need to short-circuit\n return currentStatus;\n }\n\n this.log.debug(`WebDriverAgent successfully started after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n } catch (err) {\n // at this point, if we have not had any errors from xcode itself (reported\n // elsewhere), we can let this go through and try to create the session\n this.log.debug(err.message);\n this.log.warn(`Getting status of WebDriverAgent on device timed out. Continuing`);\n }\n return currentStatus;\n }\n\n async quit () {\n await killProcess('xcodebuild', this.xcodebuild);\n }\n}\n\nexport { XcodeBuild };\nexport default XcodeBuild;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAGA,MAAMA,kBAAkB,GAAG,kBAA3B;AACA,MAAMC,cAAc,GAAG,CAAvB;AACA,MAAMC,iBAAiB,GAAG,sBAA1B;AACA,MAAMC,cAAc,GAAG,mBAAvB;AAEA,MAAMC,wBAAwB,GAAG,uCAAjC;AACA,MAAMC,wBAAwB,GAAG,kCAAjC;AACA,MAAMC,cAAc,GAAG,CACrBF,wBADqB,EAErBC,wBAFqB,EAGrB,qCAHqB,CAAvB;AAMA,MAAME,gBAAgB,GAAG,2BAAzB;AAC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AAgB,6CAA4C4E,KAAK,CAACkB,WAAN,GAAoBC,cAApB,CAAmCC,OAAnC,CAA2C,CAA3C,CAA8C,IAA1G;IACD,CA7BD,CA6BE,OAAOvG,GAAP,EAAY;MAGZ,KAAK1C,GAAL,CAASiD,KAAT,CAAeP,GAAG,CAACE,OAAnB;MACA,KAAK5C,GAAL,CAAS2C,IAAT,CAAe,kEAAf;IACD;;IACD,OAAOwF,aAAP;EACD;;EAES,MAAJe,IAAI,GAAI;IACZ,MAAM,IAAAC,kBAAA,EAAY,YAAZ,EAA0B,KAAK3F,UAA/B,CAAN;EACD;;AArXc;;;eAyXF7D,U"}
1
+ {"version":3,"file":"xcodebuild.js","names":["DEFAULT_SIGNING_ID","PREBUILD_DELAY","RUNNER_SCHEME_IOS","LIB_SCHEME_IOS","ERROR_WRITING_ATTACHMENT","ERROR_COPYING_ATTACHMENT","IGNORED_ERRORS","RUNNER_SCHEME_TV","LIB_SCHEME_TV","xcodeLog","logger","getLogger","XcodeBuild","constructor","xcodeVersion","device","args","log","defaultLogger","realDevice","agentPath","bootstrapPath","platformVersion","platformName","iosSdkVersion","showXcodeLog","xcodeConfigFile","xcodeOrgId","xcodeSigningId","keychainPath","keychainPassword","prebuildWDA","usePrebuiltWDA","useSimpleBuildTest","useXctestrunFile","launchTimeout","wdaRemotePort","updatedWDABundleId","derivedDataPath","mjpegServerPort","prebuildDelay","_","isNumber","allowProvisioningDeviceRegistration","resultBundlePath","resultBundleVersion","init","noSessionProxy","deviveInfo","isRealDevice","udid","xctestrunFilePath","setXctestrunFile","resetProjectFile","updateProjectFile","retrieveDerivedDataPath","_derivedDataPathPromise","stdout","exec","err","warn","message","pattern","match","truncate","length","debug","path","dirname","normalize","reset","prebuild","start","xcodebuild","B","delay","cleanProject","tmpIsTvOS","isTvOS","libScheme","runnerScheme","scheme","getCommand","buildOnly","cmd","buildCmd","testCmd","push","versionMatch","RegExp","process","env","APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS","createSubProcess","setRealDeviceSecurity","generateXcodeConfigFile","join","Object","assign","USE_PORT","WDA_PRODUCT_BUNDLE_IDENTIFIER","WDA_RUNNER_BUNDLE_ID","MJPEG_SERVER_PORT","upgradeTimestamp","getWDAUpgradeTimestamp","UPGRADE_TIMESTAMP","SubProcess","cwd","detached","stdio","logXcodeOutput","logMsg","isBoolean","on","stderr","out","includes","logLocation","first","remove","trim","split","v","startsWith","sep","ignoreError","some","x","_wda_error_occurred","line","EOL","error","_wda_error_message","resolve","reject","code","signal","data","fs","readFile","processExited","Error","timer","timing","Timer","status","waitForStart","msg","currentStatus","retries","parseInt","retryInterval","proxyTimeout","timeout","command","ios","ip","agentUrl","JSON","stringify","getDuration","asMilliSeconds","toFixed","quit","killProcess"],"sources":["../../lib/xcodebuild.js"],"sourcesContent":["import { retryInterval } from 'asyncbox';\nimport { SubProcess, exec } from 'teen_process';\nimport { fs, logger, timing } from 'appium/support';\nimport defaultLogger from './logger';\nimport B from 'bluebird';\nimport {\n setRealDeviceSecurity, generateXcodeConfigFile, setXctestrunFile,\n updateProjectFile, resetProjectFile, killProcess,\n getWDAUpgradeTimestamp, isTvOS } from './utils';\nimport _ from 'lodash';\nimport path from 'path';\nimport { EOL } from 'os';\nimport { WDA_RUNNER_BUNDLE_ID } from './constants';\n\n\nconst DEFAULT_SIGNING_ID = 'iPhone Developer';\nconst PREBUILD_DELAY = 0;\nconst RUNNER_SCHEME_IOS = 'WebDriverAgentRunner';\nconst LIB_SCHEME_IOS = 'WebDriverAgentLib';\n\nconst ERROR_WRITING_ATTACHMENT = 'Error writing attachment data to file';\nconst ERROR_COPYING_ATTACHMENT = 'Error copying testing attachment';\nconst IGNORED_ERRORS = [\n ERROR_WRITING_ATTACHMENT,\n ERROR_COPYING_ATTACHMENT,\n 'Failed to remove screenshot at path',\n];\n\nconst RUNNER_SCHEME_TV = 'WebDriverAgentRunner_tvOS';\nconst LIB_SCHEME_TV = 'WebDriverAgentLib_tvOS';\n\nconst xcodeLog = logger.getLogger('Xcode');\n\n\nclass XcodeBuild {\n constructor (xcodeVersion, device, args = {}, log = null) {\n this.xcodeVersion = xcodeVersion;\n\n this.device = device;\n this.log = log ?? defaultLogger;\n\n this.realDevice = args.realDevice;\n\n this.agentPath = args.agentPath;\n this.bootstrapPath = args.bootstrapPath;\n\n this.platformVersion = args.platformVersion;\n this.platformName = args.platformName;\n this.iosSdkVersion = args.iosSdkVersion;\n\n this.showXcodeLog = args.showXcodeLog;\n\n this.xcodeConfigFile = args.xcodeConfigFile;\n this.xcodeOrgId = args.xcodeOrgId;\n this.xcodeSigningId = args.xcodeSigningId || DEFAULT_SIGNING_ID;\n this.keychainPath = args.keychainPath;\n this.keychainPassword = args.keychainPassword;\n\n this.prebuildWDA = args.prebuildWDA;\n this.usePrebuiltWDA = args.usePrebuiltWDA;\n this.useSimpleBuildTest = args.useSimpleBuildTest;\n\n this.useXctestrunFile = args.useXctestrunFile;\n\n this.launchTimeout = args.launchTimeout;\n\n this.wdaRemotePort = args.wdaRemotePort;\n\n this.updatedWDABundleId = args.updatedWDABundleId;\n this.derivedDataPath = args.derivedDataPath;\n\n this.mjpegServerPort = args.mjpegServerPort;\n\n this.prebuildDelay = _.isNumber(args.prebuildDelay) ? args.prebuildDelay : PREBUILD_DELAY;\n\n this.allowProvisioningDeviceRegistration = args.allowProvisioningDeviceRegistration;\n\n this.resultBundlePath = args.resultBundlePath;\n this.resultBundleVersion = args.resultBundleVersion;\n }\n\n async init (noSessionProxy) {\n this.noSessionProxy = noSessionProxy;\n\n if (this.useXctestrunFile) {\n const deviveInfo = {\n isRealDevice: this.realDevice,\n udid: this.device.udid,\n platformVersion: this.platformVersion,\n platformName: this.platformName\n };\n this.xctestrunFilePath = await setXctestrunFile(deviveInfo, this.iosSdkVersion, this.bootstrapPath, this.wdaRemotePort);\n return;\n }\n\n // if necessary, update the bundleId to user's specification\n if (this.realDevice) {\n // In case the project still has the user specific bundle ID, reset the project file first.\n // - We do this reset even if updatedWDABundleId is not specified,\n // since the previous updatedWDABundleId test has generated the user specific bundle ID project file.\n // - We don't call resetProjectFile for simulator,\n // since simulator test run will work with any user specific bundle ID.\n await resetProjectFile(this.agentPath);\n if (this.updatedWDABundleId) {\n await updateProjectFile(this.agentPath, this.updatedWDABundleId);\n }\n }\n }\n\n async retrieveDerivedDataPath () {\n if (this.derivedDataPath) {\n return this.derivedDataPath;\n }\n\n // avoid race conditions\n if (this._derivedDataPathPromise) {\n return await this._derivedDataPathPromise;\n }\n\n this._derivedDataPathPromise = (async () => {\n let stdout;\n try {\n ({stdout} = await exec('xcodebuild', ['-project', this.agentPath, '-showBuildSettings']));\n } catch (err) {\n this.log.warn(`Cannot retrieve WDA build settings. Original error: ${err.message}`);\n return;\n }\n\n const pattern = /^\\s*BUILD_DIR\\s+=\\s+(\\/.*)/m;\n const match = pattern.exec(stdout);\n if (!match) {\n this.log.warn(`Cannot parse WDA build dir from ${_.truncate(stdout, {length: 300})}`);\n return;\n }\n this.log.debug(`Parsed BUILD_DIR configuration value: '${match[1]}'`);\n // Derived data root is two levels higher over the build dir\n this.derivedDataPath = path.dirname(path.dirname(path.normalize(match[1])));\n this.log.debug(`Got derived data root: '${this.derivedDataPath}'`);\n return this.derivedDataPath;\n })();\n return await this._derivedDataPathPromise;\n }\n\n async reset () {\n // if necessary, reset the bundleId to original value\n if (this.realDevice && this.updatedWDABundleId) {\n await resetProjectFile(this.agentPath);\n }\n }\n\n async prebuild () {\n // first do a build phase\n this.log.debug('Pre-building WDA before launching test');\n this.usePrebuiltWDA = true;\n await this.start(true);\n\n this.xcodebuild = null;\n\n // pause a moment\n await B.delay(this.prebuildDelay);\n }\n\n async cleanProject () {\n const tmpIsTvOS = isTvOS(this.platformName);\n const libScheme = tmpIsTvOS ? LIB_SCHEME_TV : LIB_SCHEME_IOS;\n const runnerScheme = tmpIsTvOS ? RUNNER_SCHEME_TV : RUNNER_SCHEME_IOS;\n\n for (const scheme of [libScheme, runnerScheme]) {\n this.log.debug(`Cleaning the project scheme '${scheme}' to make sure there are no leftovers from previous installs`);\n await exec('xcodebuild', [\n 'clean',\n '-project', this.agentPath,\n '-scheme', scheme,\n ]);\n }\n }\n\n getCommand (buildOnly = false) {\n let cmd = 'xcodebuild';\n let args;\n\n // figure out the targets for xcodebuild\n const [buildCmd, testCmd] = this.useSimpleBuildTest ? ['build', 'test'] : ['build-for-testing', 'test-without-building'];\n if (buildOnly) {\n args = [buildCmd];\n } else if (this.usePrebuiltWDA || this.useXctestrunFile) {\n args = [testCmd];\n } else {\n args = [buildCmd, testCmd];\n }\n\n if (this.allowProvisioningDeviceRegistration) {\n // To -allowProvisioningDeviceRegistration flag takes effect, -allowProvisioningUpdates needs to be passed as well.\n args.push('-allowProvisioningUpdates', '-allowProvisioningDeviceRegistration');\n }\n\n if (this.resultBundlePath) {\n args.push('-resultBundlePath', this.resultBundlePath);\n }\n\n if (this.resultBundleVersion) {\n args.push('-resultBundleVersion', this.resultBundleVersion);\n }\n\n if (this.useXctestrunFile) {\n args.push('-xctestrun', this.xctestrunFilePath);\n } else {\n const runnerScheme = isTvOS(this.platformName) ? RUNNER_SCHEME_TV : RUNNER_SCHEME_IOS;\n args.push('-project', this.agentPath, '-scheme', runnerScheme);\n if (this.derivedDataPath) {\n args.push('-derivedDataPath', this.derivedDataPath);\n }\n }\n args.push('-destination', `id=${this.device.udid}`);\n\n const versionMatch = new RegExp(/^(\\d+)\\.(\\d+)/).exec(this.platformVersion);\n if (versionMatch) {\n args.push(`IPHONEOS_DEPLOYMENT_TARGET=${versionMatch[1]}.${versionMatch[2]}`);\n } else {\n this.log.warn(`Cannot parse major and minor version numbers from platformVersion \"${this.platformVersion}\". ` +\n 'Will build for the default platform instead');\n }\n\n if (this.realDevice && this.xcodeConfigFile) {\n this.log.debug(`Using Xcode configuration file: '${this.xcodeConfigFile}'`);\n args.push('-xcconfig', this.xcodeConfigFile);\n }\n\n if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) {\n // This sometimes helps to survive Xcode updates\n args.push('GCC_TREAT_WARNINGS_AS_ERRORS=0');\n }\n\n // Below option slightly reduces build time in debug build\n // with preventing to generate `/Index/DataStore` which is used by development\n args.push('COMPILER_INDEX_STORE_ENABLE=NO');\n\n return {cmd, args};\n }\n\n async createSubProcess (buildOnly = false) {\n if (!this.useXctestrunFile && this.realDevice) {\n if (this.keychainPath && this.keychainPassword) {\n await setRealDeviceSecurity(this.keychainPath, this.keychainPassword);\n }\n if (this.xcodeOrgId && this.xcodeSigningId && !this.xcodeConfigFile) {\n this.xcodeConfigFile = await generateXcodeConfigFile(this.xcodeOrgId, this.xcodeSigningId);\n }\n }\n\n const {cmd, args} = this.getCommand(buildOnly);\n this.log.debug(`Beginning ${buildOnly ? 'build' : 'test'} with command '${cmd} ${args.join(' ')}' ` +\n `in directory '${this.bootstrapPath}'`);\n const env = Object.assign({}, process.env, {\n USE_PORT: this.wdaRemotePort,\n WDA_PRODUCT_BUNDLE_IDENTIFIER: this.updatedWDABundleId || WDA_RUNNER_BUNDLE_ID,\n });\n if (this.mjpegServerPort) {\n // https://github.com/appium/WebDriverAgent/pull/105\n env.MJPEG_SERVER_PORT = this.mjpegServerPort;\n }\n const upgradeTimestamp = await getWDAUpgradeTimestamp(this.bootstrapPath);\n if (upgradeTimestamp) {\n env.UPGRADE_TIMESTAMP = upgradeTimestamp;\n }\n const xcodebuild = new SubProcess(cmd, args, {\n cwd: this.bootstrapPath,\n env,\n detached: true,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let logXcodeOutput = !!this.showXcodeLog;\n const logMsg = _.isBoolean(this.showXcodeLog)\n ? `Output from xcodebuild ${this.showXcodeLog ? 'will' : 'will not'} be logged`\n : 'Output from xcodebuild will only be logged if any errors are present there';\n this.log.debug(`${logMsg}. To change this, use 'showXcodeLog' desired capability`);\n xcodebuild.on('output', (stdout, stderr) => {\n let out = stdout || stderr;\n // we want to pull out the log file that is created, and highlight it\n // for diagnostic purposes\n if (out.includes('Writing diagnostic log for test session to')) {\n // pull out the first line that begins with the path separator\n // which *should* be the line indicating the log file generated\n xcodebuild.logLocation = _.first(_.remove(out.trim().split('\\n'), (v) => v.startsWith(path.sep)));\n xcodeLog.debug(`Log file for xcodebuild test: ${xcodebuild.logLocation}`);\n }\n\n // if we have an error we want to output the logs\n // otherwise the failure is inscrutible\n // but do not log permission errors from trying to write to attachments folder\n const ignoreError = IGNORED_ERRORS.some((x) => out.includes(x));\n if (this.showXcodeLog !== false && out.includes('Error Domain=') && !ignoreError) {\n logXcodeOutput = true;\n\n // terrible hack to handle case where xcode return 0 but is failing\n xcodebuild._wda_error_occurred = true;\n }\n\n // do not log permission errors from trying to write to attachments folder\n if (logXcodeOutput && !ignoreError) {\n for (const line of out.split(EOL)) {\n xcodeLog.error(line);\n if (line) {\n xcodebuild._wda_error_message += `${EOL}${line}`;\n }\n }\n }\n });\n\n return xcodebuild;\n }\n\n async start (buildOnly = false) {\n this.xcodebuild = await this.createSubProcess(buildOnly);\n // Store xcodebuild message\n this.xcodebuild._wda_error_message = '';\n\n // wrap the start procedure in a promise so that we can catch, and report,\n // any startup errors that are thrown as events\n return await new B((resolve, reject) => {\n this.xcodebuild.on('exit', async (code, signal) => {\n xcodeLog.error(`xcodebuild exited with code '${code}' and signal '${signal}'`);\n // print out the xcodebuild file if users have asked for it\n if (this.showXcodeLog && this.xcodebuild.logLocation) {\n xcodeLog.error(`Contents of xcodebuild log file '${this.xcodebuild.logLocation}':`);\n try {\n let data = await fs.readFile(this.xcodebuild.logLocation, 'utf8');\n for (let line of data.split('\\n')) {\n xcodeLog.error(line);\n }\n } catch (err) {\n xcodeLog.error(`Unable to access xcodebuild log file: '${err.message}'`);\n }\n }\n this.xcodebuild.processExited = true;\n if (this.xcodebuild._wda_error_occurred || (!signal && code !== 0)) {\n return reject(new Error(`xcodebuild failed with code ${code}${EOL}` +\n `xcodebuild error message:${EOL}${this.xcodebuild._wda_error_message}`));\n }\n // in the case of just building, the process will exit and that is our finish\n if (buildOnly) {\n return resolve();\n }\n });\n\n return (async () => {\n try {\n const timer = new timing.Timer().start();\n await this.xcodebuild.start(true);\n if (!buildOnly) {\n let status = await this.waitForStart(timer);\n resolve(status);\n }\n } catch (err) {\n let msg = `Unable to start WebDriverAgent: ${err}`;\n this.log.error(msg);\n reject(new Error(msg));\n }\n })();\n });\n }\n\n async waitForStart (timer) {\n // try to connect once every 0.5 seconds, until `launchTimeout` is up\n this.log.debug(`Waiting up to ${this.launchTimeout}ms for WebDriverAgent to start`);\n let currentStatus = null;\n try {\n let retries = parseInt(this.launchTimeout / 500, 10);\n await retryInterval(retries, 1000, async () => {\n if (this.xcodebuild.processExited) {\n // there has been an error elsewhere and we need to short-circuit\n return;\n }\n const proxyTimeout = this.noSessionProxy.timeout;\n this.noSessionProxy.timeout = 1000;\n try {\n currentStatus = await this.noSessionProxy.command('/status', 'GET');\n if (currentStatus && currentStatus.ios && currentStatus.ios.ip) {\n this.agentUrl = currentStatus.ios.ip;\n }\n this.log.debug(`WebDriverAgent information:`);\n this.log.debug(JSON.stringify(currentStatus, null, 2));\n } catch (err) {\n throw new Error(`Unable to connect to running WebDriverAgent: ${err.message}`);\n } finally {\n this.noSessionProxy.timeout = proxyTimeout;\n }\n });\n\n if (this.xcodebuild.processExited) {\n // there has been an error elsewhere and we need to short-circuit\n return currentStatus;\n }\n\n this.log.debug(`WebDriverAgent successfully started after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n } catch (err) {\n // at this point, if we have not had any errors from xcode itself (reported\n // elsewhere), we can let this go through and try to create the session\n this.log.debug(err.message);\n this.log.warn(`Getting status of WebDriverAgent on device timed out. Continuing`);\n }\n return currentStatus;\n }\n\n async quit () {\n await killProcess('xcodebuild', this.xcodebuild);\n }\n}\n\nexport { XcodeBuild };\nexport default XcodeBuild;\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAGA,MAAMA,kBAAkB,GAAG,kBAAkB;AAC7C,MAAMC,cAAc,GAAG,CA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F,aAAa;EACtB;EAEA,MAAMe,IAAI,GAAI;IACZ,MAAM,IAAAC,kBAAW,EAAC,YAAY,EAAE,IAAI,CAAC3F,UAAU,CAAC;EAClD;AACF;AAAC;AAAA,eAGc7D,UAAU;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.9.1",
3
+ "version": "4.9.2",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {