maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Maestro fails to launch when running from a cron job

Open jacobsapps opened this issue 1 year ago • 2 comments

I'm using a self-hosted mac mini to run our automation flows. It's got a cron job set up every hour, import the zsh environment, and (for now) have the full file-path in the cron (i.e. running /Users/jacob/.maestro/bin/maestro test myflow.yaml)

Unfortunately, the iOS driver doesn't start up.

Here's the full log output from my shell script:

Running on iPhone 15 - iOS 17.2 - B9E02FE1-2CF8-4CB1-88F4-7F9C8B42B558

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) 

I've set the MAESTRO_DRIVER_STARTUP_TIMEOUT arbitrarily high but this has no effect.

Previously in the shell script, I use git and xcodebuild to get an iPhone 15 booted with the latest code built to it.

Thanks for any help you can give!

jacobsapps avatar Jan 05 '24 16:01 jacobsapps

A silly but effective workaround I used if anyone has the same issue;

#!/bin/bash

while true; do
    source maestro-script.sh
    sleep 3600
done

jacobsapps avatar Jan 16 '24 08:01 jacobsapps

I have automation working for something similar, and what I do is I use simctl boot to start a simulator and then simply sleep 10 to ensure it is started, before I call maestro.

camoles avatar Jan 16 '24 11:01 camoles

Hey, this looks like a duplicate of #1585

If you experience this problem, please give thumbs-up on #1585

bartekpacia avatar Aug 15 '24 12:08 bartekpacia

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[bot] avatar Aug 22 '24 14:08 github-actions[bot]