Skip to content

WebSocket connection closed #148

@artikbharoliya

Description

@artikbharoliya

Mobilewright version

0.0.39

Operating system

Windows 11

Target platform

Android

Device or simulator

Pixel_9_Pro API 36.0 Emulator

Minimal reproduction

I have a test case with 3 assertions and 15 actions.
I am using Pixel_9_Pro emulator with Android 16.0 ("Baklava") | x86_64 with API level 36.0
Node versions: tried with v20.20.2 & v24.16.0

Running the test using
npx mobilewright test

Here's the mobilewright config used:

module.exports = defineConfig({
  testDir: './tests',
  platform: 'android',
  bundleId: '<REMOVED_FOR_PRIVACY>',
  reporter: 'html',
  timeout: 500_000,
});

Actual behavior

  • The test runs fine for around 1.9 minutes, and after that, Mobilewright is stuck.
  • The test fails after the time out with the following error:
Error: WebSocket connection closed (code=1006, reason=no reason)
    at WebSocket.<anonymous> (C:\Users\<USER>\Documents\Playground\node_modules\@mobilewright\driver-mobilecli\src\rpc-client.ts:97:22)
    at WebSocket.emitClose (C:\Users\<USER>\Documents\Playground\node_modules\ws\lib\websocket.js:273:10)
    at Socket.socketOnClose (C:\Users\<USER>\Documents\Playground\node_modules\ws\lib\websocket.js:1346:15)

Expected behavior

  • The mobilewright should execute all the steps.

Additional context

mobilewright doctor output:

mobilewright doctor  v0.0.39
────────────────────────────────────────────────────────────

  System
    ✓  Windows  10.0.26200.8457
    ✓  winget  1.28.240
    ✓  Git  2.54.0.windows.1
    ✓  Node.js  v24.16.0
    ✓  npm  C:\Program Files\nodejs\npm
    ✓  mobilecli  mobilecli version 0.3.74
    ✓  mobilecli devices  1 online device
       Pixel 9 Pro (Pixel_9_Pro) — agent: com.mobilenext.devicekit v1.1.2

  Android
    ✓  Java (JDK)  17.0.12
    ✓  JAVA_HOME  C:\Program Files\Java\jdk-17
    ✓  ANDROID_HOME  C:\Users\artik\AppData\Local\Android\Sdk
    ✓  ADB (Android Debug Bridge)  1.0.41
    ✓  ADB Devices  1 device connected
       ["emulator-5556"]
    ✓  Android Emulator  36.1.9.0
    ✓  Android SDK Platforms  API 36 (latest)  [2 platforms installed]
    ✓  Android Build Tools  36.0.0 (latest)  [2 versions installed]
    ⚠  Windows Hypervisor Platform
       Could not determine Hypervisor Platform status. Android Emulator requires hardware acceleration.
         # Enable via admin PowerShell:
       → Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All -NoRestart
         # Or: Settings → System → Optional Features → Windows Hypervisor Platform
    ⚠  Windows Defender SDK Exclusion
       Could not read Defender exclusions. Adding the Android SDK improves build performance.
         # Run in admin PowerShell:
       → Add-MpPreference -ExclusionPath "$env:LOCALAPPDATA\Android\Sdk"
       → Add-MpPreference -ExclusionPath "$env:USERPROFILE\.gradle"

────────────────────────────────────────────────────────────
  Summary  15 ok · 2 warnings
  Warnings are optional but recommended.```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions