diff --git a/lib/xcodebuild.js b/lib/xcodebuild.js index de6b58818..8194d1984 100644 --- a/lib/xcodebuild.js +++ b/lib/xcodebuild.js @@ -405,12 +405,13 @@ class XcodeBuild { this.log.debug(`Waiting up to ${this.launchTimeout}ms for WebDriverAgent to start`); let currentStatus = null; try { - let retries = parseInt(`${this.launchTimeout / 500}`, 10); + const retries = Math.trunc(this.launchTimeout / 500); await retryInterval(retries, 1000, async () => { if (this._didProcessExit) { // there has been an error elsewhere and we need to short-circuit - return; + return currentStatus; } + const proxyTimeout = this.noSessionProxy.timeout; this.noSessionProxy.timeout = 1000; try { @@ -434,10 +435,11 @@ class XcodeBuild { this.log.debug(`WebDriverAgent successfully started after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`); } catch (err) { - // at this point, if we have not had any errors from xcode itself (reported - // elsewhere), we can let this go through and try to create the session - this.log.debug(err.message); - this.log.warn(`Getting status of WebDriverAgent on device timed out. Continuing`); + this.log.debug(err.stack); + throw new Error( + `We were not able to retrieve the /status response from the WebDriverAgent server after ${this.launchTimeout}ms timeout.` + + `Try to increase the value of 'appium:wdaLaunchTimeout' capability as a possible workaround.` + ); } return currentStatus; }