AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
324 stars 101 forks source link

Unable to create session for iOS test on LambdaTest #1133

Open alokkr016 opened 4 months ago

alokkr016 commented 4 months ago

The issue pertains to an error encountered while attempting to create a session using Appium, specifically involving the createSession command. Despite the default handlers being registered, the command was instead processed by the device-farm plugin. During this process, an internal error occurred, indicated by the message: "Unknown error while creating session."

Link to Appium logs

https://gist.github.com/alokkr016/7e1462dbc3285c42a7b546cb06e34d4c

Environment

  1. Appium version: 2.2.2
  2. Node.js version (unless using Appium.app|exe): 20.12.2
  3. Npm or Yarn package manager: 10.5.0
  4. Mobile platform/version under test: iOS-16
  5. Real device
sudharsan-selvaraj commented 4 months ago

@alokkr016 Looks like the request to lambdatest server are failing due to timeout which is default to 60s. Can you increase the timeout to some higher value using the plugin argument --plugin-device-farm-remote-connection-timeout 120000 (in MilliSeconds)

alokkr016 commented 4 months ago

Still getting the same error : https://gist.github.com/alokkr016/d05a2936ceb5ce7cc525cd60629b4cd4 Even when I am able to create a session, the commands are not being sent. CleanShot 2024-05-28 at 23 46 53@2x Could you please tell me which new capabilities I should add or remove from the current ones?

saikrishna321 commented 4 months ago

@alokkr016 looks like your machine is unable to connect lambdatest hub. Can you check if your behind proxy

alokkr016 commented 4 months ago

I am able to connect after increasing the remote connection timeout, but I am not able to Send Commands

saikrishna321 commented 4 months ago

What is the error ?

alokkr016 commented 4 months ago

CleanShot 2024-05-29 at 20 03 14@2x

Logs : https://gist.github.com/alokkr016/d05a2936ceb5ce7cc525cd60629b4cd4

saikrishna321 commented 4 months ago

@alokkr016 Can you try making the request from postman

https://username:password@mobile-hub.lambdatest.com/wd/hub/session

{
    "capabilities": {
        "firstMatch": [
            {}
        ],
        "alwaysMatch": {
            "appium:autoAcceptAlerts": true,
            "appium:idleTimeout": 300,
            "appium:newCommandTimeout": 30,
            "platformName": "IOS",
            "appium:build": "Lambda IOS suite",
            "appium:app": "lt://APP1016055611715975022871754",
            "appium:platformVersion": "16",
            "appium:isRealMobile": "True",
            "appium:appiumVersion": "2.0",
            "appium:wdaLaunchTimeout": 60000,
            "appium:automationName": "XCuiTest",
            "appium:deviceName": "iPhone 14 Pro Max",
            "appium:platform": "ios"
        },
        "pendingSessionId": "71b994c7-685e-4ae1-a2a1-f276cc0a0203"
    },
    "desiredCapabilities": {
        "appium:autoAcceptAlerts": true,
        "appium:idleTimeout": 300,
        "appium:newCommandTimeout": 30,
        "platformName": "IOS",
        "appium:build": "Lambda IOS suite",
        "appium:app": "lt://APP1016055611715975022871754",
        "appium:platformVersion": "16",
        "appium:isRealMobile": "True",
        "appium:appiumVersion": "2.0",
        "appium:wdaLaunchTimeout": 60000,
        "appium:automationName": "XCuiTest",
        "appium:deviceName": "iPhone 14 Pro Max",
        "appium:platform": "ios"
    }
}

can you share the output of this request ? 
alokkr016 commented 4 months ago

@saikrishna321

CleanShot 2024-05-29 at 22 40 01@2x

Output :


{
  "value": {
    "capabilities": {
      "autoAcceptAlerts": true,
      "automationName": "XCUITest",
      "browserName": "",
      "bundleID": "com.ninja.dream.qa",
      "bundleId": "com.ninja.dream.qa",
      "databaseEnabled": false,
      "derivedDataPath": "/Users/ltadmin/Documents/appium/2.0-10-8-23-mac/build/",
      "deviceName": "iPhone 14 Pro Max",
      "headless": false,
      "javascriptEnabled": true,
      "locationContextEnabled": false,
      "nativeWebScreenshot": true,
      "networkConnectionEnabled": false,
      "newCommandTimeout": 0,
      "noReset": false,
      "orientation": "PORTRAIT",
      "platform": "MAC",
      "platformName": "ios",
      "platformVersion": "16",
      "takesScreenshot": true,
      "udid": "00008120-000C581C0244C01E",
      "uiautomator2ServerLaunchTimeout": "60000",
      "usePrebuiltWDA": true,
      "waitForQuiescence": false,
      "wdaLaunchTimeout": 60000,
      "wdaLocalPort": 11011,
      "wdaStartupRetries": 3,
      "webStorageEnabled": false,
      "webkitResponseTimeout": 20000
    },
    "sessionId": "3c2b2323-2cd1-43fa-af11-8655af4b6dd4"
  }
}
saikrishna321 commented 4 months ago

@alokkr016 Are you behind a corporate proxy ?

alokkr016 commented 4 months ago

@saikrishna321 No, I am not using any proxy.