-
Notifications
You must be signed in to change notification settings - Fork 296
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
Add AppleTV support #2067
base: main
Are you sure you want to change the base?
Add AppleTV support #2067
Conversation
private static let springboardBundleId = "com.apple.springboard" | ||
|
||
#if os(tvOS) | ||
private static let homescreenBundleId = "com.apple.HeadBoard" |
There was a problem hiding this comment.
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" | ||
**/ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to take the ones without tvOS bindings, and make them no-ops on tvOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglowder Already done 👍 The file includes a compiler directive to exclude .Home
and .Lock
cases from the Button
enum for tvOS. Anything unrecognised that isn't included in the enum will fall through the switch block in PressButtonHandler
and no-op.
Ooh! Very nice would be very helpful for our situation |
@maxphillipsdev I really appreciate your work on this -- it would be game-changing for testing the React Native TV repo. I will look through this, and try it out! |
@maxphillipsdev I created a branch in my fork where I cherry-picked all your commits against current main, and resolved conflicts. Testing this out today... https://github.com/douglowder/maestro/tree/tvos-with-main-merge |
b293fba
to
8a93210
Compare
PR is rebased and CLI correctly installs / uninstalls the test runner when using studio / test commands. You can try it out locally by gradle syncing, launching a tvOS simulator and running appId: com.apple.TVSettings
---
- launchApp
- assertVisible: 'General'
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down To do
|
@maxphillipsdev it appears that appId: com.meta.RNTester.localDevelopment
---
- launchApp #RNTester app launch
- assertVisible: 'Components'
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Center # Arrow key down to Button example and launch
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down # First example button should be focused
- assertVisible:
id: 'button_default_styling'
focused: true
- assertVisible:
id: 'cancel_button'
focused: false
- pressKey: Remote Dpad Down # Down arrow to the cancel button, which should now be focused
- assertVisible:
id: 'button_default_styling'
focused: false
- assertVisible:
id: 'cancel_button'
focused: true I decided to try the same test on RNTester for Android TV, and it works, but requires some changes because the focus engine is a little different, so a different series of down and right arrow presses are needed to navigate to the expected buttons for the test. appId: com.facebook.react.uiapp
---
- launchApp #RNTester app launch
- assertVisible: 'Components'
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Right
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Center #Arrow key down to Button example and launch
- pressKey: Remote Dpad Down
- pressKey: Remote Dpad Right
- pressKey: Remote Dpad Down #First example button should be focused
- assertVisible:
id: 'button_default_styling'
focused: true
- assertVisible:
id: 'cancel_button'
focused: false
- pressKey: Remote Dpad Down #Down arrow to the cancel button, which should now be focused
- assertVisible:
id: 'button_default_styling'
focused: false
- assertVisible:
id: 'cancel_button'
focused: true |
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
pressKey
are now available on AppleTV as well. I only included the ones that had a clear mapping to something fromXCUIRemote
Implementation
maestro-ios-xctest-runner
from Storyboard to SwiftUI so iOS and tvOS could share the same XCode target.PressButtonRequest.swift
and passed them through from the iOS driver.maestro-ios-xctest-runner
build script to build separate versions for iOS and tvOS and copy them into the resources folder under anios/
ortvos/
prefix.Limitations
XCUIRemote
mappings (tapOn, swipe for example)To Do
launchApp
. UPDATE: Got a lead on this, might be due to the appID of the homescreen being different on tvOS. Working on it.Screenshots
Testing
Issues fixed
#1515 – Add support for testing tvOS apps