# toets > Cross-platform E2E testing for TV apps: one test for web, Android TV / Fire TV and tvOS, with focus and the remote as first-class primitives. Pre-alpha: APIs may change. toets runs on Playwright Test; platforms are Playwright projects and tests receive one `app` fixture. Rules that differ from web and mobile testing: - There is no click. Move focus with the remote (`app.focus.navigateTo`, `app.remote.press`), then press `Key.SELECT`. - Assert focus after navigating: `await expect(locator).toBeFocused()`. - Assertions retry until timeout. Never sleep. - Platform gaps are capabilities: declare `requires` instead of branching on the platform. - Negative assertions need a positive anchor first (or the SDK idle signal). Errors print `ToetsError: [CODE] message` with a `Hint:` and a `Docs:` page; every code is listed in [Error codes](https://yusufyildirim.github.io/toets/reference/core/docs/errors.md). Installed packages ship their reference pages offline in `node_modules/@toets/*/docs/`. ## Getting started - [Install and first test](https://yusufyildirim.github.io/toets/getting-started/index.md): Install toets, configure platforms and run a first cross-platform TV test. - [Working with agents](https://yusufyildirim.github.io/toets/getting-started/agents.md): Give coding agents what they need to write and debug toets tests - skills, an AGENTS.md template, llms.txt, offline docs and the MCP server. ## Concepts - [Locators and assertions](https://yusufyildirim.github.io/toets/concepts/locators-and-assertions.md): Find elements by test ID or text with lazy locators, and assert with matchers that retry until they pass or time out. - [Focus](https://yusufyildirim.github.io/toets/concepts/focus.md): Focus is the primary state of a TV app. Press a direction, read where focus landed, repeat until the target holds it; never model the app's focus engine. - [Remote and keys](https://yusufyildirim.github.io/toets/concepts/remote-and-keys.md): Semantic remote keys that each platform maps honestly, with capability gating for keys a remote does not have and app-level overrides. - [Capabilities and parity](https://yusufyildirim.github.io/toets/concepts/capabilities.md): Platforms declare what they can do as capabilities. Tests declare what they need with requires; unmet requirements skip with a reason and show in the parity matrix. - [Idle and synchronization](https://yusufyildirim.github.io/toets/concepts/idle.md): Assertions always retry with a timeout. With the SDK, toets also knows when the app is idle, which makes checks faster and negative assertions trustworthy. Idle is an accelerator, never a gate. - [Network mocking](https://yusufyildirim.github.io/toets/concepts/network-mocking.md): Mock API responses with MSW handlers that run on the test host. The app sends traffic to the toets mock server; unmatched requests pass through to the real backend. - [Text input](https://yusufyildirim.github.io/toets/concepts/text-input.md): Text goes in through a keyboard, like a user types it. System text fields use the platform's text entry; keyboards the app draws itself are declared once and typed key by key with the remote. - [Deep links](https://yusufyildirim.github.io/toets/concepts/deep-links.md): Tests open the app from one canonical link. Each platform's form of it (a web path, an Android intent) is a translation in the config, so the test means the same everywhere. - [Page objects](https://yusufyildirim.github.io/toets/concepts/page-objects.md): Page objects take app, expose locators and user-level actions, and leave assertions to tests. The ESLint plugin enforces the rules. - [The in-app SDK](https://yusufyildirim.github.io/toets/concepts/sdk.md): The optional in-app SDK reports the app's own tree, focus, idle state and media state over an open protocol. It speeds tests up and adds capabilities; only apps with a JS focus engine need it, to report focus. - [Text snapshots](https://yusufyildirim.github.io/toets/concepts/text-snapshots.md): Text snapshots are focus-aware YAML views of the screen - deterministic, cheap for agents to read and comparable across platforms. Used as assertions and as failure context. ## Guides - [Writing tests](https://yusufyildirim.github.io/toets/guides/writing-tests.md): How to write toets tests that pass for the right reason on every platform - shape, principles, app-specific fixtures and the fast loop. - [Debugging failures](https://yusufyildirim.github.io/toets/guides/debugging-failures.md): Read the error, the failure dump and the report artifacts first; reproduce narrowly; fix the cause, not the timeout. Includes a symptom table. - [Serial flows](https://yusufyildirim.github.io/toets/guides/serial-flows.md): Serial flows run tests in order on one shared app instance, with Playwright's serial semantics on every platform. Use them only for journeys that can not be set up directly. - [Migrating from Playwright](https://yusufyildirim.github.io/toets/guides/migrating/from-playwright.md): Port Playwright web tests to toets - same runner and assertion style, but focus and the remote replace the pointer, and page becomes app. - [Migrating from Appium / WebdriverIO](https://yusufyildirim.github.io/toets/guides/migrating/from-appium.md): Port Appium or WebdriverIO TV tests to toets - semantic keys instead of keycodes, retrying matchers instead of explicit waits, and devices managed for you. - [Migrating from Detox](https://yusufyildirim.github.io/toets/guides/migrating/from-detox.md): Port Detox tests to toets - matchers and launch options map closely; taps become focus navigation and synchronization becomes an accelerator instead of a gate. ## Platforms - [Web](https://yusufyildirim.github.io/toets/platforms/web.md): The web platform drives TV web apps in Chromium through Playwright - the fastest loop, with full Playwright traces. - [Android TV / Fire TV](https://yusufyildirim.github.io/toets/platforms/android-tv.md): The Android TV platform drives apps on Android TV emulators through Appium UiAutomator2, with emulators booted, leased and reset by toets. Covers Fire TV apps on Android TV images. - [tvOS](https://yusufyildirim.github.io/toets/platforms/tvos.md): The tvOS platform drives apps on Apple TV simulators through Appium XCUITest. The Siri Remote has few buttons, so many keys are capability-gated. ## CI recipes - [CI recipes](https://yusufyildirim.github.io/toets/ci/index.md): Principles for running toets in CI - one job per platform host, build once, size workers to devices, cache the slow parts, always keep the report. - [Android TV on Linux](https://yusufyildirim.github.io/toets/ci/android.md): Run Android TV emulators in CI on x86_64 Linux runners with KVM - enabling KVM, installing the system image and running the android-tv project. - [tvOS on macOS](https://yusufyildirim.github.io/toets/ci/tvos.md): Run tvOS simulators in CI on macOS runners - selecting Xcode, making sure the tvOS runtime exists, building for the simulator and running the tvos project. - [Caching](https://yusufyildirim.github.io/toets/ci/caching.md): What to cache for toets in CI and how to key it - packages, browsers, Android images and snapshots, WebDriverAgent and app builds. - [Artifacts and reports](https://yusufyildirim.github.io/toets/ci/artifacts.md): Keep the Playwright report and test results from every CI run, merge sharded reports, and read the parity matrix. ## Reference - [Reference](https://yusufyildirim.github.io/toets/reference/index.md): Reference for every toets package - pages from each package's own docs, shipped offline in node_modules, plus the error code index. ## Reference: @toets/test Cross-platform E2E testing for TV apps on Playwright Test: one test for web, Android TV / Fire TV and tvOS, with focus and the remote as primitives. - [The `app` fixture](https://yusufyildirim.github.io/toets/reference/test/docs/app-fixture.md): Every test gets `app`, the app under test on the project's platform. - [Config](https://yusufyildirim.github.io/toets/reference/test/docs/config.md): A toets suite is a Playwright Test suite with one project per platform. - [Devices](https://yusufyildirim.github.io/toets/reference/test/docs/devices.md): Device platforms need a device per worker. - [Reporting](https://yusufyildirim.github.io/toets/reference/test/docs/reporting.md): toets reports through Playwright: every action is a step, artifacts are attachments, and a parity matrix shows which test ran where. - [requires](https://yusufyildirim.github.io/toets/reference/test/docs/requires.md): `requires(...capabilities)` declares what a test needs. ## Reference: @toets/core Platform-neutral core of toets, cross-platform E2E testing for TV apps: driver contract, locators, matchers, focus, remote keys, capabilities. - [Assertions](https://yusufyildirim.github.io/toets/reference/core/docs/assertions.md): Every toets matcher retries until it passes or the timeout elapses (`expect.timeout`, default 5000 ms). - [Capabilities](https://yusufyildirim.github.io/toets/reference/core/docs/capabilities.md): A capability is something a target can do: press color keys (`key.color`), report media state (`media.state`), mock the network (`network.mock`). - [Deep links](https://yusufyildirim.github.io/toets/reference/core/docs/deep-links.md): `app.launch({ deepLink })` starts the app from a link; `app.openDeepLink(url)` delivers a link to the running app. - [Writing a driver](https://yusufyildirim.github.io/toets/reference/core/docs/drivers.md): A driver connects toets to one platform. - [Failure dumps](https://yusufyildirim.github.io/toets/reference/core/docs/failure-dumps.md): When a test fails, toets writes a `toets-failure.md` dump and a `toets-screenshot.png` to the test's output folder (`test-results//`) and attaches both to the Playwright report; the console pri… - [Focus navigation](https://yusufyildirim.github.io/toets/reference/core/docs/focus-navigation.md): Moving focus with real D-pad presses, without hardcoding `DOWN, DOWN, RIGHT`, which breaks whenever the layout changes. - [Idle sync](https://yusufyildirim.github.io/toets/reference/core/docs/idle.md): With the in-app SDK connected (`sync.idle`), the app reports when it is idle: no pending network, animations, short timers or focus transitions for about 100 ms. - [Locators](https://yusufyildirim.github.io/toets/reference/core/docs/locators.md): A locator describes how to find an element, not the element itself. - [Network mocking](https://yusufyildirim.github.io/toets/reference/core/docs/network.md): With `toets: { mock: true }`, a host-side mock server runs per worker. - [Remote](https://yusufyildirim.github.io/toets/reference/core/docs/remote.md): `app.remote` sends real key events, the same way a user's remote does. - [Screenshots](https://yusufyildirim.github.io/toets/reference/core/docs/screenshots.md): Screenshot assertions that settle animated TV screens - stable frames, masks, thresholds and per-platform baselines. - [In-app SDK](https://yusufyildirim.github.io/toets/reference/core/docs/sdk.md): The SDK is an optional library inside the app. - [Text input](https://yusufyildirim.github.io/toets/reference/core/docs/text-input.md): `locator.fill()` and `app.keyboard` put text into fields through a keyboard: the platform's system text entry for system text fields, or an app-drawn keyboard declared with `defineKeyboard()`, typed… - [Text snapshots](https://yusufyildirim.github.io/toets/reference/core/docs/text-snapshots.md): A text snapshot is a small YAML outline of what the user sees: visible, on-screen elements, their text and their state. - [Error codes](https://yusufyildirim.github.io/toets/reference/core/docs/errors.md): Every ToetsError code, what it means and the page to read, generated from the toets sources. ## Reference: @toets/mock Network mocking for TV app E2E tests: MSW handlers on a host-side mock server with upstream proxying, same on web, Android TV and tvOS. - [App integration](https://yusufyildirim.github.io/toets/reference/mock/docs/app-integration.md): The mock server only sees requests the app sends to it. - [Asserting requests](https://yusufyildirim.github.io/toets/reference/mock/docs/asserting-requests.md): Every request that reaches the mock server is recorded, mocked or proxied. - [Network mocking: concepts](https://yusufyildirim.github.io/toets/reference/mock/docs/concepts.md): toets mocks HTTP on the **test host**, not inside the app. - [Network mocking: TV traps](https://yusufyildirim.github.io/toets/reference/mock/docs/tv-traps.md): Where web intuition about request mocking is wrong on TV. - [Writing handlers](https://yusufyildirim.github.io/toets/reference/mock/docs/writing-handlers.md): Handlers are standard [MSW `http` handlers](https://mswjs.io/docs/api/http). ## Reference: @toets/driver-web toets driver for web and smart TV apps in Chromium: E2E testing for TV apps, built on Playwright. - [Web capabilities](https://yusufyildirim.github.io/toets/reference/driver-web/docs/capabilities.md): The driver declares only what a browser really delivers. - [How the DOM maps to elements](https://yusufyildirim.github.io/toets/reference/driver-web/docs/element-mapping.md): toets matchers work on platform-neutral element snapshots. - [Keys on the web](https://yusufyildirim.github.io/toets/reference/driver-web/docs/keys.md): Remote keys become real keyboard events: trusted `keydown`/`keyup` (and `keypress` for keys that produce text) sent through the Chrome DevTools Protocol, the same path as physical input. - [Launch payload on the web](https://yusufyildirim.github.io/toets/reference/driver-web/docs/launch.md): toets configures the app at launch through one launch payload from `@toets/protocol` (SDK URL, token, mock URL, state, flags). - [Web driver options](https://yusufyildirim.github.io/toets/reference/driver-web/docs/options.md): Set in `app.web` or `platforms.web({...})` (platform wins). - [Web driver setup](https://yusufyildirim.github.io/toets/reference/driver-web/docs/setup.md): `@toets/driver-web` runs web TV apps in Chromium through Playwright. - [TV traps on the web](https://yusufyildirim.github.io/toets/reference/driver-web/docs/tv-traps.md): Where desktop-web intuition misleads when testing TV apps in Chromium. ## Reference: @toets/driver-android-tv toets driver for Android TV, Google TV and Fire TV emulators: E2E testing for TV apps, built on Appium UiAutomator2. - [@toets/driver-android-tv](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/index.md): Runs toets tests on Android TV, Google TV and Fire TV emulators: Appium UiAutomator2 for UI state and key presses, `adb` for app lifecycle, port reversing, logs, video and key holds. - [Android TV capabilities](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/capabilities.md): What the driver declares black-box (without the in-app SDK). - [Android TV devices](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/devices.md): Each worker holds one emulator for its lifetime. - [Fire TV](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/fire-tv.md): Fire OS (Fire TV sticks and cubes before Vega OS) is Android, so the Android TV driver runs Fire TV apps unchanged. - [Android TV key mapping](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/keys.md): Every toets key is a real Android `KeyEvent` injected into the system input pipeline, so the app's native focus engine handles it exactly like a remote button. - [Android TV performance](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/performance.md): Every state read is one UiAutomator2 page-source fetch, mapped to snapshots on the host. - [Android TV setup](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/setup.md): The Android TV driver runs toets tests on Android TV, Google TV and Fire TV (Android based) emulators. - [Android TV traps](https://yusufyildirim.github.io/toets/reference/driver-android-tv/docs/traps.md): Where web or phone intuition is wrong on an Android TV emulator. ## Reference: @toets/driver-tvos toets driver for Apple TV (tvOS) simulators: E2E testing for TV apps, built on Appium XCUITest. - [@toets/driver-tvos](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/index.md): Runs toets tests on tvOS simulators through WebdriverIO and Appium XCUITest. - [Capabilities](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/capabilities.md): Static capabilities of the tvOS driver. - [Remote buttons and key overrides](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/remote.md): The tvOS driver presses real Siri Remote buttons through `XCUIRemote`. - [Setup](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/setup.md): The tvOS driver needs a Mac with Xcode, the tvOS platform (`xcodebuild -downloadPlatform tvOS`) and Node 24+. - [Simulators](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/simulators.md): Each worker drives one tvOS simulator, held exclusively for the run. - [tvOS traps](https://yusufyildirim.github.io/toets/reference/driver-tvos/docs/traps.md): Where web or mobile intuition is wrong on tvOS. ## Reference: @toets/sdk toets in-app SDK for TV app E2E testing: framework-neutral runtime, web adapter and a no-op for production builds. - [Writing an adapter](https://yusufyildirim.github.io/toets/reference/sdk/docs/adapters.md): An adapter connects a UI framework to the runtime. - [Reporting focus](https://yusufyildirim.github.io/toets/reference/sdk/docs/focus.md): Apps whose JS focus engine keeps focus in app state report it with reportFocus(); one call on every platform. - [Idle tracking](https://yusufyildirim.github.io/toets/reference/sdk/docs/idle.md): `sync.waitForIdle` answers as soon as the app has done no tracked work for a quiet window (100 ms by default). - [Media](https://yusufyildirim.github.io/toets/reference/sdk/docs/media.md): The `media` domain reports players (state, position, duration, rate, error) without OS-level scraping. - [In-app SDK](https://yusufyildirim.github.io/toets/reference/sdk/docs/overview.md): The SDK is an optional library inside the app under test. - [Production builds](https://yusufyildirim.github.io/toets/reference/sdk/docs/production.md): The SDK is inert without a launch payload, but it must not ship in production: an inert SDK still costs bytes, and on Android any app can start an exported activity with an `__toets` extra. - [App state](https://yusufyildirim.github.io/toets/reference/sdk/docs/state.md): Tests should start where they need to be, not click through onboarding. - [TV traps](https://yusufyildirim.github.io/toets/reference/sdk/docs/traps.md): Where web or mobile intuition fails with an in-app SDK on TV. - [Web adapter](https://yusufyildirim.github.io/toets/reference/sdk/docs/web.md): Start the SDK in a web TV app with startToets, and how the web driver delivers the launch payload. ## Reference: @toets/sdk-react-native toets in-app SDK for React Native TV apps (react-native-tvos, react-native-web): E2E test instrumentation. - [Focus](https://yusufyildirim.github.io/toets/reference/sdk-react-native/docs/focus.md): Focus is what TV tests assert most, so the adapter only reports focus it can trust: native focus, or what a JS focus engine reports. - [Idle in React Native](https://yusufyildirim.github.io/toets/reference/sdk-react-native/docs/idle.md): General rules: `@toets/sdk` docs, `idle.md`. - [Media](https://yusufyildirim.github.io/toets/reference/sdk-react-native/docs/media.md): `useToetsMedia(id)` registers a react-native-video player for the `media` domain while the component is mounted and returns event props to spread on `