()
| 40 | } |
| 41 | |
| 42 | private async startWda(): Promise<void> { |
| 43 | if (!(await this.isWdaInstalled())) { |
| 44 | // wda is not even installed, won't attempt to start it |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | trace("Starting WebDriverAgent"); |
| 49 | const webdriverPackageName = "com.facebook.WebDriverAgentRunner.xctrunner"; |
| 50 | this.simctl("launch", this.simulatorUuid, webdriverPackageName); |
| 51 | |
| 52 | // now we wait for wda to have a successful status |
| 53 | const wda = new WebDriverAgent("localhost", WDA_PORT); |
| 54 | |
| 55 | // wait up to 10 seconds for wda to start |
| 56 | const timeout = +new Date() + 10 * 1000; |
| 57 | while (+new Date() < timeout) { |
| 58 | // cross fingers and see if wda is already running |
| 59 | if (await wda.isRunning()) { |
| 60 | trace("WebDriverAgent is now running"); |
| 61 | return; |
| 62 | } |
| 63 | |
| 64 | // wait 100ms before trying again |
| 65 | await new Promise(resolve => setTimeout(resolve, 100)); |
| 66 | } |
| 67 | |
| 68 | trace("Could not start WebDriverAgent in time, giving up"); |
| 69 | } |
| 70 | |
| 71 | private async wda(): Promise<WebDriverAgent> { |
| 72 | const wda = new WebDriverAgent("localhost", WDA_PORT); |
no test coverage detected