mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.79k stars 270 forks source link

v 1.28.0 — java.util.concurrent.TimeoutException #1125

Closed tylerqr closed 1 year ago

tylerqr commented 1 year ago

Describe the bug Running on Android Pixel 3a emulator on Android 13. It's a ReactNative expo project. I have the app running on teh emulator just fine. Trying to start maestro studio or run any tests gives this same error. For iOS, everything works perfectly and I have lots of great scripts written already. Trying to get android working now. Here's the error:

`tylerruff@Tylers-MacBook-Pro-2 tests % maestro studio Running on emulator-5554

java.util.concurrent.TimeoutException at dadb.forwarding.TcpForwarder.waitFor(TcpForwarder.kt:153) at dadb.forwarding.TcpForwarder.start(TcpForwarder.kt:49) at dadb.Dadb$DefaultImpls.tcpForward(Dadb.kt:221) at dadb.adbserver.AdbServerDadb.tcpForward(AdbServer.kt:118) at maestro.drivers.AndroidDriver.allocateForwarder(AndroidDriver.kt:117) at maestro.drivers.AndroidDriver.open(AndroidDriver.kt:108) at maestro.Maestro$Companion.android(Maestro.kt:565) at maestro.cli.session.MaestroSessionManager.createAndroid(MaestroSessionManager.kt:270) at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:151) at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:81) at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:80) 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:80) 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:136)

`

To Reproduce Steps to reproduce the behavior, e.g.:

  1. Start the android simulator, make sure app you are testing is running
  2. do the command maestro studio

Expected behavior it should successfully start maestro studio but it does not connect or work.

Screenshots

image image

Environment information (please complete the following information):

Workspace (if applicable) Please share your workspace with Flow files and application binary if you are able to do so as that greatly helps in reproduction efforts. xctest_runner_2023-06-01_081727.log

Bugreport output (if applicable) The zip files created when maestro bug [2023-06-01_134659.zip](https://github.com/mobile-dev-inc/maestro/files/11629050/2023-06-01_134659.zip) [2023-06-01_134706.zip](https://github.com/mobile-dev-inc/maestro/files/11629051/2023-06-01_134706.zip) [2023-06-01_134724.zip](https://github.com/mobile-dev-inc/maestro/files/11629053/2023-06-01_134724.zip) [2023-06-01_135108.zip](https://github.com/mobile-dev-inc/maestro/files/11629054/2023-06-01_135108.zip) [2023-06-01_135408.zip](https://github.com/mobile-dev-inc/maestro/files/11629055/2023-06-01_135408.zip) report can be uploaded here as well if applicable. 2023-06-01_134659.zip 2023-06-01_134706.zip 2023-06-01_134724.zip 2023-06-01_135108.zip 2023-06-01_135408.zip

Additional context Feel free to contact me for more info I can reproduce it every time, happy to help debug if I can. I'm Tyler Ruff on your maestro slack, pic with the messy hair. TIA

tylerqr commented 1 year ago

I tried to debug the issue. I tried port forwarding using add reverse tcp:7001 tcp:7001. Even after that I was getting error. I uploaded the logs to GitHub gist Maestrro error logs

From the logs, I can see that inside File AndroidDriver.kt at line #160 we are trying to get device info. And that's where the exception is. I tried to find the MaestroDriverGrpc.java file inside GitHub repo, but I did not find this file, so I am not sure what happens here inside this file which is not able to get device Info. I also see that on iOS simulator, there is an extra app installed by Maestro, and there is no similar app installed on android emulator. Maybe that is the cause.

TaimoorWaseemKhan93 commented 1 year ago

@tylerqr can you confirm is this issue exist on linux as well ? And can you name the app as well.

tylerqr commented 1 year ago

I was able to resolve the issue — I had AirServer (a mobile casting software) running on my machine which was occupying port 7001. The Maestro errors were not helpful in discovering this. Once I ensured nothing was using port 7001, everything worked fine.

github-actions[bot] commented 3 months ago

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!