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
318 stars 98 forks source link

Error 500 trying to start the session #1260

Closed WolfmosRioja closed 1 month ago

WolfmosRioja commented 1 month ago

Describe the bug

I'm receiving a 500 when I'm trying to start the new session. I've tried uninstalling and installing Appium and playing with the capabilities but it's not working. Could you help me, please? ;)

command to enable the server sudo appium server -ka 800 --use-plugins=device-farm,appium-dashboard --config /Users/iosdevicefarm/Desktop/farm/hubconfig.json -pa /wd/hub

And the capabilities

{
  "server": {
    "port": 4723,
    "plugin": {
      "device-farm": {
        "platform": "ios",
        "maxSessions": 10,
        "iosDeviceType": "real",
        "liveStreaming": true,
        "enableDashboard":true,
        "wdaBundleId": "com.app.WebDriverAgentRunner",
        "derivedDataPath": {
          "device": "/Users/iosdevicefarm/Desktop/wda/WebDriverAgent"
        },
        "preBuildWDAPath": "/Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app"
      }
    }
  }
}

Trace received in my framework

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Cannot read properties of undefined (reading 'df:skipReport') Host info: host: 'MBP-de-iOS.localdomain', ip: 'xxxxxx' Build info: version: '4.23.0', revision: '4df0a231af' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '11.0.11' Driver info: io.appium.java_client.ios.IOSDriver Command: [null, newSession {capabilities=[Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:includeSafariInWebviews: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, df:skipReport: false, df:tags: [17], platformName: IOS}]}] Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:includeSafariInWebviews: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, df:skipReport: false, df:tags: [17], platformName: IOS} at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527) at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103) at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:101) at com.app.managers.AppiumDriverManager.localDriver(AppiumDriverManager.java:69) at com.app.managers.AppiumDriverManager.startAppiumDriverInstance(AppiumDriverManager.java:51) at com.app.hooks.Hooks.beforeScenario(Hooks.java:29)

And here the server log

[AppiumDriver@c5ad] Plugins which can handle cmd 'createSession': device-farm,appium-dashboard [AppiumDriver@c5ad] Plugin appium-dashboard is now handling cmd 'createSession' [AppiumDriver@c5ad] Plugin device-farm is now handling cmd 'createSession' [device-farm-main] 📱 pluginArgs: {"platform":"ios","iosDeviceType":"real","androidDeviceType":"both","skipChromeDownload":true,"maxSessions":10,"derivedDataPath":{"device":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent"},"adbRemote":[],"emulators":[],"simulators":[],"deviceAvailabilityTimeoutMs":300000,"deviceAvailabilityQueryIntervalMs":10000,"sendNodeDevicesToHubIntervalMs":30000,"checkStaleDevicesIntervalMs":30000,"checkBlockedDevicesIntervalMs":30000,"newCommandTimeoutSec":60,"bindHostOrIp":"192.168.34.182","enableDashboard":true,"removeDevicesFromDatabaseBeforeRunningThePlugin":false,"remoteConnectionTimeout":60000,"liveStreaming":true,"wdaBundleId":"com.app.WebDriverAgentRunner","preBuildWDAPath":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app"} [device-farm-main] Receiving session request at host: 192.168.34.182 [device-farm-main] 📱 Creating temporary session capability_id: 7535a189-6ca3-4e0e-abac-deec3c10d3b6 [device-farm-main] Max session count: 10, Busy device count: 0 [device-farm-main] Waiting for free device. Filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false,"tags":["17"]}} [device-farm-main] Updated devices with filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false,"tags":{"$containsAny":["17"]}} [device-farm-main] Updated devices with filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false,"tags":{"$containsAny":["17"]}} [device-farm-main] 📱 Blocking device 00008120-000224542ED8C01E at host http://192.168.34.182:4723 for new session [device-farm-main] Updating allocated device: "{"userBlocked":false,"offline":false,"wdaLocalPort":64253,"mjpegServerPort":64254,"udid":"00008120","sdk":"17.2.1","name":"iPhone 14 pro2 iOS17","busy":false,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://192.168.34.182:4723","wdaBundleId":"","productModel":"iPhone15,2","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"393","height":"852","tags":["17"],"webDriverAgentUrl":"http://192.168.34.182:64253","nodeId":"0ab24d61-e7f0-4ce4-a70c-71a66169d35e","meta":{"revision":10,"created":1722864921187,"version":0,"updated":1722864921537},"$loki":2,"dashboard_link":"http://127.0.0.1:4723/dashboard?deviceUDID=00008120&start_time=2024-08-05T13:35:17.743Z","total_session_count":0}" [device-farm-main] Updated allocated device: "[{"userBlocked":false,"offline":false,"wdaLocalPort":64253,"mjpegServerPort":64254,"udid":"00008120","sdk":"17.2.1","name":"iPhone 14 pro2 iOS17","busy":true,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://192.168.34.182:4723","wdaBundleId":"","productModel":"iPhone15,2","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"393","height":"852","tags":["17"],"webDriverAgentUrl":"http://192.168.34.182:64253","nodeId":"0ab24d61-e7f0-4ce4-a70c-71a66169d35e","meta":{"revision":12,"created":1722864921187,"version":0,"updated":1722864941278},"$loki":2,"dashboard_link":"http://127.0.0.1:4723/dashboard?deviceUDID=00008120&start_time=2024-08-05T13:35:17.743Z","total_session_count":0,"newCommandTimeout":100}]" [device-farm-main] device.host: http://192.168.34.182:4723 and pluginArgs.bindHostOrIp: 192.168.34.182 [device-farm-main] 📱 Creating session on the same node [AppiumDriver@c5ad] Command 'createSession' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["device-farm","appium-dashboard"]. [AppiumDriver@c5ad] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'df:skipReport') at L.<computed>.step (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/modules/device-control/index.js:68:18) at Generator.next (<anonymous>) at /Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/modules/device-control/index.js:8:9 at new Promise (<anonymous>) at __awaiter (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/modules/device-control/index.js:4:12) at L.<computed>.beforeSessionCreate (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/modules/device-control/index.js:55:16) at /Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/emittery/index.js:363:13 at Array.map (<anonymous>) at Emittery.emit (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/emittery/index.js:361:23) [HTTP] <-- POST /wd/hub/session 500 114 ms - 622

sudharsan-selvaraj commented 1 month ago

@WolfmosRioja appium-dashboard plugin is now integrated with device-farm. So you don't have to include it when starting the appium server. The command for starting the server will now look like

sudo appium server -ka 800 --use-plugins=device-farm --config /Users/iosdevicefarm/Desktop/farm/hubconfig.json  -pa /wd/hub
WolfmosRioja commented 1 month ago

Hi @sudharsan-selvaraj , I've tried with and without the dashboard plugin and with and without sudo. same result...

saikrishna321 commented 1 month ago

@WolfmosRioja Please check with latest version 9.1.1 We have fixed the issue. Also your server args can be changed

{
  "server": {
    "port": 4723,
    "plugin": {
      "device-farm": {
        "platform": "ios",
        "maxSessions": 10,
        "iosDeviceType": "real"
      }
    }
  }
}
WolfmosRioja commented 1 month ago

Hi @saikrishna321 I have tried with that server config and this is the result:

`
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Error: App with bundle identifier 'com.app.App-Staging' unknown 
Host info: host: 'MBP-de-iOS.localdomain', ip: 'fe80:0:0:0:1cc6:388b:22aa:b14e%en0'
Build info: version: '4.23.0', revision: '4df0a231af'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '11.0.11'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [null, newSession {capabilities=[Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app.App-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, df:liveVideo: false, df:skipReport: true, df:tags: [16], platformName: IOS}]}]
Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app.App-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, df:liveVideo: false, df:skipReport: true, df:tags: [16], platformName: IOS}

    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
    at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:101)
    at com.app.managers.AppiumDriverManager.localDriver(AppiumDriverManager.java:69)
    at com.app.managers.AppiumDriverManager.startAppiumDriverInstance(AppiumDriverManager.java:51)
    at com.app.hooks.Hooks.beforeScenario(Hooks.java:29)`

And here the server logs


`[AppiumDriver@d13c] Appium v2.11.2 creating new XCUITestDriver (v7.24.12) session
[AppiumDriver@d13c] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@d13c] Appium's BaseDriver version is 9.11.2
[AppiumDriver@d13c] XCUITestDriver's BaseDriver version is 9.11.2
[XCUITestDriver@d95a] undefined
[XCUITestDriver@d95a] Creating session with W3C capabilities: {
  "alwaysMatch": {
    "df:liveVideo": false,
    "df:skipReport": true,
    "df:tags": [
      "16"
    ],
    "platformName": "IOS",
    "appium:appPushTimeout": 60000,
    "appium:autoLaunch": false,
    "appium:automationName": "XCUITest",
    "appium:bundleId": "com.app.App-Staging",
    "appium:clearSystemFiles": true,
    "appium:derivedDataPath": "/Users/iosdevicefarm/Desktop/wda/WebDriverAgent",
    "appium:enforceAppInstall": true,
    "appium:fullReset": true,
    "appium:launchWithIDB": true,
    "appium:maxTypingFrequency": 10,
    "appium:newCommandTimeout": 100,
    "appium:prebuiltWDAPath": "/Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app",
    "appium:showXcodeLog": false,
    "appium:updatedWDABundleId": "com.app.WebDriverAgentRunner",
    "appium:useJSONSource": true,
    "appium:useNativeCachingStrategy": true,
    "appium:usePrebuiltWDA": true,
    "appium:wdaConnectionTimeout": 40000,
    "appium:wdaLaunchTimeout": 80000,
    "appium:udid": "00008120-",
    "appium:deviceName": "iPhone 14 Pro iOS16",
    "appium:platformVersion": "16.4.1"
  },
  "firstMatch": [
    {}
  ]
}
[XCUITestDriver@d95a] The following provided capabilities were not recognized by this driver:
[XCUITestDriver@d95a]   df:liveVideo
[XCUITestDriver@d95a]   df:skipReport
[XCUITestDriver@d95a]   df:tags
[882f0f4e][XCUITestDriver@d95a] Session created with session id: 882f0f4e-38bb-49d9-9252-ea0564bd4ccf
[46e22bae][iProxy@00008120:51040] Connection was refused to port 51040
[882f0f4e][XCUITest] Current user: 'iosdevicefarm'
[882f0f4e][XCUITestDriver@d95a] Available real devices: c47b35935eeefd5ea5cec61394f777fecadeb8e3, 00008120-, 00008101-, 00008030-, 00008101-, 00008110-, 00008030-, 00008120-, 00008120-
[882f0f4e][XCUITestDriver@d95a] Creating iDevice object with udid '00008120-'
[882f0f4e][XCUITestDriver@d95a] Determining device to run tests on: udid: '00008120-', real device: true
[882f0f4e][XCUITestDriver@d95a] Normalized platformVersion capability value '16.4.1' to '16.4'
[882f0f4e][XCUITestDriver@d95a] Event 'xcodeDetailsRetrieved' logged at 1722926867149 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][XCUITestDriver@d95a] Event 'appConfigured' logged at 1722926867149 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][XCUITestDriver@d95a] Event 'resetStarted' logged at 1722926867149 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][XCUITestDriver@d95a] Reset: running ios real device reset flow
[882f0f4e][XCUITestDriver@d95a] Reset: fullReset requested. Will try to uninstall the app 'com.app.App-Staging'.
[882f0f4e][XCUITestDriver@d95a] Reset: app not installed. No need to uninstall
[882f0f4e][XCUITestDriver@d95a] Event 'resetComplete' logged at 1722926867310 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][XCUITestDriver@d95a] Using WDA path: '/Users/iosdevicefarm/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[882f0f4e][XCUITestDriver@d95a] Using WDA agent: '/Users/iosdevicefarm/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[882f0f4e][XCUITestDriver@d95a] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[882f0f4e][XCUITestDriver@d95a] Event 'logCaptureStarted' logged at 1722926867429 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][XCUITestDriver@d95a] Setting up real device
[882f0f4e][XCUITestDriver@d95a] [ "App with bundle identifier 'com.app.App-Staging' unknown" ]
[882f0f4e][XCUITestDriver@d95a] {}
[882f0f4e][DevCon Factory] Releasing connections for 00008120-device on any port number
[882f0f4e][DevCon Factory] No cached connections have been found
[882f0f4e][XCUITest] Did not find the temporary XCTest logs root at '/var/folders/54/81fz9jkd47q09yxhs5x75rxm0000gn/T/com.apple.dt.XCTest*/'
[882f0f4e][XCUITest] There is no /Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Logs folder, so not cleaning files
[882f0f4e][AppiumDriver@d13c] Event 'newSessionStarted' logged at 1722926867604 (08:47:47 GMT+0200 (Central European Summer Time))
[882f0f4e][device-farm-/Users/iosdevicefarm/.appium] 📱 d6bf95ff-4503-4fd6-9b26-8d1dc1dbb379 Session response:  {"protocol":"W3C","error":{}}
[882f0f4e][device-farm-/Users/iosdevicefarm/.appium] 📱 Removing pending session with capability_id: d6bf95ff-4503-4fd6-9b26-8d1dc1dbb379
[882f0f4e][device-farm-/Users/iosdevicefarm/.appium] d6bf95ff-4503-4fd6-9b26-8d1dc1dbb379 📱 Device UDID 00008120-unblocked. Reason: Failed to create session
[882f0f4e][AppiumDriver@d13c] Encountered internal error running command: Error: Error: App with bundle identifier 'com.app.App-Staging' unknown
    at MB.this (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:342:23)
    at MB.generator (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:328:17)
    at Generator.next (<anonymous>)
    at Mn (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:28:48)
[882f0f4e][HTTP] <-- POST /wd/hub/session 500 480 ms - 642`

That bundleID is real and it was working without the device-farm plugin.

Thanks in advance

saikrishna321 commented 1 month ago

@WolfmosRioja Is the bundleId with app installed on the device? Error is coming from AppiumDriver [882f0f4e][AppiumDriver@d13c] Encountered internal error running command: Error: Error: App with bundle identifier 'com.app.App-Staging' unknown

WolfmosRioja commented 1 month ago

@saikrishna321 yes, the app is installed. I've found info and I've uploaded the wda-resign.ipa into the frontend. Now this is the log

Framework:


[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 13.06 s <<< FAILURE! -- in 01 ToDoFeature
[ERROR] 01 ToDoFeature.To Do - As a user I callback and item disappear in ToDo section - answer -- Time elapsed: 13.06 s <<< ERROR!
org.openqa.selenium.SessionNotCreatedException: 
Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Condition unmet after 10110 ms. Timing out. 
Host info: host: 'MBP-de-iOS.localdomain', ip: 'fe8'
Build info: version: '4.23.0', revision: '4df0a231af'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '11.0.11'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [null, newSession {capabilities=[Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app.App-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:includeSafariInWebviews: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, platformName: IOS}]}]
Capabilities {appium:app: /Users/iosdevicefarm/Deskto..., appium:appPushTimeout: 60000, appium:autoLaunch: false, appium:automationName: XCUITest, appium:bundleId: com.app.App-Staging, appium:clearSystemFiles: true, appium:derivedDataPath: /Users/iosdevicefarm/Deskto..., appium:enforceAppInstall: true, appium:fullReset: true, appium:includeSafariInWebviews: true, appium:launchWithIDB: true, appium:maxTypingFrequency: 10, appium:newCommandTimeout: 100, appium:prebuiltWDAPath: /Users/iosdevicefarm/Deskto..., appium:settings[boundElementsByIndex]: true, appium:settings[customSnapshotTimeout]: 100, appium:settings[snapshotMaxDepth]: 80, appium:settings[useFirstMatch]: true, appium:showXcodeLog: false, appium:updatedWDABundleId: com.app.WebDriverAgentR..., appium:useJSONSource: true, appium:useNativeCachingStrategy: true, appium:usePrebuiltWDA: true, appium:wdaConnectionTimeout: 40000, appium:wdaLaunchTimeout: 80000, platformName: IOS}
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:91)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:103)
    at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:101)
    at com.app.managers.AppiumDriverManager.localDriver(AppiumDriverManager.java:69)
    at com.app.managers.AppiumDriverManager.startAppiumDriverInstance(AppiumDriverManager.java:51)
    at com.app.hooks.Hooks.beforeScenario(Hooks.java:29)

And server


[device-farm-main] Found 0 device candidates to be released
[device-farm-main] Cleaning pending sessions...
[device-farm-main] No pending sessions to clean
[HTTP] Request idempotency key: 638742de-fc9d-44d5-8707-e2e11f44d59f
[HTTP] --> POST /wd/hub/session {"capabilities":{"firstMatch":[{"appium:app":"/Users/iosdevicefarm/Desktop/mobile-automation/App.ipa","appium:appPushTimeout":60000,"appium:autoLaunch":false,"appium:automationName":"XCUITest","appium:bundleId":"com.app.App-Staging","appium:clearSystemFiles":true,"appium:derivedDataPath":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent","appium:enforceAppInstall":true,"appium:fullReset":true,"appium:includeSafariInWebviews":true,"appium:launchWithIDB":true,"appium:maxTypingFrequency":10,"appium:newCommandTimeout":100,"appium:prebuiltWDAPath":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app","appium:settings[boundElementsByIndex]":true,"appium:settings[customSnapshotTimeout]":100,"appium:settings[snapshotMaxDepth]":80,"appium:settings[useFirstMatch]":true,"appium:showXcodeLog":false,"appium:updatedWDABundleId":"com.app.WebDriverAgentRunner","appium:useJSONSource":true,"appium:useNativeCachingStrategy":true,"appium:usePrebuiltWDA":...
[AppiumDriver@3b1b] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{"appium:app":"/Users/iosdevicefarm/Desktop/mobile-automation/App.ipa","appium:appPushTimeout":60000,"appium:autoLaunch":false,"appium:automationName":"XCUITest","appium:bundleId":"com.app.App-Staging","appium:clearSystemFiles":true,"appium:derivedDataPath":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent","appium:enforceAppInstall":true,"appium:fullReset":true,"appium:includeSafariInWebviews":true,"appium:launchWithIDB":true,"appium:maxTypingFrequency":10,"appium:newCommandTimeout":100,"appium:prebuiltWDAPath":"/Users/iosdevicefarm/Desktop/wda/WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app","appium:settings[boundElementsByIndex]":true,"appium:settings[customSnapshotTimeout]":100,"appium:settings[snapshotMaxDepth]":80,"appium:settings[useFirstMatch]":true,"appium:showXcodeLog":false,"appium:updatedWDABundleId":"com.app.WebDriverAgentRunner","appium:useJSONSource":true,"appium:useNativeCachingStrategy":true,"appium:usePrebuiltWDA":true,...
[device-farm-main] 📱 Plugin Args: {"platform":"ios","maxSessions":10,"iosDeviceType":"real","androidDeviceType":"both"}
[AppiumDriver@3b1b] Plugins which can handle cmd 'createSession': device-farm
[AppiumDriver@3b1b] Plugin device-farm is now handling cmd 'createSession'
[device-farm-main] 📱 pluginArgs: {"platform":"ios","iosDeviceType":"real","androidDeviceType":"both","skipChromeDownload":true,"maxSessions":10,"adbRemote":[],"emulators":[],"simulators":[],"deviceAvailabilityTimeoutMs":300000,"deviceAvailabilityQueryIntervalMs":10000,"sendNodeDevicesToHubIntervalMs":30000,"checkStaleDevicesIntervalMs":30000,"checkBlockedDevicesIntervalMs":30000,"newCommandTimeoutSec":60,"bindHostOrIp":"192.168.34.182","enableDashboard":false,"removeDevicesFromDatabaseBeforeRunningThePlugin":false,"remoteConnectionTimeout":60000,"liveStreaming":true,"wdaBundleId":"","preBuildWDAPath":""}
[device-farm-main] Receiving session request at host: 192.168.34.182
[device-farm-main] 📱 Creating temporary session capability_id: f1abfde7-aee0-45ff-9020-13dfa4c92914
[device-farm-main] Max session count: 10, Busy device count: 0
[device-farm-main] Waiting for free device. Filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false}}
[device-farm-main] Updated devices with filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false}
[device-farm-main] Updated devices with filter: {"platform":"ios","deviceType":"real","busy":false,"userBlocked":false}
[device-farm-main] 📱 Blocking device c47b35935eeefd5ea5cec61394f777fecadeb8e3 at host http://192.168.34.182:4723 for new session
[device-farm-main] Updating allocated device: "{"userBlocked":false,"offline":false,"wdaLocalPort":52511,"mjpegServerPort":52512,"udid":"c47b35935eeefd5ea5","sdk":"16.7.5","name":"iPhone X iOS16","busy":false,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://192.168.34.182:4723","wdaBundleId":"","productModel":"iPhone10,3","totalUtilizationTimeMilliSec":18733,"sessionStartTime":0,"width":"375","height":"812","tags":["16"],"webDriverAgentUrl":"http://192.168.34.182:52511","nodeId":"6f9f2ae6-4f13-42fe-8540-b93a0d1f1f8f","meta":{"revision":10,"created":1722934771293,"version":0,"updated":1722934771530},"$loki":1}"
[device-farm-main] Updated allocated device: "[{"userBlocked":false,"offline":false,"wdaLocalPort":52511,"mjpegServerPort":52512,"udid":"c47b35935eeefd5ea5","sdk":"16.7.5","name":"iPhone X iOS16","busy":true,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://192.168.34.182:4723","wdaBundleId":"","productModel":"iPhone10,3","totalUtilizationTimeMilliSec":18733,"sessionStartTime":0,"width":"375","height":"812","tags":["16"],"webDriverAgentUrl":"http://192.168.34.182:52511","nodeId":"6f9f2ae6-4f13-42fe-8540-b93a0d1f1f8f","meta":{"revision":12,"created":1722934771293,"version":0,"updated":1722935091548},"$loki":1,"newCommandTimeout":100}]"
[device-farm-main] device.host: http://192.168.34.182:4723 and pluginArgs.bindHostOrIp: 192.168.34.182
[device-farm-main] 📱 Creating session on the same node
[device-farm-main] Installing Resigned WDA on real device
[device-farm-main] Successfully pushed the file payload (901.27 KB) to the remote location '/wda-resign.ipa' in 413ms
[device-farm-main] A new application installation is going to be performed. Will timeout in 240000 ms
[device-farm-main] The installation of 'devicefarm' succeeded after 2462ms
[DevCon Factory Device Farm] Requesting connection for device c47b35935eeefd5ea5cec61394f777fecadeb8e3 on local port 52511, device port 52511
[DevCon Factory Device Farm] Cached connections count: 0
[DevCon Factory Device Farm] Successfully requested the connection for c47b35935eeefd5ea5cec61394f777fecadeb8e3:52511
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[device-farm-main] Found 0 device candidates to be released
[device-farm-main] Cleaning pending sessions...
[device-farm-main] Session queue ID:f1abfde7-aee0-45ff-9020-13dfa4c92914 has been pending for 8282 ms
[device-farm-main] No pending sessions to clean
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[iProxy@c47b3593:52511] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[device-farm-main] ⏳Waiting for WDA to be up and running!!
[AppiumDriver@3b1b] Command 'createSession' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["device-farm"].
[AppiumDriver@3b1b] Encountered internal error running command: Error: Condition unmet after 10110 ms. Timing out.
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:234:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at spin (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:229:14)
    at waitForCondition (/Users/iosdevicefarm/.appium/node_modules/appium-device-farm/node_modules/asyncbox/lib/asyncbox.js:236:10)
[HTTP] <-- POST /wd/hub/session 500 12604 ms - 661
[HTTP] --> GET /device-farm/api/device {}
[device-farm-main] Received non-webdriver request with url /device-farm/api/device. So, not proxying it to downstream.
[HTTP] <-- GET /device-farm/api/device 200 1 ms - 5428
[HTTP] --> GET /device-farm/api/queue/length {}
[device-farm-main] Received non-webdriver request with url /device-farm/api/queue/length. So, not proxying it to downstream.
[HTTP] <-- GET /device-farm/api/queue/length 200 1 ms - 1

And IDK if it's important, but the dashboard ping is returning a 404


[HTTP] --> GET /device-farm/api/device {}
[device-farm-main] Received non-webdriver request with url /device-farm/api/device. So, not proxying it to downstream.
[HTTP] --> GET /dashboard/api/ping {}
[device-farm-main] Received non-webdriver request with url /dashboard/api/ping. So, not proxying it to downstream.
[HTTP] No route found for /dashboard/api/ping
[HTTP] <-- GET /dashboard/api/ping 404 9 ms - 211
[HTTP] <-- GET /device-farm/api/device 200 81 ms - 5405
[HTTP] --> GET /device-farm/api/queue/length {}
saikrishna321 commented 1 month ago

@WolfmosRioja Have you resigned the wda-resigned.ipa with right cert? Do you see "Automation Running" when you open the wda in your device?

WolfmosRioja commented 1 month ago

@saikrishna321 Yes, I can see it and I can manage the device in real live from the frontend

saikrishna321 commented 1 month ago

@WolfmosRioja What was the problem?

WolfmosRioja commented 1 month ago

@saikrishna321 the problem is still there. I can manage the device in real live but my automatic tests are not working (the logs attached before) IDK why the session can't start

saikrishna321 commented 1 month ago

Can you share full server logs pls

WolfmosRioja commented 1 month ago

@saikrishna321 it's working now!!!

The problem was launching with sudo. We had problems with permissions and more. I've changed the permission to /Users/myuser/.cache/ and /Users/myuser/.appium/ and now I can launch the tests. Thanks for all. I hope this solution can help others ;)