mobile-dev-inc / maestro

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

Maestro doesn't work with WSL 2 #1863

Open NinoDLC opened 1 month ago

NinoDLC commented 1 month ago

Is there an existing issue for this?

Steps to reproduce

1/ Follow the tutorial : https://maestro.mobile.dev/getting-started/installing-maestro/windows 2/ On Powershell, you should launch this command : adb -a -P 5037 nodaemon server

07-30 15:36:51.787 14820 14216 I adb.exe : auth.cpp:416 adb_auth_init...
07-30 15:36:51.792 14820 14216 I adb.exe : auth.cpp:152 loaded new key from 'C:\Users\Nino\.android\adbkey' with fingerprint <...>
07-30 15:36:51.792 14820  8748 I adb.exe : transport.cpp:338 emulator-5554: read thread spawning
07-30 15:36:51.793 14820 10548 I adb.exe : transport.cpp:310 emulator-5554: write thread spawning
07-30 15:36:51.802 14820 14216 I adb.exe : transport.cpp:1704 fetching keys for transport emulator-5554
07-30 15:36:51.802 14820 14216 I adb.exe : auth.cpp:468 Calling send_auth_response
07-30 15:36:51.820 14820 14216 I adb.exe : adb.cpp:180 emulator-5554: offline

3/ On WSL (another tab), you should launch :

C:\Work> wsl
nino@Desktino:/mnt/c/Work$ adb kill-server
cannot connect to daemon at tcp:5037: Connection refused
nino@Desktino:/mnt/c/Work$ export ADB_SERVER_SOCKET=tcp:192.168.1.10:5037
nino@Desktino:/mnt/c/Work$ adb devices
List of devices attached
emulator-5554   device

nino@Desktino:/mnt/c/Work$ cd lapresse/rubicon
nino@Desktino:/mnt/c/Work/lapresse/rubicon$ maestro --host 192.168.1.10 test -e APP_ID=ca.lapresse.android.lapressemobile.debug flows/run_flow.yaml

------------------ Shard 1 ------------------

Please specify a device platform [android, ios, web]:
android

Please specify Android version [34, 33, 31, 30, 29, 28]: Press ENTER for default (30)

Attempting to create Android emulator: Maestro_Pixel_6_API_30_1

Created Android emulator: Maestro_Pixel_6_API_30_1 (system-images;android-30;google_apis;x86_64)

❌ Error: BlockingCoroutine is cancelling
kotlinx.coroutines.JobCancellationException: BlockingCoroutine is cancelling; job=BlockingCoroutine{Cancelling}@28a65353
Caused by: maestro.cli.CliError: Unable to start device: Maestro_Pixel_6_API_30_1
        at maestro.cli.device.DeviceService.startDevice(DeviceService.kt:74)
        at maestro.cli.command.TestCommand$handleSessions$1$1$results$1$1.invokeSuspend(TestCommand.kt:237)
        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)

Actual results

It obviously doesn't work

Expected results

It should work, as it works on MacOS

About app

N/A, Maestro doesn't even recognize my emulator

About environment

C:\Work> java -version
java version "17.0.5" 2022-10-18 LTS
Java(TM) SE Runtime Environment (build 17.0.5+9-LTS-191)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.5+9-LTS-191, mixed mode, sharing)
C:\Work> wsl
java nino@Desktino:/mnt/c/Work$ java -version
openjdk version "21.0.3" 2024-04-16
OpenJDK Runtime Environment (build 21.0.3+9-Ubuntu-1ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 21.0.3+9-Ubuntu-1ubuntu122.04.1, mixed mode, sharing)
nino@Desktino:/mnt/c/Work$

Windows 11 Pro 23H2 (22631.3880) Ubuntu 22.04 (WSL)

Logs

No response

Maestro version

1.37.3

How did you install Maestro?

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

Anything else?

No response

bartekpacia commented 1 month ago

Hey @NinoDLC, did it work on v1.36.x?

NinoDLC commented 1 month ago

I didn't have the chance to try, this is my first time using Maestro on Windows so I got the last version, as the tutorial suggested

qazando commented 1 month ago

i have the same problem.

qazando commented 1 month ago

erro windows me too

qazando commented 1 month ago

My friend, i have success now. I changed my version to: 1.19.0. Now i have success on windows.

dannmf commented 1 month ago

Ei@NinoDLC, funcionou na v1.36.x?

In 1.36.x it is working correctly

TheNextBigThing14 commented 5 days ago

My friend, i have success now. I changed my version to: 1.19.0. Now i have success on windows.

how to change its version, im having the same issue.

PedroW21 commented 4 days ago

My friend, i have success now. I changed my version to: 1.19.0. Now i have success on windows.

how to change its version, im having the same issue.

Documentation