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

launchApp no longer works while Maestro Studio is open since update 1.37.0 #1927

Open
1 task done
pplourde opened this issue Aug 20, 2024 · 9 comments
Open
1 task done
Labels
bug Something isn't working maestro cli Related to the command-line Maestro tool maestro studio Related to Maestro Studio P2 Important and valid issues not at the top of the work list platform: android Testing Android apps is affected platform: ios Testing iOS apps is affected

Comments

@pplourde
Copy link

pplourde commented Aug 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues and didn't find mine.

Steps to reproduce

  1. Ensure that Maestro Studio is running and Maestro CLI was updated to version 1.37.0 or higher
  2. Run any flow that includes the '- launchApp' command

Actual results

  • App closes and doesn't relaunch.
  • Test fails as the app does not launch while Maestro Studio is open.

Expected results

  • App closes and relaunches.
  • Test passes and continues as normal.

About app

  • Issue is encountered regardless of the app used to test. The command is broken and does not work if Maestro Studio is running even when attempting to launch well known app such as Youtube or others.

About environment

  • Issue was reproduced across multiple Android devices (found on S22 Ultra Android 14, reproduced on S20 Android 12, Pixel 7 Pro Android 14)
  • We did not attempt to reproduce on iOS so issue might or might not occur with iOS.

Logs

Logs
[INFO ] MAESTRO - ---- System Info ----
[INFO ] MAESTRO - Maestro Version: 1.37.9
[INFO ] MAESTRO - CI: Undefined
[INFO ] MAESTRO - OS Name: Mac OS X
[INFO ] MAESTRO - OS Version: 14.5
[INFO ] MAESTRO - Architecture: aarch64
[INFO ] MAESTRO - Java Version: 17
[INFO ] MAESTRO - Xcode Version: 15.4
[INFO ] MAESTRO - Flutter Version: Undefined
[INFO ] MAESTRO - Flutter Channel: Undefined
[INFO ] MAESTRO - ---------------------
[INFO ] maestro.Maestro - Getting device info
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration RUNNING
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration metadata CommandMetadata(numberOfRuns=null, evaluatedCommand=MaestroCommand(tapOnElement=null, tapOnPoint=null, tapOnPointV2Command=null, scrollCommand=null, swipeCommand=null, backPressCommand=null, assertCommand=null, assertConditionCommand=null, inputTextCommand=null, inputRandomTextCommand=null, launchAppCommand=null, applyConfigurationCommand=ApplyConfigurationCommand(config=MaestroConfig(appId=com.quickplay.android.bellmediaplayer, name=null, tags=[batman, robin], initFlow=null, ext={}, onFlowStart=null, onFlowComplete=null), label=null), openLinkCommand=null, pressKeyCommand=null, eraseTextCommand=null, hideKeyboardCommand=null, takeScreenshotCommand=null, stopAppCommand=null, killAppCommand=null, clearStateCommand=null, clearKeychainCommand=null, runFlowCommand=null, setLocationCommand=null, repeatCommand=null, copyTextCommand=null, pasteTextCommand=null, defineVariablesCommand=null, runScriptCommand=null, waitForAnimationToEndCommand=null, evalScriptCommand=null, scrollUntilVisible=null, travelCommand=null, startRecordingCommand=null, stopRecordingCommand=null, addMediaCommand=null, setAirplaneModeCommand=null, toggleAirplaneModeCommand=null), logMessages=[], insight=Insight(message=, level=NONE))
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration COMPLETED
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "com.google.android.youtube" RUNNING
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "com.google.android.youtube" metadata CommandMetadata(numberOfRuns=null, evaluatedCommand=MaestroCommand(tapOnElement=null, tapOnPoint=null, tapOnPointV2Command=null, scrollCommand=null, swipeCommand=null, backPressCommand=null, assertCommand=null, assertConditionCommand=null, inputTextCommand=null, inputRandomTextCommand=null, launchAppCommand=LaunchAppCommand(appId=com.google.android.youtube, clearState=null, clearKeychain=null, stopApp=null, permissions=null, launchArguments=null, label=null), applyConfigurationCommand=null, openLinkCommand=null, pressKeyCommand=null, eraseTextCommand=null, hideKeyboardCommand=null, takeScreenshotCommand=null, stopAppCommand=null, killAppCommand=null, clearStateCommand=null, clearKeychainCommand=null, runFlowCommand=null, setLocationCommand=null, repeatCommand=null, copyTextCommand=null, pasteTextCommand=null, defineVariablesCommand=null, runScriptCommand=null, waitForAnimationToEndCommand=null, evalScriptCommand=null, scrollUntilVisible=null, travelCommand=null, startRecordingCommand=null, stopRecordingCommand=null, addMediaCommand=null, setAirplaneModeCommand=null, toggleAirplaneModeCommand=null), logMessages=[], insight=Insight(message=, level=NONE))
[INFO ] maestro.Maestro - Launching app com.google.android.youtube
[INFO ] maestro.Maestro - Taking screenshot: /var/folders/z9/bjbfy3p91d38m3plkpm6ld900000gn/T/screenshot-172418080123913556441041740514473.png
[INFO ] maestro.utils.ScreenshotUtils - Taking screenshot to output sink
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "com.google.android.youtube" FAILED
[ERROR] m.cli.session.MaestroSessionManager - Failed to record heartbeat
java.lang.InterruptedException: sleep interrupted
	at java.base/java.lang.Thread.sleep(Native Method)
	at maestro.cli.session.MaestroSessionManager.newSession$lambda$0(MaestroSessionManager.kt:77)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Maestro version

1.37.9

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

  • Closing Maestro Studio and running the same flow again works no problem.
  • Flow will always fail while attempting to do - launchApp while Maestro Studio is running.
  • We had no issue at all prior to updating to the 1.37.0 (or higher) versions of Maestro CLI.
  • Since issue can occur with any app, logs included are running Maestro Studio while attempting to launch Youtube app using - launchApp command.
@pplourde pplourde changed the title LaunchApp no longer work while Maestro Studio is open since update 1.37.9 launchApp no longer work while Maestro Studio is open since update 1.37.9 Aug 20, 2024
@pplourde pplourde changed the title launchApp no longer work while Maestro Studio is open since update 1.37.9 launchApp no longer works while Maestro Studio is open since update 1.37.9 Aug 20, 2024
@pplourde pplourde changed the title launchApp no longer works while Maestro Studio is open since update 1.37.9 launchApp no longer works while Maestro Studio is open since update 1.37.0 Aug 20, 2024
@bartekpacia
Copy link
Contributor

bartekpacia commented Aug 21, 2024

Hey @pplourde, can you show exact commands you used, and also the flow file?

My repro

I reproduce this issue, but with different logs/errors. I'm curious why's that. This is my flow:

# file: samples/android-flow.yaml
appId: org.wikipedia
---
- launchApp:
    clearState: true
- tapOn: CONTINUE
  • wikipedia app is, of course, installed on my Android emulator
  • Maestro v1.37.9

First I run:

maestro studio

Then in a new terminal tab:

maestro test samples/android-flow.yaml

Terminal logs:

$ maestro test samples/android-flow.yaml
\
Running on emulator-5554

 ║
 ║  > Flow
 ║
 ║    ❌  Launch app "org.wikipedia" with clear state
 ║    🔲 Tap on "CONTINUE"
 ║

Unable to launch app org.wikipedia: null

==== Debug output (logs & screenshots) ====

/Users/bartek/.maestro/tests/2024-08-21_113614
maestro.log
[INFO ] MAESTRO - ---- System Info ----
[INFO ] MAESTRO - Maestro Version: 1.37.9
[INFO ] MAESTRO - CI: Undefined
[INFO ] MAESTRO - OS Name: Mac OS X
[INFO ] MAESTRO - OS Version: 14.5
[INFO ] MAESTRO - Architecture: aarch64
[INFO ] MAESTRO - Java Version: 17
[INFO ] MAESTRO - Xcode Version: 15.4
[INFO ] MAESTRO - Flutter Version: 3.22.0
[INFO ] MAESTRO - Flutter Channel: stable
[INFO ] MAESTRO - ---------------------
[INFO ] maestro.Maestro - Getting device info
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration RUNNING
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration metadata CommandMetadata(numberOfRuns=null, evaluatedCommand=MaestroCommand(tapOnElement=null, tapOnPoint=null, tapOnPointV2Command=null, scrollCommand=null, swipeCommand=null, backPressCommand=null, assertCommand=null, assertConditionCommand=null, inputTextCommand=null, inputRandomTextCommand=null, launchAppCommand=null, applyConfigurationCommand=ApplyConfigurationCommand(config=MaestroConfig(appId=org.wikipedia, name=null, tags=[], initFlow=null, ext={}, onFlowStart=null, onFlowComplete=null), label=null), openLinkCommand=null, pressKeyCommand=null, eraseTextCommand=null, hideKeyboardCommand=null, takeScreenshotCommand=null, stopAppCommand=null, killAppCommand=null, clearStateCommand=null, clearKeychainCommand=null, runFlowCommand=null, setLocationCommand=null, repeatCommand=null, copyTextCommand=null, pasteTextCommand=null, defineVariablesCommand=null, runScriptCommand=null, waitForAnimationToEndCommand=null, evalScriptCommand=null, scrollUntilVisible=null, travelCommand=null, startRecordingCommand=null, stopRecordingCommand=null, addMediaCommand=null, setAirplaneModeCommand=null, toggleAirplaneModeCommand=null), logMessages=[], insight=Insight(message=, level=NONE))
[INFO ] m.cli.runner.MaestroCommandRunner - Apply configuration COMPLETED
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "org.wikipedia" with clear state RUNNING
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "org.wikipedia" with clear state metadata CommandMetadata(numberOfRuns=null, evaluatedCommand=MaestroCommand(tapOnElement=null, tapOnPoint=null, tapOnPointV2Command=null, scrollCommand=null, swipeCommand=null, backPressCommand=null, assertCommand=null, assertConditionCommand=null, inputTextCommand=null, inputRandomTextCommand=null, launchAppCommand=LaunchAppCommand(appId=org.wikipedia, clearState=true, clearKeychain=null, stopApp=null, permissions=null, launchArguments=null, label=null), applyConfigurationCommand=null, openLinkCommand=null, pressKeyCommand=null, eraseTextCommand=null, hideKeyboardCommand=null, takeScreenshotCommand=null, stopAppCommand=null, killAppCommand=null, clearStateCommand=null, clearKeychainCommand=null, runFlowCommand=null, setLocationCommand=null, repeatCommand=null, copyTextCommand=null, pasteTextCommand=null, defineVariablesCommand=null, runScriptCommand=null, waitForAnimationToEndCommand=null, evalScriptCommand=null, scrollUntilVisible=null, travelCommand=null, startRecordingCommand=null, stopRecordingCommand=null, addMediaCommand=null, setAirplaneModeCommand=null, toggleAirplaneModeCommand=null), logMessages=[], insight=Insight(message=, level=NONE))
[INFO ] maestro.Maestro - Clearing app state org.wikipedia
[INFO ] maestro.Maestro - Launching app org.wikipedia
[INFO ] maestro.Maestro - Taking screenshot: /var/folders/r6/5z0bypqn4cb8p369zlrfhw3c0000gn/T/screenshot-1724236584313799714500118837704.png
[INFO ] maestro.utils.ScreenshotUtils - Taking screenshot to output sink
[INFO ] m.cli.runner.MaestroCommandRunner - Launch app "org.wikipedia" with clear state FAILED

@bartekpacia bartekpacia added bug Something isn't working P2 Important and valid issues not at the top of the work list platform: android Testing Android apps is affected maestro studio Related to Maestro Studio maestro cli Related to the command-line Maestro tool labels Aug 21, 2024
@bartekpacia
Copy link
Contributor

Additionally, I also tested on iOS and there's a different bug – Maestro Studio stops working, i.e. the emulator screenshot stops refreshing.

repro:
0. Run iOS simulator (I used iOS 17.5)
0. maestro download-samples

  1. maestro studio
  2. in a new tab maestro test samples/ios-flow.yaml
studio logs
$ maestro studio
Running on iPhone 15 - iOS 17.5 - BCFE83EE-F9A2-4612-B7B4-4CB05CE2406B

╭────────────────────────────────────────────────────────╮
│                                                        │
│   Maestro Studio is running at http://localhost:9999   │
│                                                        │
╰────────────────────────────────────────────────────────╯


Tip: Maestro Studio can now run simultaneously alongside other Maestro CLI commands!

Navigate to http://localhost:9999 in your browser to open Maestro Studio. Ctrl-C to exit.
java.io.EOFException: Unexpected end of ZLIB input stream
	at java.base/java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:244)
	at org.apache.commons.compress.archivers.zip.InflaterInputStreamWithStatistics.fill(InflaterInputStreamWithStatistics.java:52)
	at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
	at org.apache.commons.compress.archivers.zip.InflaterInputStreamWithStatistics.read(InflaterInputStreamWithStatistics.java:67)
	at org.rauschig.jarchivelib.ZipFileArchiver$ZipFileArchiveInputStream.read(ZipFileArchiver.java:72)
	at java.base/java.io.InputStream.read(InputStream.java:218)
	at org.rauschig.jarchivelib.IOUtils.copy(IOUtils.java:82)
	at org.rauschig.jarchivelib.IOUtils.copy(IOUtils.java:66)
	at org.rauschig.jarchivelib.IOUtils.copy(IOUtils.java:51)
	at org.rauschig.jarchivelib.CommonsArchiver.extract(CommonsArchiver.java:104)
	at org.rauschig.jarchivelib.CommonsArchiver.extract(CommonsArchiver.java:82)
	at xcuitest.installer.LocalXCTestInstaller.extractZipToApp(LocalXCTestInstaller.kt:196)
	at xcuitest.installer.LocalXCTestInstaller.startXCTestRunner(LocalXCTestInstaller.kt:161)
	at xcuitest.installer.LocalXCTestInstaller.start(LocalXCTestInstaller.kt:82)
	at xcuitest.api.NetworkErrorHandler.retryConnection(NetworkErrorHandler.kt:70)
	at xcuitest.XCTestDriverClient.addRetryInterceptor$lambda$8(XCTestDriverClient.kt:329)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
	at xcuitest.XCTestDriverClient.executeJsonRequest(XCTestDriverClient.kt:240)
	at xcuitest.XCTestDriverClient.viewHierarchy(XCTestDriverClient.kt:72)
	at ios.xctest.XCTestIOSDevice$viewHierarchy$1.invoke(XCTestIOSDevice.kt:40)
	at ios.xctest.XCTestIOSDevice$viewHierarchy$1.invoke(XCTestIOSDevice.kt:38)
	at ios.xctest.XCTestIOSDevice.execute(XCTestIOSDevice.kt:227)
	at ios.xctest.XCTestIOSDevice.viewHierarchy(XCTestIOSDevice.kt:38)
	at ios.LocalIOSDevice.viewHierarchy(LocalIOSDevice.kt:47)
	at maestro.drivers.IOSDriver.viewHierarchy(IOSDriver.kt:152)
	at maestro.drivers.IOSDriver.access$viewHierarchy(IOSDriver.kt:41)
	at maestro.drivers.IOSDriver$contentDescriptor$1.invoke(IOSDriver.kt:147)
	at maestro.drivers.IOSDriver$contentDescriptor$1.invoke(IOSDriver.kt:147)
	at maestro.drivers.IOSDriver.runDeviceCall(IOSDriver.kt:499)
	at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:147)
	at maestro.ViewHierarchy$Companion.from-8JJjmZI(ViewHierarchy.kt:29)
	at maestro.Maestro.viewHierarchy-c1iYVAs(Maestro.kt:422)
	at maestro.Maestro.viewHierarchy-c1iYVAs$default(Maestro.kt:421)
	at maestro.studio.DeviceService.getDeviceScreen(DeviceService.kt:172)
	at maestro.studio.DeviceService.access$getDeviceScreen(DeviceService.kt:43)
	at maestro.studio.DeviceService$routes$3$1.invokeSuspend(DeviceService.kt:82)
	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)
ℹ️ Retrying connection to the XCUITest server for 1...
Aug 21, 2024 11:47:03 AM okhttp3.internal.platform.Platform log
WARNING: A connection to http://[::1]:22087/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
ℹ️ Retrying connection to the XCUITest server for 1...
Aug 21, 2024 11:47:25 AM okhttp3.internal.platform.Platform log
WARNING: A connection to http://[::1]:22087/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
ℹ️ Retrying connection to the XCUITest server for 2...
ℹ️ Retrying connection to the XCUITest server for 2...
Aug 21, 2024 11:47:46 AM okhttp3.internal.platform.Platform log
WARNING: A connection to http://[::1]:22087/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
Aug 21, 2024 11:47:46 AM okhttp3.internal.platform.Platform log
WARNING: A connection to http://[::1]:22087/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);

@bartekpacia bartekpacia added the platform: ios Testing iOS apps is affected label Aug 21, 2024
@ahervieuxgirard
Copy link

@bartekpacia Hello i'm the other guy that is working with @pplourde

I simply ran maestro studio first then my script using simple command : maestro test flowb.yml

The flow :

---
appId: com.google.android.youtube

tags:
  - batman
  - robin

---

- launchApp:
    appId: "com.google.android.youtube"

@zubairehman
Copy link

any update on this? facing the same issue

@theapache64
Copy link

happening to me as well

@C0dingBee
Copy link

me too

@guillempuche
Copy link

Same in v1.39.1

@SmartProjetos
Copy link

Still happening in v1.39.9

@jerone
Copy link

jerone commented Feb 14, 2025

Duplicate #2188

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 maestro studio Related to Maestro Studio P2 Important and valid issues not at the top of the work list platform: android Testing Android apps is affected platform: ios Testing iOS apps is affected
Projects
None yet
Development

No branches or pull requests

9 participants