maestro: [v1.30.2] Failed to reach XCUITest Server in restart
Describe the bug When I run the maestro test command, the following error occurs:
maestro test ios-advanced-flow.yaml
Running on iPhone 14 Pro Max - iOS 16.2 - 308A7B68-C45F-4D9B-AE1E-BD952577DC9A
xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach XCUITest Server in restart at xcuitest.XCTestDriverClient.restartXCTestRunnerService(XCTestDriverClient.kt:47) at ios.xctest.XCTestIOSDevice.open(XCTestIOSDevice.kt:31) at ios.LocalIOSDevice.open(LocalIOSDevice.kt:27) at maestro.drivers.IOSDriver.open(IOSDriver.kt:82) at maestro.Maestro$Companion.ios(Maestro.kt:579) at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:329) at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:157) at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:50) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:82) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:81) at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:37) at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74) at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:81) at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58) at maestro.cli.command.TestCommand.call(TestCommand.kt:126) at maestro.cli.command.TestCommand.call(TestCommand.kt:44) at picocli.CommandLine.executeUserObject(CommandLine.java:1933) at picocli.CommandLine.access$1200(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332) at picocli.CommandLine$RunLast.handle(CommandLine.java:2326) at picocli.CommandLine$RunLast.handle(CommandLine.java:2291) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159) at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22) at picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:131)
To Reproduce
- Start the simulator
- Run
maestro test ios-advanced-flow.yaml - The error occurs after executing the maestro test command. No flow steps are executed.
Expected behavior Install the application and run the tests.
Screenshots
Environment information (please complete the following information):
- Maestro version [v1.30.2]
- Platform: [macOS Monterey 12.6.3 (21G419)]
- Framework: [Native iOS]
- Device model and OS version: [Iphome 14 Pro Max iOS 16.2]
- Simulator
- Host [MacBook Pro (16-inch, 2019)]
Workspace (if applicable) Maestro version: 1.30.2 OS: Mac OS X OS version: 12.6.3 Architecture: x86_64 Processor: 2,3 GHz Intel Core i9 8-Core
**Bugreport output ** xctest_runner_logs.zip 2023-07-17_134123.zip
Additional context
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (8 by maintainers)
Here’s a PR I made which adds iOS support for
MAESTRO_DRIVER_STARTUP_TIMEOUTI got more luck setting MAESTRO_DRIVER_STARTUP_TIMEOUT to
60000I added this loop, the first time I got the
java.util.concurrent.TimeoutException: Maestro iOS driver did not start up in timeerror but then I got this:Any thoughts?
I did see that the PR for MAESTRO_DRIVER_STARTUP_TIMEOUT in iOS is merged. I Have the same issue in iOS 16.2 in Azure pipelines and increasing MAESTRO_DRIVER_STARTUP_TIMEOUT didn’t work. Any ideas?
Since I’m not sure how long it might take to get that PR merged, here’s a workaround I came up with you can use when calling
maestro:Realistically you can turn down the number of attempts from 9 to something like 2 or 3, but it doesn’t hurt if you’re sure it should be launching. Any previous attempt will have already kicked off the process of launching, so it’s not like you’re rolling the dice and need so many “attempts”. The next try will just piggyback off the headstart.
Of course, this will also re-run the command even if it succeeds to launch but then fails because there were actually failing tests. This solution could be modified, but just FYI. I won’t bother for now, since I’m hoping the PR gets merged before I need it. Right now, I’m only integrating Maestro and only have a single simple test for integration purposes.