Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stephanww opened this issue Mar 9, 2023 · 39 comments · Fixed by #1012
Closed

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

stephanww opened this issue Mar 9, 2023 · 39 comments · Fixed by #1012
Labels
bug Something isn't working platform: ios Testing iOS apps is affected

Comments

@stephanww
Copy link

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?

@stephanww stephanww changed the title iOS flow crashes [1.24.0] iOS flow crashes: Failed to reach out XCUITest Server Mar 9, 2023
@axelniklasson
Copy link
Collaborator

axelniklasson commented Mar 9, 2023

@wingcommander2020 are you seeing the same issue when using maestro version 1.23.0?

@stephanww
Copy link
Author

stephanww commented Mar 9, 2023

My colleague is still on 1.23.0 and he does not get the error using the same flow-file.

I already tried downgrading by manually uninstalling maestro1.24.0 and re-installing using 'MAESTRO_VERSION={1.23.0}'. I got version 1.23.0 but the error remained on my machine.

@axelniklasson
Copy link
Collaborator

Thanks for confirming @wingcommander2020 -- it does seem like something is not fully right with your local environment. Could you try recreating the simulator? If that doesn't work, can you try using another device model and/or iOS version on your sim?

@gcohen-dev
Copy link

gcohen-dev commented Mar 9, 2023

I'm having the same problem with an older version. I've tried reinstalling all the packages and of course, updating to the latest 1.24.0.
Perhaps it's a privacy thing? since Chrome is launched but unable to start the XCUITest Server.

@stephanww
Copy link
Author

stephanww commented Mar 9, 2023

After creating a new sim device the original error message is gone. The flow fails however prematurely for any iOS simdevice I pick. This is what is visible before the flow fails:

Screenshot 2023-03-09 at 15 09 39

edit: I mean the app tile of maestro, I have not seen this before - could this indicate the cause of the problem?

Again on Android everything works as supposed to.

@gcohen-dev
Copy link

gcohen-dev commented Mar 9, 2023

I've install a new simulator and now I'm getting:

java.lang.IllegalStateException: idb_companion is not able dispatch successful tap events
	at maestro.cli.device.DeviceService.startIdbCompanion(DeviceService.kt:137)
	at maestro.cli.device.DeviceService.prepareDevice(DeviceService.kt:82)
	at maestro.cli.device.PickDeviceInteractor.pickDevice(PickDeviceInteractor.kt:31)
	at maestro.cli.session.MaestroSessionManager.selectDevice(MaestroSessionManager.kt:113)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:63)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:36)
	at maestro.cli.command.StudioCommand.call(StudioCommand.kt:18)
	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)

Any suggestions?

@gumil
Copy link

gumil commented Mar 9, 2023

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.

@axelniklasson
Copy link
Collaborator

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!

@berikv
Copy link
Contributor

berikv commented Mar 13, 2023

This issue is getting conflated.

I'm working on a fix (#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?

@jetaix
Copy link

jetaix commented Mar 14, 2023

Hi team,
I'm facing the same error in a different context:

I'm trying to run some tests on a GitHub action.

Maestro: latest -> curl -Ls "https://get.maestro.mobile.dev" | bash
iOS: iPhone 14 Plus - iOS 16.2
macOS: macos-latest from a Github-hosted runners

image

The same flow works locally. (with act)

Let me know if you need more context!

@gumil
Copy link

gumil commented Mar 14, 2023

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?

I found out that I only have this error when I use the github step action to do maestro tests. I also added an issue to the github action here dniHze/maestro-test-action#50

@stephanww
Copy link
Author

stephanww commented Mar 17, 2023

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.

@roy-borrowell
Copy link

I am also facing the same issue. Could this be related to machine? Using M1 here

@stephanww
Copy link
Author

stephanww commented Mar 18, 2023

I am also facing the same issue. Could this be related to machine? Using M1 here

I am on a M2 Mac Pro, my colleague has the same hardware and no problems with an older version of Maestro <1.24.0.
I also have a M2 Mac Air and Maestro >=1.24.0 works fine using the same flows. I have already reset the M2 Mac Pro twice, but to no avail - still crashes as described above.

Could this be related to an incompatible third party library's version? @berikv Would it help to list version numbers of certain dependencies to pinpoint the problem?

@yarv-dev
Copy link

I Have the same issue on Azure Devops pipeline, which uses the github actions macos image.

Assert that "SIGN IN" is visible...xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server
	at xcuitest.XCTestDriverClient$okHttpClient$2.invoke$lambda-0(XCTestDriverClient.kt:45)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)

@yanniks
Copy link

yanniks commented Apr 4, 2023

Facing the same issue on my MacBook. One possible idea: I do not have Rosetta installed on my Mac - our build server (where Maestro is running fine) does have Rosetta 2 installed.

@RafaO
Copy link

RafaO commented Apr 15, 2023

Hi, after #882 got merged, the problem about Failed to reach out XCUITest Server is not happening for me anymore. Tried with maestro version 1.26.0.

Thanks!

@CodingItWrong
Copy link

Based on the above comment I retried on GitHub Actions, but unfortunately the problem is still occurring for me there: https://github.com/CodingItWrong/listapp-expo/actions/runs/4584588560/jobs/8358340701

@RafaO
Copy link

RafaO commented Apr 16, 2023

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.

@CodingItWrong
Copy link

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.

@yanniks
Copy link

yanniks commented Apr 17, 2023

Unfortunately, the problem is not solved with Maestro 1.26.1 on my local machine 😞. Maestro Studio does not work either. Even though the website opens in the browser, the area below the Maestro Studio header stays blank and I get the following Terminal output:

Running on iPhone 14 Pro - iOS 16.4 - 65D03AD1-2177-4389-ADAE-3A894BBB7D8A
Waiting for idb service to start..
Waiting for Simulator to boot..
Waiting for successful taps
Simulator ready

╭────────────────────────────────────────────────────────╮
│                                                        │
│   Maestro Studio is running at http://localhost:9999   │
│                                                        │
╰────────────────────────────────────────────────────────╯


Tip: Maestro Studio can now run simultaneously alongside other Maestro CLI commands!

Navigate to http://localhost:9999 in your browser to open Maestro Studio. Ctrl-C to exit.
com.github.michaelbull.result.UnwrapException: kotlin.Unit xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server in RetryOnError
	at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:64)
	at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:63)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at maestro.drivers.IOSDriver.getDeviceInfo(IOSDriver.kt:63)
	at maestro.drivers.IOSDriver.deviceInfo(IOSDriver.kt:96)
	at maestro.ViewHierarchy$Companion.from-c1iYVAs(ViewHierarchy.kt:28)
	at maestro.Maestro.viewHierarchy-prqvCes(Maestro.kt:372)
	at maestro.studio.DeviceScreenService$routes$1.invokeSuspend(DeviceScreenService.kt:41)
	at maestro.studio.DeviceScreenService$routes$1.invoke(DeviceScreenService.kt)
	at maestro.studio.DeviceScreenService$routes$1.invoke(DeviceScreenService.kt)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invokeSuspend(Route.kt:116)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.routing.Routing.executeResult(Routing.kt:190)
	at io.ktor.server.routing.Routing.interceptor(Routing.kt:64)
	at io.ktor.server.routing.Routing$Plugin$install$1.invokeSuspend(Routing.kt:140)
	at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt)
	at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invokeSuspend(BaseApplicationEngine.kt:123)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invokeSuspend(CommonHooks.kt:43)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
	at io.ktor.server.application.hooks.CallFailed$install$1.invokeSuspend(CommonHooks.kt:42)
	at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt)
	at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invokeSuspend(DefaultEnginePipeline.kt:118)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:119)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
	at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
	at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:37)
	at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:29)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:425)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda$1$lambda$0(NettyApplicationEngine.kt:291)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1623)
com.github.michaelbull.result.UnwrapException: kotlin.Unit xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server in RetryOnError
	at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:64)
	at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:63)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at maestro.drivers.IOSDriver.getDeviceInfo(IOSDriver.kt:63)
	at maestro.drivers.IOSDriver.deviceInfo(IOSDriver.kt:96)
	at maestro.ViewHierarchy$Companion.from-c1iYVAs(ViewHierarchy.kt:28)
	at maestro.Maestro.viewHierarchy-prqvCes(Maestro.kt:372)
	at maestro.studio.DeviceScreenService$routes$1.invokeSuspend(DeviceScreenService.kt:41)
	at maestro.studio.DeviceScreenService$routes$1.invoke(DeviceScreenService.kt)
	at maestro.studio.DeviceScreenService$routes$1.invoke(DeviceScreenService.kt)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invokeSuspend(Route.kt:116)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt)
	at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.routing.Routing.executeResult(Routing.kt:190)
	at io.ktor.server.routing.Routing.interceptor(Routing.kt:64)
	at io.ktor.server.routing.Routing$Plugin$install$1.invokeSuspend(Routing.kt:140)
	at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt)
	at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invokeSuspend(BaseApplicationEngine.kt:123)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt)
	at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invokeSuspend(CommonHooks.kt:43)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt)
	at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
	at io.ktor.server.application.hooks.CallFailed$install$1.invokeSuspend(CommonHooks.kt:42)
	at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt)
	at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invokeSuspend(DefaultEnginePipeline.kt:118)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt)
	at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120)
	at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78)
	at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98)
	at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt)
	at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:119)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
	at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
	at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
	at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:37)
	at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:29)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:425)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda$1$lambda$0(NettyApplicationEngine.kt:291)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1623)

@Sam-Page
Copy link

I seem to be getting the exact same problem as Yanniks too. Have tried different versions of xcode, ios and maestro, along with updating macos to no avail.

@axelniklasson
Copy link
Collaborator

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!

@Leland-Takamine Leland-Takamine added the bug Something isn't working label May 3, 2023
@RhyG
Copy link

RhyG commented May 4, 2023

Also getting the error Failed to reach out XCUITest Server when running 1.23.0 and 1.24.0. When upgrading to to the most recent version the app still doesn't launch, but I no longer get an error in the CLI and it fails silently. Have tried multiple iOS simulator versions and same issue on them all. Works fine on Android.

Any suggestions on how to debug that to provide some more useful error messages?

@KrisLau
Copy link

KrisLau commented May 8, 2023

Might be related to this:
https://stackoverflow.com/questions/70298400/why-am-i-getting-an-xcuitest-failed-to-receive-any-data-within-the-timeout-5
I dont wanna downgrade node though 😅

@axelniklasson Upgrading maestro and/or downgrading node didn't work either

EDIT: Might have to do with your MacOS. I upgraded mine from 12 to 13 (Ventura), reinstalled CocoaPods, and ruby then it started working

@kzlukosky
Copy link

kzlukosky commented May 9, 2023

@axelniklasson I am getting the following error:

com.github.michaelbull.result.UnwrapException: kotlin.Unit xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server in RetryOnError      
        at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:65)       
        at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:64)       
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)                  
        at maestro.drivers.IOSDriver.getDeviceInfo(IOSDriver.kt:64)             
        at maestro.drivers.IOSDriver.deviceInfo(IOSDriver.kt:97)                
        at maestro.Maestro.fetchDeviceInfo(Maestro.kt:57)                       
        at maestro.Maestro.access$fetchDeviceInfo(Maestro.kt:37)                
        at maestro.Maestro$cachedDeviceInfo$2.invoke(Maestro.kt:43)             
        at maestro.Maestro$cachedDeviceInfo$2.invoke(Maestro.kt:42)             
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)                  
        at maestro.Maestro.getCachedDeviceInfo(Maestro.kt:42)                   
        at maestro.Maestro.deviceInfo(Maestro.kt:51)                            
        at maestro.orchestra.Orchestra.deviceInfo(Orchestra.kt:745)             
        at maestro.orchestra.Orchestra.findElement(Orchestra.kt:732)            
        at maestro.orchestra.Orchestra.findElement$default(Orchestra.kt:717)    
        at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:645)           
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:172)         
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:520)             
	at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:429)
	at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:201)
	at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:150)
	at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:93)
	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:99)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:57)
	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 test is able to start, it launches the app and the first command is - tapOn: "Log In" and that is when I get this error. Other members on my team are using the same version of Maestro and are NOT experiencing this issue so I am not sure whats going on.

The error I am getting is very similar to the issue description so posting my experience here.

I am using:

  • MacOS Ventura: 13.3.1
  • Maestro: 1.27.0
  • Java: openjdk version "20.0.1" 2023-04-18
  • Ruby: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
  • Xcode: 14.3

Update

  • I have updated Cocoapods, Ruby and my MacOS
  • ios-advanced-flow.yaml from the Maestro sample project crashes on the first swipe action.
    • I have tried iPhone 14 16.3 and iPhone 13 15.5 and have the same issue on both.
  • I have Android Studio installed and android-advanced-flow.yaml runs without an issue.

@KrisLau
Copy link

KrisLau commented May 9, 2023

@kzlukosky It had to do with my environment for me. You might want to try reinstalling or upgrading cocoapods and rbenv (or whatever other ruby version management you might use). Also make sure no physical devices are connected. Hopefully that works for you!

@kzlukosky
Copy link

@kzlukosky It had to do with my environment for me. You might want to try reinstalling or upgrading cocoapods and rbenv (or whatever other ruby version management you might use). Also make sure no physical devices are connected. Hopefully that works for you!

Unfortunately I did see your comment and reinstalled cocoapods and ruby already and sadly am still experiencing the same issue.

@KrisLau
Copy link

KrisLau commented May 9, 2023

@kzlukosky Did you make sure to close all the terminal/console windows and IDE then reopen? Cause I was still getting the errors until I did that

@kzlukosky
Copy link

@kzlukosky Did you make sure to close all the terminal/console windows and IDE then reopen? Cause I was still getting the errors until I did that

@KrisLau Yea I closed anything that was open, restarted by computer and tried again with the same issue. Was MacOS, Cocoapods and Ruby the only things you updated/reinstalled?

@KrisLau
Copy link

KrisLau commented May 9, 2023

@kzlukosky Afaik, yes but I also had to do some other stuff to get my project running again which might've changed things up! I did sudo gem pristine <gem name> --version <version #> to a bunch of different gems. Did a pod install/update in my ios folder. Uninstalled and reinstalled rbenv & double checked that all my environment files (.bashrc, .bash_profile, .zshrc) were configured with the proper script or rbenv to work. The last one is most likely to have helped if it wasn't the installation stuff

@KrisLau
Copy link

KrisLau commented May 12, 2023

no clue why but maestro tests stopped working again and my builds have this error:

2023-05-12 13:22:27.881 xcodebuild[16301:82268] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
2023-05-12 13:22:31.713 xcodebuild[16301:82357] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition

EDIT: Omg fixed it again. ok @kzlukosky this time i can narrow down what fixed it for me. My node version was too high (v20) so i had to set it back to the LTS version (v18.16.0) using nvm & maestro doesn't work with iOS 13.7 but worked with 16.4 consistently

@axelniklasson axelniklasson added the platform: ios Testing iOS apps is affected label May 16, 2023
@tqirazevedo
Copy link

I believe I'm having the same problem. The application is installed and opened on the emulated device, but an error occurs in the swipe interaction step.

Maestro: 1.28.0
XCODE: Version 14.2 (14C18)
SO: macOS 12.6.3 (21G419)

maestro test ios-advanced-flow.yaml
Running on iPhone 14 Pro - iOS 16.2 - 82479ACD-AD49-46B0-AD41-BFF6AFC4E99D

com.github.michaelbull.result.UnwrapException: kotlin.Unit xcuitest.XCTestDriverClient$XCTestDriverUnreachable: Failed to reach out XCUITest Server in RetryOnError
at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:64)
at maestro.drivers.IOSDriver$deviceInfo$2.invoke(IOSDriver.kt:63)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at maestro.drivers.IOSDriver.getDeviceInfo(IOSDriver.kt:63)
at maestro.drivers.IOSDriver.access$getDeviceInfo(IOSDriver.kt:58)
at maestro.drivers.IOSDriver$widthPoints$2.invoke(IOSDriver.kt:68)
at maestro.drivers.IOSDriver$widthPoints$2.invoke(IOSDriver.kt:67)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at maestro.drivers.IOSDriver.getWidthPoints(IOSDriver.kt:67)
at maestro.drivers.IOSDriver.widthPercentToPoint(IOSDriver.kt:520)
at maestro.drivers.IOSDriver.swipe(IOSDriver.kt:351)
at maestro.Maestro.swipe(Maestro.kt:129)
at maestro.Maestro.swipe$default(Maestro.kt:120)
at maestro.orchestra.Orchestra.swipeCommand(Orchestra.kt:908)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:189)
at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:525)
at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:434)
at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:202)
at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:150)
at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:93)
at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:179)
at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:45)
at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:42)
at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:138)
at maestro.cli.runner.TestRunner.runSingle(TestRunner.kt:42)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:166)
at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:126)
at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:99)
at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:57)
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:136)

@JoaoManaroulas
Copy link

JoaoManaroulas commented Jul 7, 2023

@kzlukosky Did you make sure to close all the terminal/console windows and IDE then reopen? Cause I was still getting the errors until I did that

@KrisLau Yea I closed anything that was open, restarted by computer and tried again with the same issue. Was MacOS, Cocoapods and Ruby the only things you updated/reinstalled?

Did you manage to fix this somehow? I'm having the same issue. cc @tqirazevedo @yarv-dev

@JoaoManaroulas
Copy link

Did anyone managed to run Maestro on an Azure Pipeline with macOS-12 or macOS-13?

I'm failling with the same error as some mentioned: Failed to reach out XCUITest Server in RetryOnError

The app seems to complete the "launch app" step but fails on the next one: asserting for visibility on a button.

It's worth mentioning that the same test case runs with no problem on my own machine which has a very similar setup:
MacOS 13.3.1
Xcode 14.2
Maestro 1.29.0

@JoaoManaroulas
Copy link

Did anyone managed to run Maestro on an Azure Pipeline with macOS-12 or macOS-13?

I'm failling with the same error as some mentioned: Failed to reach out XCUITest Server in RetryOnError

The app seems to complete the "launch app" step but fails on the next one: asserting for visibility on a button.

It's worth mentioning that the same test case runs with no problem on my own machine which has a very similar setup: MacOS 13.3.1 Xcode 14.2 Maestro 1.29.0

Just for an update here: Doing both the installtion of the Facebook IDB Companion and Maestro within the same shell made it so that it didn't fail with 'Failed to reach out XCUITest Server in RetryOnError', which seems really weird as the app did launch on the failing scenario.

@hackdie
Copy link

hackdie commented Jul 18, 2023

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

@stephanww
Copy link
Author

My original problem was not solved, but I have not yet tried newer versions of Maestro. Most posts here are actually unrelated to my original post. Perhaps we should close this thread.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.
Thank you for helping keep us our issue tracker clean!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working platform: ios Testing iOS apps is affected
Projects
None yet
Development

Successfully merging a pull request may close this issue.