Android TV / Fire TV
Runs the app on Android TV emulators through Appium UiAutomator2. toets manages the Appium server and, by default, the emulators: one per worker, created from an Android TV system image, snapshotted and reset between tests. Package: @toets/driver-android-tv.
import { defineConfig, platforms } from '@toets/test';
export default defineConfig({
app: { androidTV: { apk: './build/app-debug.apk', package: 'com.example.tv' } },
projects: [platforms.androidTV({ model: 'tv_1080p', osVersion: '34' })],
});Host: the Android SDK with an Android TV system image, and hardware acceleration (macOS, or Linux with KVM). See Android TV on Linux for CI.
| Aspect | Android TV |
|---|---|
| Test ID | view resource ID |
| Focus | the focused view, or the SDK's focus when connected |
| Keys | Android keycodes; all TV keys including color, numeric, channel and media |
| Launch | launch payload as the __toets intent extra; host ports forwarded with adb reverse |
| Artifacts | logcat, screen recording (toets.video) |
Options (SDK path, Appium, remote profile, logcat, managed emulators): Android TV setup and devices.
Devices
| Mode | Who owns the emulator |
|---|---|
managed | toets: creates, boots, snapshots, resets and shuts down emulators (default) |
external | you: running devices, devices: { mode: 'external' } with TOETS_DEVICES=emulator-5554,emulator-5556 |
command | your scripts: shell commands lease and release devices (device farms, lease brokers) |
Fire TV
Fire TV apps (Fire OS) are Android apps; test them on Android TV emulators with platforms.androidTV({ remote: 'fire-tv' }), which limits the keys to the Alexa Voice Remote's. Amazon services (IAP, ADM) are not on Android TV images; fake them in the app's test build. Vega OS is not supported. See Fire TV.
Traps
- Emulators need hardware acceleration. Without KVM or the macOS hypervisor they are too slow to be useful.
- First boot is slow; later boots are not. Managed mode snapshots a booted emulator and restores it. Keep the AVD and snapshot cached in CI.
localhoston the device is the device. toets forwards the ports in the launch payload; if your app talks to other host services (Metro for React Native debug builds), list their ports inreversePortsor use the mock server. See traps.- Resource IDs need to be set. Views without an ID are invisible to
getByTestId; React Native sets it fromtestID.