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

Apple TV 4K tvOS 17 & XCode 15.0.1 - Appium unable to find the device though connected #19343

Closed
3 tasks done
monankpastakia opened this issue Oct 24, 2023 · 36 comments
Closed
3 tasks done
Labels
iOS related to iOS native driver(s) ThirdParty upstream problems

Comments

@monankpastakia
Copy link

Do I have the most recent component updates?

  • I use the most recent available driver/plugin and server versions

Is the component officially supported by the Appium team?

  • I have verified the component repository is present under the Appium organization in GitHub

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Apple TV 4K with tvOS 17, and XCode v15.0.1 - Able to install the WDA file on the device using xcode. However, when we try to connect device/launch the app using the Appium.

Getting Error: Failed to create session. An unknown server-side error occurred while processing the command. Original error: Unknown device or simulator UDID: ''

Expected Behavior

Appium should find the real device connected as it is on the same network.

NOTE: Same device with tvOS 16.4 - Appium was working fine without any issue.

Minimal Reproducible Example

  • Apple TV 4K with tvOS 17.0
  • XCode 15.0.1
  • Run Appium in the terminal: appium
  • Open the Appium inspector using localhost, port: 4723, path: /
  • Try to connect Apple TV 4K box using capabilities to start Session
  • {
    "appium:udid": "5303ccb3e6d75f625e2bdba375ab03064fad5e66",
    "appium:app": "com.apple.TVSettings",
    "platformName": "tvOS",
    "appium:noReset": true,
    "appium:fullReset": false,
    "appium:showXcodeLog": true,
    "appium:useNewWDA": false,
    "appium:automationName": "XCUITest",
    "appium:deviceName": "TSQAAPPLETV4K"
    }

Environment

  • Operating system: 14.0
  • Appium server version (output of appium --version): 2.2.1
  • Appium driver(s) and their version(s): xcuitest-driver 5.7.0, webdriveragent 5.11.5 (also tried 5.11.4)
  • Appium plugin(s) and their version(s):
  • Node.js version (output of node --version): 20.7.0
  • npm version (output of npm --version): 10.1.0
  • Last component(s) version which did not exhibit the problem: Appium 2.1.3, tvOS 16.4, XCode 15
  • Platform and version under test: Apple TV 4K tvOS 17.0, XCode 15.0.1
  • Real device or emulator/simulator: Real Device.
  • Connectivity: Ethernet (Both Real Device & MacBook connected with Ethernet for better connectivity)

Link to Appium Logs

https://gist.github.com/monankpastakia/29a5881d70fb2a78a3e3c6cda56d8a14

Further Information

No response

@monankpastakia monankpastakia added Bug a problem that needs fixing Needs Triage bugs which are not yet confirmed labels Oct 24, 2023
@mykola-mokhnach mykola-mokhnach added Needs Info typically non-actionable; needs author to respond and removed Bug a problem that needs fixing Needs Triage bugs which are not yet confirmed labels Oct 24, 2023
@mykola-mokhnach
Copy link
Collaborator

Also in v17 Apple did many breaking internal changes. Perhaps the support of AppleTV is affected as well

@mykola-mokhnach
Copy link
Collaborator

[XCUITestDriver@8c35 (03a56c5b)] Available devices: fffdc:56:e7:32:a8:8afff
[XCUITestDriver@8c35 (03a56c5b)] No real device with udid '5303ccb3e6d75f625e2bdba375ab03064fad5e66'. Looking for a simulator

Looks like now usbmux list defines devices by their network addresses rather than uuids. cc @KazuCocoa

@mykola-mokhnach mykola-mokhnach added iOS related to iOS native driver(s) and removed Needs Info typically non-actionable; needs author to respond labels Oct 24, 2023
@KazuCocoa
Copy link
Member

interesting... Perhaps it is tvOS 17 related since my local network connected iOS 17 and Xcode 15 had no such behavior

@KazuCocoa
Copy link
Member

What's happen when you use fffdc:56:e7:32:a8:8afff as appium:udid? @monankpastakia

@monankpastakia
Copy link
Author

I did try.. and it says:
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Could not find a pair record for device 'fffdc:56:e7:32:a8:8afff'. Please first pair with the device

My Device is paired like:
Screenshot 2023-10-24 at 1 51 57 PM

Appium Terminal Logs:
[XCUITestDriver@1619] Creating session with W3C capabilities: {
[XCUITestDriver@1619] "alwaysMatch": {
[XCUITestDriver@1619] "platformName": "tvOS",
[XCUITestDriver@1619] "appium:udid": "fffdc:56:e7:32:a8:8afff",
[XCUITestDriver@1619] "appium:app": "com.apple.TVSettings",
[XCUITestDriver@1619] "appium:noReset": true,
[XCUITestDriver@1619] "appium:fullReset": false,
[XCUITestDriver@1619] "appium:showXcodeLog": true,
[XCUITestDriver@1619] "appium:useNewWDA": false,
[XCUITestDriver@1619] "appium:automationName": "XCUITest",
[XCUITestDriver@1619] "appium:deviceName": "TSQAAPPLETV4K",
[XCUITestDriver@1619] "appium:platformVersion": "17.0",
[XCUITestDriver@1619] "appium:newCommandTimeout": 3600,
[XCUITestDriver@1619] "appium:connectHardwareKeyboard": true
[XCUITestDriver@1619] },
[XCUITestDriver@1619] "firstMatch": [
[XCUITestDriver@1619] {}
[XCUITestDriver@1619] ]
[XCUITestDriver@1619] }
[XCUITestDriver@1619 (5e5441e1)] Session created with session id: 5e5441e1-9c64-4101-b061-8368a6844151
[XCUITest] Current user: 'user1'
[XCUITestDriver@1619 (5e5441e1)] Available devices: fffdc:56:e7:32:a8:8afff, 7ae7f82e23f7cf073d2f70a84754c11bf143978a
[XCUITest] Creating iDevice object with udid 'fffdc:56:e7:32:a8:8afff'
[XCUITestDriver@1619 (5e5441e1)] Determining device to run tests on: udid: 'fffdc:56:e7:32:a8:8afff', real device: true
[XCUITestDriver@1619 (5e5441e1)] Event 'xcodeDetailsRetrieved' logged at 1698170251600 (13:57:31 GMT-0400 (Eastern Daylight Saving Time))
[XCUITestDriver@1619 (5e5441e1)] App is an iOS bundle, will attempt to run as pre-existing
[XCUITestDriver@1619 (5e5441e1)] Event 'appConfigured' logged at 1698170251600 (13:57:31 GMT-0400 (Eastern Daylight Saving Time))
[XCUITestDriver@1619 (5e5441e1)] Event 'resetStarted' logged at 1698170251600 (13:57:31 GMT-0400 (Eastern Daylight Saving Time))
[XCUITest] Reset: fullReset not set. Leaving as is
[XCUITestDriver@1619 (5e5441e1)] Event 'resetComplete' logged at 1698170251600 (13:57:31 GMT-0400 (Eastern Daylight Saving Time))
[XCUITestDriver@1619 (5e5441e1)] Using WDA path: '/Users/user1/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[XCUITestDriver@1619 (5e5441e1)] Using WDA agent: '/Users/user1/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[XCUITest] Continuing without capturing device logs: Could not find a pair record for device 'fffdc:56:e7:32:a8:8afff'. Please first pair with the device
[XCUITestDriver@1619 (5e5441e1)] Setting up real device
[XCUITestDriver@1619 (5e5441e1)] {}
[DevCon Factory] Releasing connections for fffdc:56:e7:32:a8:8afff device on any port number
[DevCon Factory] No cached connections have been found
[XCUITestDriver@1619 (5e5441e1)] Not clearing log files. Use clearSystemFiles capability to turn on.
[AppiumDriver@cf21] Event 'newSessionStarted' logged at 1698170251610 (13:57:31 GMT-0400 (Eastern Daylight Saving Time))
[AppiumDriver@cf21] Encountered internal error running command: Error: Could not find a pair record for device 'fffdc:56:e7:32:a8:8afff'. Please first pair with the device
[AppiumDriver@cf21] at startLockdownSession (/Users/user1/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/utilities.js:168:13)
[AppiumDriver@cf21] at startService (/Users/user1/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/services.js:117:20)
[AppiumDriver@cf21] at Object.startInstallationProxyService (/Users/user1/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/services.js:66:18)
[AppiumDriver@cf21] at IOSDeploy.fetchAppInfo (/Users/user1/.appium/node_modules/appium-xcuitest-driver/lib/ios-deploy.js:182:21)
[AppiumDriver@cf21] at IOSDeploy.isAppInstalled (/Users/user1/.appium/node_modules/appium-xcuitest-driver/lib/ios-deploy.js:166:20)
[AppiumDriver@cf21] at XCUITestDriver.start (/Users/user1/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:606:9)
[AppiumDriver@cf21] at XCUITestDriver.createSession (/Users/user1/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:401:7)
[AppiumDriver@cf21] at AppiumDriver.createSession (/opt/homebrew/lib/node_modules/appium/lib/appium.js:374:35)
[HTTP] <-- POST /session 500 43 ms - 706

CC: @KazuCocoa

@KazuCocoa
Copy link
Member

KazuCocoa commented Oct 24, 2023

I cannot verify because I don't have apple tv real device, but perhaps something has changed in https://github.com/appium/appium-ios-device/blob/e1e18141ee0c1d1a51a1d2b1c7c6d473bb28a469/lib/usbmux/index.js#L151 at least, or tvOS requires to manage both addir and udid.

Hm, we need debug by someone who has the physical device

@ravindra1307
Copy link

ravindra1307 commented Oct 26, 2023

Facing same issue with xcode 15.0 and tvOS 17. please let me know how can i help with debugging, i have apple tv available with me.
For me idevice_id can't detect apple tv (apple tv is connected through wifi).

@KazuCocoa
Copy link
Member

What's about replacing npm built https://github.com/appium/appium-ios-device/tree/add-log with your local appium-ios-device in xcuitest-driver/node_modules? It prints usbmux communication in your appium log. It may show something new in Apple TV iOS 17

@KazuCocoa

This comment was marked as outdated.

@mykola-mokhnach
Copy link
Collaborator

@tomriddly I believe something has changed in usbmuxd properties retrieved by appium-ios-device lib, so we get device ip address instead of the uuid. Do you have a chance to check the above scenario on Apple TV device running iOS 17?

@KazuCocoa
Copy link
Member

Yea, that pairing at least changed

@KazuCocoa
Copy link
Member

KazuCocoa commented Nov 3, 2023

it seems like the workaround is not necessary. The ip address was to help Xcode find the device to pair, but after fully paired over usbmuxd, existing udid behaves as the same. So as Appium, the udid can stay the same.

@mykola-mokhnach
Copy link
Collaborator

mykola-mokhnach commented Nov 6, 2023

it seems like the workaround is not necessary. The ip address was to help Xcode find the device to pair, but after fully paired over usbmuxd, existing udid behaves as the same. So as Appium, the udid can stay the same.

@KazuCocoa does this mean this is not a bug, but rather a device pairing issue? Perhaps, we could then improve the error message in the driver to make it more helpful (like device is not connected or not paired)?

@KazuCocoa
Copy link
Member

KazuCocoa commented Nov 6, 2023

Basically yes as a technical perspective for tvOS 17. I need to dig into further the paring config itself on the TV side. I bought a device in person, so let me check further later after getting the device

tvOS 17 has two layers about the pair. The IP v6 is the first one to pair with usbmuxd. I need to check further with the device config as welll, but maybe xcodebuild can detect the device with udid also.

@KazuCocoa
Copy link
Member

KazuCocoa commented Nov 7, 2023

It seems like xcodebuild itself also failed to detect the TV device. The error message by Using the first of multiple matching destinations.... also did not print any TV devices. xcrun xctrace list devices shown the udid (as same as existing udid) though.

So, as current Appium's libs, the workaround appium/appium-xcuitest-driver#2178 might be needed with a capability. But the WDA process should be launched via Xcode or 3rd party tools.

Perhaps it needs to pair the device via remoted

@mykola-mokhnach
Copy link
Collaborator

closed as third party issue

@ravindra1307
Copy link

ravindra1307 commented Jan 3, 2024

Is there any fix for tvOS 17, i am still stuck . Idevice_id shows ipv6 address for appletv, if i use it to start a session i get error as "Could not find a pair record for device 'some ipv6...addr.'. Please first pair with the device".
how can i pair it ?, appium also fails to detect apple tv's udid in available list of devices.

I tried using tvosworkaround branch, i was able to create session using (skipdevice check and webdriveragenturl capability) but after that it says unable to find device with udid. none of the interactions are working

@adriandumitrascu19
Copy link

adriandumitrascu19 commented Jan 3, 2024

@monankpastakia any news on this? I am currently blocked with my test automation

@Vedashreejp
Copy link

@KazuCocoa it is not xcode or tvos issue rather appium2 issue. Before upgrading to appium2 I was able to inspect my appleTV 4K.

os versions:
macos: 13.6.4
tvOS: 14.3
xcode: 14.2
appium: 2.0.0
with these versions the WDA was crashing whenever I tried to inspect.

So i upgraded the xcode version to 15.0.1 and tvos version to 17.3 now when i try to inspect WDA does not crash it is working properly but now I started getting the mentioned error: "Failed to create session. An unknown server-side error occurred while processing the command. Original error: Unknown device or simulator UDID:".

I am using latest WDA: v5.15.8.

I am blocked with automation due to this.

@KazuCocoa
Copy link
Member

I guess the error Unknown device or simulator UDID itself can get a workaround with appium/appium-xcuitest-driver#2194, but so far, we met another issue, xcodebuild command itself did not find the device properly. The way to mount tvOS 17 has changed significantly, thus appium/appium-ios-device#123 is not enough to support tvOS 17 at least. This tvOS 17 issue is similar to https://appium.github.io/appium-xcuitest-driver/5.14/guides/run-preinstalled-wda/ 's warning.

@mykola-mokhnach
Copy link
Collaborator

@KazuCocoa I assume it is only applicable to devices connected wirelessly. I was not able to repro any problem with a device connected via USB

@KazuCocoa
Copy link
Member

KazuCocoa commented Jan 25, 2024

Yes, this issue is only for network connected devices, which we do not support officially in the fact, such as tvOS v17. Possibly the same with wireless connected iOS 17 (haven't checked though)

@Vedashreejp
Copy link

@KazuCocoa So as of now we cannot automate tvos 17 using appium? Also if you can help me to know where to track when it gets unblocked?
Thanks!

@KazuCocoa
Copy link
Member

KazuCocoa commented Jan 29, 2024

For the xcodebuild by Apple, we don't know. #19381 (comment) is one issue that posted to Apple but I don't know if they updated the behavior, or will update.

So far, you can automate tvOS 17 network connected devices by starting WDA via Xcode, appium/appium-xcuitest-driver#2194 branch and webDriverAgentUrl https://appium.github.io/appium-xcuitest-driver/5.14/reference/capabilities/#webdriveragent

@Vedashreejp
Copy link

Hi @KazuCocoa, For the workaround I uninstalled the existing xcuitest driver using command: appium driver uninstall xcuitest and then downloaded the driver from https://github.com/appium/appium-xcuitest-driver/tree/tvos-ios17-workaround2, placed it at location /Users/vedashreep/.appium/node_modules, however now when I start Appium it does not detect the xcuitest driver. Am I doing anything wrong here? please help.

@KazuCocoa
Copy link
Member

https://appium.io/docs/en/latest/cli/extensions/ should help. e.g. appium driver install source=local /path/to/the/branch/on/your/local

@Vedashreejp
Copy link

tried the command: appium driver install source=local /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver-tvos-ios17-workaround2

but getting error:
[ERROR] Unrecognized arguments: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver-tvos-ios17-workaround2

@KazuCocoa
Copy link
Member

Please try with --source as the attached link then.

@Vedashreejp
Copy link

  1. appium driver install source=git https://github.com/appium/appium-xcuitest-driver.git
    [ERROR] Unrecognized arguments: https://github.com/appium/appium-xcuitest-driver.git

  2. appium driver install source=git [email protected]:appium/appium-xcuitest-driver.git
    [ERROR] Unrecognized arguments: [email protected]:appium/appium-xcuitest-driver.git

@KazuCocoa
Copy link
Member

Did you add -- as previous comment? appium driver install --source=local /path/to/the/branch/on/your/local

@Vedashreejp
Copy link

Yes after using --source, getting error STDERR: npm WARN config global-style This option has been deprecated in favor of --install-strategy=shallow.

Full error:

Error: ✖ Encountered an error when installing package: npm command 'link --save-dev --no-progress --no-audit --omit=peer --save-exact --global-style --no-package-lock /Users/vedashreep/.appium/node_modules/appium-xcuitest-driver-tvos-ios17-workaround2 --json' failed with code 1.

STDOUT:
{
"error": {
"code": 1,
"summary": "command failed",
"detail": "sh -c husky install; npm run rebuild\n> [email protected] rebuild\n> npm run clean; npm run build\n\n\n> [email protected] clean\n> npm run build -- --clean\n\n\n> [email protected] build\n> tsc -b --clean\n\n\n> [email protected] build\n> tsc -b\n\nerror TS2688: Cannot find type definition file for 'chai'.\n The file is in the program because:\n Entry point of type library 'chai' specified in compilerOptions\nerror TS2688: Cannot find type definition file for 'chai-as-promised'.\n The file is in the program because:\n Entry point of type library 'chai-as-promised' specified in compilerOptions\nerror TS2688: Cannot find type definition file for 'mocha'.\n The file is in the program because:\n Entry point of type library 'mocha' specified in compilerOptions\nerror TS2688: Cannot find type definition file for 'sinon'.\n The file is in the program because:\n Entry point of type library 'sinon' specified in compilerOptions\nerror TS2688: Cannot find type definition file for 'sinon-chai'.\n The file is in the program because:\n Entry point of type library 'sinon-chai' specified in compilerOptions\nsh: husky: command not found"
}
}

STDERR:
npm WARN config global-style This option has been deprecated in favor of --install-strategy=shallow
npm ERR! code 1
npm ERR! path /Users/vedashreep/.appium/node_modules/appium-xcuitest-driver-tvos-ios17-workaround2
npm ERR! command failed
npm ERR! command sh -c husky install; npm run rebuild
npm ERR! > [email protected] rebuild
npm ERR! > npm run clean; npm run build
npm ERR!
npm ERR!
npm ERR! > [email protected] clean
npm ERR! > npm run build -- --clean
npm ERR!
npm ERR!
npm ERR! > [email protected] build
npm ERR! > tsc -b --clean
npm ERR!
npm ERR!
npm ERR! > [email protected] build
npm ERR! > tsc -b
npm ERR!
npm ERR! error TS2688: Cannot find type definition file for 'chai'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'chai' specified in compilerOptions
npm ERR! error TS2688: Cannot find type definition file for 'chai-as-promised'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'chai-as-promised' specified in compilerOptions
npm ERR! error TS2688: Cannot find type definition file for 'mocha'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'mocha' specified in compilerOptions
npm ERR! error TS2688: Cannot find type definition file for 'sinon'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'sinon' specified in compilerOptions
npm ERR! error TS2688: Cannot find type definition file for 'sinon-chai'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'sinon-chai' specified in compilerOptions
npm ERR! sh: husky: command not found

@KazuCocoa
Copy link
Member

Then, perhaps you need to run npm install once in the xcuitest driver repository to install some dependencies.

@Chetantn
Copy link

For the xcodebuild by Apple, we don't know. #19381 (comment) is one issue that posted to Apple but I don't know if they updated the behavior, or will update.

So far, you can automate tvOS 17 network connected devices by starting WDA via Xcode, appium/appium-xcuitest-driver#2194 branch and webDriverAgentUrl https://appium.github.io/appium-xcuitest-driver/5.14/reference/capabilities/#webdriveragent

It's been 2 months still i didn't get any reply from official Apple Dev forum. We have almost stopped running our TvOS automated test cases because of this unsupported version of tvOS with Appium. Presently our tvOS is updated with "17.3".
i'm able to create the webdriver agent on appleTV only when we build the xcode project via command line and set "tvOS Deployment Target" to "17.2"

Example : xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner_tvOS -destination 'id=4d61282d6871dd9006c73a8e7e8f2029XXXXXXXXX' test

But when we try to start the webdriver session from our test scripts it say device(tvOS) is not connected

Also one more observation is i have connected 2 devices with my macmini. i.e iphone and AppleTV

but when i run the idevice_id --list i get only iphone id, so here also AppleTV is not recognisable. Its better they should stop the latest version tvOS and first fix these issue.

Please somebody confirm that tvOS 17.X is not supported for automation :)

Ref to issue raised with AppleTV: https://developer.apple.com/forums/thread/741110

Note: we will not be able to connect the Apple TV with usb connection. our model only supports connection via WIFI

@KazuCocoa
Copy link
Member

But when we try to start the webdriver session from our test scripts it say device(tvOS) is not connected

For this line, appium/appium-xcuitest-driver#2194 could help to skip some device checking that causes the error.

@KazuCocoa
Copy link
Member

A new finding with devicectl to start WDA on a tvOS device
#19206 (comment)

@adriandumitrascu19
Copy link

Hello, do we have the same issues with tvos 18 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS related to iOS native driver(s) ThirdParty upstream problems
Projects
None yet
Development

No branches or pull requests

7 participants