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.34.1] MaestroDriverStartupException$IOSDriverTimeoutException #1585

Open
nicolas-acl opened this issue Nov 10, 2023 · 42 comments
Open

[1.34.1] MaestroDriverStartupException$IOSDriverTimeoutException #1585

nicolas-acl opened this issue Nov 10, 2023 · 42 comments
Labels
bug Something isn't working maestro cli Related to the command-line Maestro tool platform: ios Testing iOS apps is affected

Comments

@nicolas-acl
Copy link

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):

  • Maestro version 1.34.1
  • Platform: iOS 17.0.1
  • Framework: React Native
  • Device model and OS version: iPhone14
  • Simulator
  • Host Mac M1 Pro
  • Mac OS Sonoma 14.1 (23B74)

Additional context

After many attempts, it freezes the simulator.

@nicolas-acl nicolas-acl added the bug Something isn't working label Nov 10, 2023
@julienqueffelec
Copy link

up, same problem

@danielbyondd
Copy link

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

@fabiobhz
Copy link

Same problem here with maestro 1.34.1

@nicolas-acl
Copy link
Author

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
Copy link

yuseiatlas commented Nov 22, 2023

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
Copy link
Author

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
Copy link

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

@jacobsapps
Copy link

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
Copy link

shishangx commented Jan 9, 2024

same problem...
v1.35.0

@DavidREntwistle
Copy link

DavidREntwistle commented Jan 10, 2024

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

@pawrob
Copy link

pawrob commented Jan 24, 2024

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
Copy link

FelixLisczyk commented Feb 19, 2024

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
Copy link

DanilloVidal commented Feb 22, 2024

Same problem...
running maestro 1.36.0

I change ios 17.2 to 15.0 and know start

@maodd
Copy link

maodd commented Mar 7, 2024

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
Copy link

rob4226 commented Mar 13, 2024

Having same problem on v1.36.0:

maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
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
Copy link

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
Copy link

monilami commented Apr 2, 2024

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
Copy link

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

@yanguyt
Copy link

yanguyt commented May 10, 2024

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
Copy link
Contributor

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!

@WzDTj
Copy link

WzDTj commented Jul 18, 2024

In my case, the problem was that the proxy did not skip the ::1 address.
截屏2024-07-18 17 59 34

@bartekpacia
Copy link
Contributor

@WzDTj Hey, could you explain this discover in more detail? Thank you.

@WzDTj
Copy link

WzDTj commented Jul 18, 2024

@bartekpacia
I need to use some proxy tools to access some websites such as GitHub, Google.
So when I saw the error maestro.MaestroDriverStartupException$IOSDriverTimeoutException, I used network tools to check which address timed out.

截屏2024-07-18 18 10 02

After I saw ::1:22087, I realized that I didn’t enable ipv6 support in my proxy tool, so I enabled it.

截屏2024-07-18 18 11 44

It was not connecting directly, but through the proxy. So I excluded ::1 from my proxy and everything worked fine.

截屏2024-07-18 18 13 14

截屏2024-07-18 18 22 31

@gtokman
Copy link

gtokman commented Jul 21, 2024

Also experiencing this issue on macos 14 Github action:

Running on iPhone 15 Pro - iOS 17.5 - B5F24E3B-EF7E-4DB6-8B35-ADBE43527CC1
info Dev server ready
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.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:19[33](https://github.com/candlefinance/candle/actions/runs/10029510568/job/27717763903#step:11:34))
	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)
	```

@andreped
Copy link

Also experiencing this issue on macos 14 Github action:

@gtokman Did you manage to find a workaround? This is stopping me from using Maestro for our end-to-end tests in Github Actions. Very unfortunate..

@ahervieuxgirard
Copy link

Hello I still encounter this issue on 1.37.9 on iOS I even tried to revert to older versiosn but i still have the timeout, I tried to changed the timeout but no success.

❌ Error: BlockingCoroutine is cancelling
kotlinx.coroutines.JobCancellationException: BlockingCoroutine is cancelling; job=BlockingCoroutine{Cancelling}@3cf3acf8
Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:329)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:162)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:87)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

@CodingItWrong
Copy link

CodingItWrong commented Aug 22, 2024

If it would be helpful to have a public repo demonstrating it, here is:

I'm continuing to try troubleshooting steps above to see if I can fix it.

UPDATE: I was able to fix this error on my work project by:

  1. Increasing the MAESTRO_DRIVER_STARTUP_TIMEOUT to 60000, and
  2. increasing the size of the GitHub Actions runner to macos-latest-xlarge

(Unfortunately I can't easily test that on the sample project above because my personal GitHub Actions account isn't paid.)

@mZargarpur
Copy link

I'm encountering this issue on version 1.37.9 for iOS. On my last five runs, it happened two times.

@alberto-jolt
Copy link

We are also facing this issue in our Bitrise CI environment, currently using version 1.37.9.

❌ Error: BlockingCoroutine is cancelling
kotlinx.coroutines.JobCancellationException: BlockingCoroutine is cancelling; job=BlockingCoroutine{Cancelling}@51deb97f
Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:330)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:163)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:88)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)

@thinhv
Copy link

thinhv commented Aug 29, 2024

Same issue with 1.37.9.

Macos: 13.6.9
Xcode: 15.2

Caused by: maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
❌ Error: BlockingCoroutine is cancelling
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:494)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:64)
	at maestro.Maestro$Companion.ios(Maestro.kt:610)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:330)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:163)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:88)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:58)
	at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:249)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
Error: Process completed with exit code 1.

@VinayR2022

This comment was marked as spam.

@PDominguezW

This comment was marked as spam.

@sebas5384

This comment was marked as spam.

@coltkenn2658

This comment was marked as spam.

@mpplslive
Copy link

I am having the same issue with 1.38.1.

Macos: 14.6.1
Xcode: 15.4

Screenshot 2024-09-12 at 11 08 35

Did anyone found a workaround?

@mathias5r
Copy link

While trying to solve this problem in a circleci pipeline I changed from M1 Medium (6 GB RAM and 4 CPU) to M1 Large (12 GB RAM and 8 CPU) and the problem completly dissapeared. Maybe it's related to the lack of resources?

@alberto-jolt
Copy link

For my setup on Bitrise CI, I managed to fix the issue by using Xcode 15.4 and Maestro version 1.37.9.

@mpplslive
Copy link

Thanks, I will give it a try regarding the version 1.37.9. I am also using it within a Bitrise CI, and sometimes I also get the Unable to launch app com.: Unable to launch app com. ), so it is quite intermittent 😅

@dachaoli-finfare
Copy link

I'm running on macos-latest-xlarge, with Meastro installed on the fly with curl -fsSL "https://get.maestro.mobile.dev" | bash, with iPhone 15 (58E32105-8D8F-41F4-83F3-C7D88B1E7436)

It seems as mathias5r mentioned above, just the runner being busy(or lack of resources), that it takes over 2 minutes for it to start testing.

Here's the snippet of my Github action script, I set timeout to 4 minutes

echo "Install app"
xcrun simctl install ${{ env.DEVICE_ID }} my.app
          
echo "Launch app"
xcrun simctl launch --console ${{ env.DEVICE_ID }} com.my.app &
          
echo "Run test"
export MAESTRO_CLI_NO_ANALYTICS=1
export MAESTRO_DRIVER_STARTUP_TIMEOUT=240000
~/.maestro/bin/maestro --device ${{ env.DEVICE_ID }} test --format html -e PLATFORM=IOS --output ios.html maestro/

And it outputs like this

Fri, 27 Sep 2024 12:22:02 GMT Run test
Fri, 27 Sep 2024 12:22:05 GMT CI detected and MAESTRO_CLI_NO_ANALYTICS environment variable set, analytics disabled.
...
Fri, 27 Sep 2024 12:24:04 GMT Waiting for flows to complete...
Fri, 27 Sep 2024 12:24:13 GMT [Passed] api (7s)
Fri, 27 Sep 2024 12:24:25 GMT [Passed] button (13s)
Fri, 27 Sep 2024 12:24:40 GMT [Passed] init (15s)
Fri, 27 Sep 2024 12:24:40 GMT 3/3 Flows Passed in 35s

Meanwhile, in my M1 Pro local, the same tests with app already installed and launched, it also takes a good 10~15 seconds for the message Waiting for flows to complete... to show up

Waiting for flows to complete...

[Passed] api (2s)
[Passed] button (5s)
[Passed] init (3s)

3/3 Flows Passed in 10s

So it seems things just take a long time to start, especially on Github action where even the xlarge instance isn't very powerful for these tests.

@luis-cruzt
Copy link

I'm also trying to set up Maestro on Github Actions and I'm having the exact same issue, I've already changed the mac os version and none of them works.

Maestro iOS driver did not start up in time

The stack trace was:
maestro.MaestroDriverStartupException$IOSDriverTimeoutException: Maestro iOS driver did not start up in time
	at maestro.drivers.IOSDriver.awaitLaunch(IOSDriver.kt:472)
	at maestro.drivers.IOSDriver.open(IOSDriver.kt:53)
	at maestro.Maestro$Companion.ios(Maestro.kt:624)
	at maestro.cli.session.MaestroSessionManager.createIOS(MaestroSessionManager.kt:310)
	at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:159)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:84)
	at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:52)
	at maestro.cli.command.TestCommand.runShardSuite
	at maestro.cli.command.TestCommand.access$runShardSuite(TestCommand.kt:63)
	at maestro.cli.command.TestCommand$handleSessions$1$results$1$1.invokeSuspend(TestCommand.kt:265)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:[33]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)

@iamjon
Copy link

iamjon commented Dec 2, 2024

Hi,
I had this issue while running on a mac in github actions.
I can confirm the latest version seems to have fixed it
What I noticed after the fix, was that I had accidentally launched two simulators from the command line. Having both of them caused the tests to fail after the fix and I assume caused the timeout issues to begin with.

This is the script I wrote to ensure only one emulator was launched:

#!/bin/bash

# Get the UUID of the desired device
# grep -oE '\([A-Fa-f0-9-]+\)': Matches the UUID in parentheses.
# tr -d '()': Removes the parentheses.
PHONE_ID="$(xcrun xctrace list devices | grep -m 1 'iPhone 15' | grep -oE '\([A-Fa-f0-9-]+\)' | tr -d '()')"
echo "Phone ID: $PHONE_ID"

# Open the Simulator app
echo "Opening Simulator app..."
open -a Simulator


# Boot the specific device if not already booted
DEVICE_STATE=$(xcrun simctl list devices | grep "$PHONE_ID" | grep '(Booted)')
if [ -z "$DEVICE_STATE" ]; then
  echo "Booting up iPhone 15 in Simulator..."
  xcrun simctl boot "$PHONE_ID"
else
  echo "iPhone 15 is already booted."
fi

UUIDS=$(xcrun simctl list devices | grep '(Booted)' | awk -F '[()]' '{print $2}')

echo "Booted devices: $UUIDS"
# Loop through each UUID
for UUID in $UUIDS; do
  if [ "$UUID" == $PHONE_ID ]; then
    echo "iphone 15 was booted"
  else
    xcrun simctl shutdown "$UUID"
  fi
done

echo "Booted devices at the end"
xcrun simctl list devices | grep '(Booted)'


# Focus on the Simulator app (optional)
osascript -e 'tell application "Simulator" to activate'

@amanjeetsingh150
Copy link
Collaborator

Hey folks, can you try the latest version. We made some improvements on setup of iOS driver so this should be fixed. LMK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maestro cli Related to the command-line Maestro tool platform: ios Testing iOS apps is affected
Projects
None yet
Development

No branches or pull requests