Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add AppleTV support #2067

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

maxphillipsdev
Copy link

Proposed changes

This is a draft for adding AppleTV support to the iOS driver, looking for feedback on the approach. Also the PR is pretty big so happy to split it into some smaller ones if that's preferred.

Feature additions

  • When running tests against a tvOS device, the Maestro iOS driver will now install a tvOS compatible driver
  • A subset of the DPAD commands that are available on AndroidTV through pressKey are now available on AppleTV as well. I only included the ones that had a clear mapping to something from XCUIRemote
  • Maestro studio also works (see screenshot)

Implementation

  • Migrated maestro-ios-xctest-runner from Storyboard to SwiftUI so iOS and tvOS could share the same XCode target.
  • Updated XCode build settings to support tvOS as a compilation and testing target.
  • Added platform check compiler directives in several Swift files to provide tvOS support.
  • Added bindings for Remote Dpad commands in PressButtonRequest.swift and passed them through from the iOS driver.
  • Updated the maestro-ios-xctest-runner build script to build separate versions for iOS and tvOS and copy them into the resources folder under an ios/ or tvos/ prefix.
  • Updated the iOS driver to detect when a device is using tvOS and install the correct driver.

Limitations

  • Certain commands and features of Studio are not available on tvOS since there are no XCUIRemote mappings (tapOn, swipe for example)
  • Since tvOS is a different compile target than iOS, I had to include binaries for both as part of the iOS driver resources. I haven't measured the size difference of the CLI build yet but I expect it to be larger.
  • When launching in Studio on tvOS the driver app goes to the foreground and you have to close it manually or launch another app with launchApp. Not sure why this is happening, any ideas are appreciated
  • Still need to test the normal Maestro commands more fully to see which need modification for tvOS
  • Studio fails when uninstalling the driver app on tvOS, still investigating

Screenshots

image

image image

Testing

  • Tested locally with tvOS and iOS simulators.
  • Ran and tested Studio locally.
  • Ran e2e tests on iOS, investigating adding separate tests for tvOS.

Issues fixed

#1515 – Add support for testing tvOS apps

private static let springboardBundleId = "com.apple.springboard"

#if os(tvOS)
private static let homescreenBundleId = "com.apple.HeadBoard"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On AppleTV the home screen is made up of a process called HeadBoard (the UI and cards) which is layered over another process called PineBoard (the top-right dropdown and background image). We can use the HeadBoard bundleId to allow interacting with cards inside of Studio and we can use PineBoard to get the screen dimensions

case remoteMediaFastForward = "Remote Media Fast Forward"
case RemoteSystemNavigationUp = "Remote System Navigation Up"
case RemoteSystemNavigationDown = "Remote System Navigation Down"
**/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of these have bindings on tvOS, will do some more research and remove

@timrijckaert
Copy link

Ooh! Very nice would be very helpful for our situation

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants