mobile-dev-inc / maestro

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

[1.34.1] MaestroDriverStartupException$IOSDriverTimeoutException #1585

Open nicolas-acl opened 8 months ago

nicolas-acl commented 8 months ago

Describe the bug The issue occurs when running a Flow.

To Reproduce Steps to reproduce the behavior :

  1. Start the simulator
  2. Run maestro test ./flows // (flows is a folder with all my .yml)
  3. The Flow fails at Maestro iOS driver did not start up in time.

Expected behavior The error is not occurs

Screenshots maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:476) at maestro.drivers.IOSDriver.open(IOSDriver.kt:65) at maestro.Maestro$Companion.ios(Maestro.kt:585) at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:309) at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:154) at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49) 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:136) at maestro.cli.command.TestCommand.call(TestCommand.kt:46) 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:117)

Environment information (please complete the following information):

Additional context

After many attempts, it freezes the simulator.

julienqueffelec commented 8 months ago

up, same problem

danielbyondd commented 8 months ago

Same, this does not repro on 1.34.0, so it looks to be a regression in the 1.34.1 release

fabiobhz commented 7 months ago

Same problem here with maestro 1.34.1

nicolas-acl commented 7 months ago

Same, this does not repro on 1.34.0, so it looks to be a regression in the 1.34.1 release

Actually, I have the same issue with the 1.34.0 version. I just tried it.

yuseiatlas commented 7 months ago

I faced the same problem when running Maestro on CI. It went away when I increased the driver's timeout from 15s to 60s. The following is from the Maestro docs on how to do this: https://maestro.mobile.dev/advanced/configuring-maestro-driver-timeout

export MAESTRO_DRIVER_STARTUP_TIMEOUT=60000 # setting 60 seconds
maestro test file.yaml
nicolas-acl commented 7 months ago

I faced the same problem when running Maestro on CI. It went away when I increased the driver's timeout from 15s to 60s. The following is from the Maestro docs on how to do this: https://maestro.mobile.dev/advanced/configuring-maestro-driver-timeout

export MAESTRO_DRIVER_STARTUP_TIMEOUT=60000 # setting 60 seconds
maestro test file.yaml

Thanks, but I already try that too. It doesn't change, same error : maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time

aherrick commented 6 months ago

has a work around here been found? this is preventing us from running iOS 17 with maestro

jacobsapps commented 6 months ago

I'm having this exact issue. For reference, I'm trying to run maestro from crontab using the .zsh profile and ~/.maestro/bin/maestro

Works fine when run manually but that doesn't exactly help our automation

shishangx commented 6 months ago

same problem... v1.35.0

DavidREntwistle commented 6 months ago

Having this same problem mainly on v1.35.0, this was previously intermittent on v1.34.1.

pawrob commented 5 months ago

Same issue on v1.35.0, i run it for 3 times on CI and with delay in between, on 3rd attempt it managed to run

FelixLisczyk commented 4 months ago

I'm encountering the same issue with the latest version (1.36.0). I've tried different workarounds, like increasing the timeout or retrying after a delay. The old version (1.33.1) is more stable, although I'm also running into this error from time to time there.

Has any of the devs had a chance to look at this issue? It is already open for over three months.

Update: I've also noticed that Maestro runs more reliably when the Simulator app is visible in the foreground (open -a Simulator).

DanilloVidal commented 4 months ago

Same problem... running maestro 1.36.0

I change ios 17.2 to 15.0 and know start

maodd commented 4 months ago

same here, tried version from 1.33.1 to 1.36.1, java.util.concurrent.TimeoutException: Maestro iOS driver did not start up in time, timeout increased to 2 mins already,

rob4226 commented 4 months ago

Having same problem on v1.36.0:

maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time ```log maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:480) at maestro.drivers.IOSDriver.open(IOSDriver.kt:64) at maestro.Maestro$Companion.ios(Maestro.kt:596) at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:309) at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:154) at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:49) 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.command.StudioCommand.call(StudioCommand.kt:51) at maestro.cli.command.StudioCommand.call(StudioCommand.kt:19) 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:117) ```

I've tried many different things but the only way I can get it to work again is to completely restart my mac.


Edit:

I at least found a way to get maestro working again after the iOS Driver error starts, without resorting to restarting the entire computer. It appears that even when maestro is run and/or shutdown correctly, it sometimes leaves stray iOS Driver processes running. I found that maestro starts working again after finding then killing these processes (usually 2):

ps aux | grep maestro
# 92127  /Users/user4934/Library/Developer/CoreSimulator/Devices/AC713017-4F72-7303-5652-498575F61EC3/data/Containers/Bundle/Application/935FA456-B60F-26CE-3B17-BCD2AED7E37B/maestro-driver-iosUITests-Runner.app/maestro-driver-iosUITests-Runner

# 92092  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test-without-building -xctestrun /var/folders/bs/fylysjxs3z9g14bh79r68rqc0000gn/T/AC713017-4F72-7303-5652-498575F61EC3/maestro-driver-ios-config.xctestrun -destination id=AC713017-4F72-7303-5652-498575F61EC3 -derivedDataPath /var/folders/bs/sylysjxs3z9g14bh79r68rqc0000go/T/maestro_xctestrunner_xcodebuild_output3578906104202179615

# Then kill those processes:
kill 92092 92127

Edit:

Here's a one liner to kill the processes more easily:

pgrep -lf maestro | awk '{print $1}' | xargs -r kill
AbdulelahHajjar commented 3 months ago

After updating iOS 17.4 and Xcode 15.3 in the CI (Codemagic), Maestro now works flawlessly. Not sure of the reason but wanted to share my experience.

monilami commented 3 months ago

Hi guys, a thing that helped me was to reboot the Mac to the factory setting. I know it is quite an unpopular and drastic solution. However, after that, the Maestro and VS code setup was done in one hour without any trouble.

anas-baadshah commented 2 months ago

Any updates on this issue. we are facing a similar situation, where we use ios 17.2 device on CI

yanguyt commented 2 months ago

Here is my discovery: for some reason, when you are running Maestro under IOS 17.0 or 17.2, when Maestro runs the command xcrun simctl list <deviceID>, it doesn't appear your apps that are running in the background. So, there is a validation on the source code that ensures that the app is opened, but for this reason, it never returns true, and then timeout comes. I found this solution. I made the maestro driver builder my responsibility; I'm building it myself. When I'm building, I'm passing export USE_XCODE_TEST_RUNNER=true, which will move the maestro driver build to your responsibility ( remembering that doing it, you will be responsible for dealing with logs and timeouts ). This is the flow that makes my Maestro work; pretty much everything is made with a script.

Build mastro runner-> Start Maestro driver -> wait until install is completed ( while xcrun simctl get_app_container <device_id> <bundle_id> ) -> launch app ( xcrun simctl launch <device_id> <bundle_id> ) -> build react-native in my case -> maestro test ....

bartekpacia commented 5 days ago

Hey guys, thanks to all of you for sharing information and sorry for the problems.

It'd be really helpful for us if you also shared the Xcode version and iOS simulator version you use when the error happens, along with Maestro CLI version. Thanks!