mobile-dev-inc / maestro

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

java.io.FileNotFoundException: null/maestro-driver-ios-config.xctestrun (No such file or directory) #685

Closed thoom76 closed 1 year ago

thoom76 commented 1 year ago

Maestro version: 1.21.1 OS: Mac OS X OS version: 13.0.1 Architecture: aarch64 Shell: Bash Xcode version: 14.2

For the apps we build we run the build and test steps of our CI/CD pipelines on AWS EC2 machines (mac1.metal & mac2.metal machines). We want to use Maestro to run some regression tests. However when trying to run Maestro tests on these machines we get the following error 80% of the time:

java.io.FileNotFoundException: null/maestro-driver-ios-config.xctestrun (No such file or directory)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
        at okio.Okio__JvmOkioKt.sink(JvmOkio.kt:174)
        at okio.Okio.sink(Unknown Source)
        at okio.Okio__JvmOkioKt.sink$default(JvmOkio.kt:174)
        at okio.Okio.sink$default(Unknown Source)
        at xcuitest.installer.LocalXCTestInstaller.writeFileToDestination(LocalXCTestInstaller.kt:120)
        at xcuitest.installer.LocalXCTestInstaller.runXCTest(LocalXCTestInstaller.kt:74)
        at xcuitest.installer.LocalXCTestInstaller.setup(LocalXCTestInstaller.kt:36)
        at ios.xctest.XCTestIOSDevice.ensureXCUITestChannel(XCTestIOSDevice.kt:40)
        at ios.xctest.XCTestIOSDevice.open(XCTestIOSDevice.kt:33)
        at ios.LocalIOSDevice.open(LocalIOSDevice.kt:24)
        at maestro.drivers.IOSDriver.open(IOSDriver.kt:71)
        at maestro.Maestro$Companion.ios(Maestro.kt:533)
        at maestro.cli.session.MaestroSessionManager.createMaestro(MaestroSessionManager.kt:166)
        at maestro.cli.session.MaestroSessionManager.access$createMaestro(MaestroSessionManager.kt:44)
        at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:79)
        at maestro.cli.session.MaestroSessionManager$newSession$session$1.invoke(MaestroSessionManager.kt:78)
        at maestro.cli.db.KeyValueStore.withExclusiveLock(KeyValueStore.kt:43)
        at maestro.cli.session.SessionStore.withExclusiveLock(SessionStore.kt:74)
        at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:78)
        at maestro.cli.session.MaestroSessionManager.newSession$default(MaestroSessionManager.kt:52)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:115)
        at maestro.cli.command.TestCommand.call(TestCommand.kt:41)
        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:122)

The other 20% of the time we get instant failing Maestro tests:

Running on iPhone 14 - iOS 16.2 - 98BD2C10-40E7-49B0-8E63-57965D286EBC

 ║
 ║    Flow
 ║
 ║    ❌  Launch app "org.wikimedia.wikipedia"
 ║

NOTE: These errors are also reproduced by: downloading the maestro samples ( maestro download-samples ), extract the sample.zip within the samples folder; installing the Wikipedia.app on the simulator ( iPhone 14 - iOS 16.2 - 98BD2C10-40E7-49B0-8E63-57965D286EBC ) and running the 'ios-flow.yaml' test.

When running the tests locally everything runs smooth.

dmitry-zaitsev commented 1 year ago

It appears that TMPDIR env variable is not defined in AWS instances (which is strange). A quick fix would be to simply add this variable and point it to some folder where Maestro can store temp files

thoom76 commented 1 year ago

This indeed solves the issue for now 💯

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!