maestro: [1.24.0] iOS flow crashes: Failed to reach out XCUITest Server

Maestro: 1.24.0 XCODE: Version 14.2 (14C18) OS: macOS 13.2.1 (22D68)

When I try to run my iOS flow, maestro crashes and I get the following error message:

xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server                                                                    
        at xcuitest.XCTestDriverClient$okHttpClient$2.invoke$lambda-2(XCTestDriverClient.kt:75)                                                             
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)                                                                  
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)                                                     
        at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)    
        at xcuitest.XCTestDriverClient.executeJsonRequest(XCTestDriverClient.kt:178)                                                                        
        at xcuitest.XCTestDriverClient.runningAppId(XCTestDriverClient.kt:125)
        at ios.xctest.XCTestIOSDevice.activeAppId(XCTestIOSDevice.kt:238)   
        at ios.xctest.XCTestIOSDevice.contentDescriptor(XCTestIOSDevice.kt:47)
        at ios.LocalIOSDevice.contentDescriptor(LocalIOSDevice.kt:32)       
        at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:179)    
	at maestro.ViewHierarchy$Companion.from-c1iYVAs(ViewHierarchy.kt:29)
	at maestro.Maestro.viewHierarchy-prqvCes(Maestro.kt:379)
	at maestro.Maestro$findElementWithTimeout$element$1.invoke(Maestro.kt:404)
	at maestro.Maestro$findElementWithTimeout$element$1.invoke(Maestro.kt:403)
	at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16)
	at maestro.Maestro.findElementWithTimeout(Maestro.kt:403)
	at maestro.orchestra.Orchestra.findElement(Orchestra.kt:687)
	at maestro.orchestra.Orchestra.findElement$default(Orchestra.kt:669)
	at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:598)
	at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:163)
	at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:141)
	at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:92)
	at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:120)
	at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:36)
	at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:32)
	at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:123)
	at maestro.cli.runner.TestRunner.runSingle(TestRunner.kt:32)
	at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:163)
	at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:124)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:98)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:53)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:124)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:42)
	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:125)

The output prior to the error message:


[1] emulator-5554

iOS

[2] iPhone 14 - iOS 16.2 - FB6F7FDF-1A6B-43D1-AD8A-2C42CA4C7F96

Multiple running devices detected. Choose a device to run on.

Enter a number from the list above:

2
Waiting for idb service to start..
Waiting for Simulator to boot..
Waiting for successful taps
Simulator ready

Android flow works fine.

I guess the problem occurred after I upgraded to 1.24.0. uninstalling and reinstalling the older version using export MAESTRO_VERSION={version}; curl -Ls "https://get.maestro.mobile.dev" | bash did not help either.

Any suggestions?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 38 (1 by maintainers)

Most upvoted comments

Hi there folks, it would be much appreciated if you could try upgrading to the most recent version of maestro as we have merged some fixes related to this issue and let us know if the issue still persists for you. Thanks!

This issue is getting conflated.

I’m working on a fix (https://github.com/mobile-dev-inc/maestro/pull/882) for the issue where maestro cli outputs “Failed to reach out XCUITest Server”. Preferably I’d run a validation to make sure the issue is fixed. @wingcommander2020 is there a way I can run your flow? Or, alternatively, could you clone the maestro repo, checkout of the PR branch and run ./maestro ... to test it?

The flow fails however prematurely for any iOS simdevice I pick

This is strange. @wingcommander2020, can you share more information such as log files / etc. Did you try rebooting? Another trick that works with broken simulators is to remove (backup) the /Library/Developer/CoreSimulator/Profiles/Runtimes/* directories and reinstalling the runtimes you need through Xcode.

This is also a problem in v1.23.0 and xcode version v4.1.

The fix I’m working on very likely also fixes this issue. @gumil is it possible for you to share a reproducible scenario or otherwise run it locally (as described above?

Thanks for the context folks. @berikv from our team is working on stability improvements regarding the XCUITest runner so whenever there is an update on this we’ll post it here!

This is also a problem in v1.23.0 and xcode version v4.1.

Unable to launch app <package-name>: Failed to reach out XCUITest Server

Seems like even just running the app and not executing the flow.

if anyone having same issue on 1.30 or 1.31 seems like there is an issue on those versions. going back to 1.29 solved for us

Thanks @RafaO; switching to macos-latest worked for me.

Then I tried macos-13 because I like to lock versions down more, but my action stayed in the queue indefinitely. I would probably need to research more about what macOS versions are available, but that’s not related to this issue.

that’s unfortunate @CodingItWrong , I took a look at your workflow file and the only difference is that I am using macos-latest, not sure if that could have an impact. Here is an example of my github actions that started working after the update, in case you want to compare by yourself: https://github.com/RafaO/yourpet/actions/runs/4709440955/jobs/8352510660

Notice as well I added an echo instruction to print the actual version of maestro that’s been used so I could verify it is 1.26.

Hi @berikv , thanks for your reply.

  1. I have pulled maestro and built it locally. The issue still occurs. It also occurs when using the sample ios-flows provided by maestro, so not sure if my flow is the issue.

  2. I do not have a ‘/Library/Developer/CoreSimulator/Profiles’ folder. Below ‘CoreSimulator’ I only have ‘Caches’ ‘Images’ ‘Volumes’. Could this be the problem?

edit: Problem also occurs on maestro 1.25.0 for me.