Skip to main content

Devices, Browsers, and Input Methods

Test the Roku application in the owned browser simulator and on physical Roku hardware. Both use semantic Hosanna locators and assertions; their input and capture transports differ.

Select a target​

HosannaTestConfig accepts platform, target, appConfig, and device. Environment variables override the first two when config does not set them:

HS_TEST_PLATFORM=browser HS_TEST_TARGET=web npm run test:ui
HS_TEST_PLATFORM=roku HS_TEST_TARGET=device npm run test:ui

Use browser with target web for the simulator and roku with target device for hardware. The checked-in Samples scripts select these combinations.

Select target-specific tests in TypeScript:

import { createHosannaTestTarget } from '@tantawowa/hosanna-tools/testing';
import config from '../hosanna-test.config';

const target = createHosannaTestTarget(config);

test.runIf(target.matches({ platform: 'roku', target: 'device' }))(
'captures a Roku screenshot',
async ({ hs }) => {
await hs.screenshot.capture('roku-home');
},
);

Current capability matrix​

The runtime descriptor reports these capabilities for the two supported test paths. Full-run video is configured separately; see Video Recording.

CapabilityBrowser simulatorPhysical Roku
Remote-style keysDebugger input commandsECP
TouchBrowser transport; see the fixture limitation belowNo
Text entryFocused HTML inputNo shared text-entry transport
Deep linkApp relaunchECP relaunch arguments
ScreenshotPlaywrightRoku developer interface
RegistryShared command planeShared command plane
LogsApp/debugger logsApp/debugger and Roku logs

Call hs.app.capabilities() when a shared test can adapt safely; otherwise make the target requirement explicit with test.runIf.

Input APIs​

Remote and keyboard-style input use the same semantic keys:

await hs.remote.press('Right');
await hs.remote.pressSequence(['Down', 'Down', 'Select']);
await hs.remote.keyDown('Right');
await hs.remote.keyUp('Right');

The browser simulator sends these through the Hosanna debugger input path. A Roku device uses ECP. This tests application navigation semantics without pretending the transports are identical, and it does not replace a real-remote timing test on TV hardware.

The public client exposes these calls for browser contexts created with touch enabled:

await hs.touch.tap(hs.control.byTestId('touch-card'));
await hs.touch.swipe({
from: { x: 900, y: 700 },
to: { x: 900, y: 300 },
durationMs: 250,
});

tap(locator) uses serialized control bounds. Prefer it over coordinates. The current public client has no separate pointer/mouse API; do not claim mouse coverage from a touch or remote test.

In the current launcher, a browser reattached through connectOverCDP can advertise touch while Playwright rejects touchscreen.tap because hasTouch was not enabled when that persistent context was created. hosanna-samples therefore uses the app-owned integration/support/browser.ts helper to dispatch CDP touch events at the center of semantic control bounds. Treat that helper as a documented browser transport workaround until the owned context enables Playwright touch directly.

The same helper covers pointer activation with a real mouse click. It connects to the fixture's browserCdpEndpoint, finds the owned test page, and clicks the center of semantic control bounds. The pointer test is restricted to { platform: 'browser', target: 'web' }. Keep host-specific extensions like these in simulator-specific helpers.

Text entry is browser-only and fills the focused native HTML input after activating the Hosanna control. Pass an envSecret result for credentials so serialized diagnostics contain only the secret label.

Samples scripts​

Run these commands from samples/:

ScriptTarget and scope
npm run test:ui:webBrowser simulator with the TV rendering contract enabled.
npm run test:ui:web:coreCore controls, input, layout, images, fragments, dialogs, and navigation.
npm run test:ui:web:collectionCollection tests in the simulator.
npm run test:ui:web:certificationSimulator certification checks.
npm run test:ui:rokuCertification checks on physical Roku.

The Samples config maps HS_TEST_DEVICE into HosannaTestConfig.device. Use Roku display presets such as rokufhd for simulator work and a configured Roku selector for hardware. The browser context remains a browser environment; changing the app's design surface does not validate Roku rendering or playback.

Keep browser and hardware results labeled separately. Use physical Roku for remote timing, native rendering, decoder, accessibility, device services, and performance. See Device and Resolution for design coordinates and screen metrics.

Physical Roku setup​

A Roku run needs a device reachable from the development machine, developer mode, ECP, installer/screenshot access, and the debug log port. Samples also needs its generated AppConfig assets served from public/ over the LAN. Follow Serve assets for physical Roku to generate the assets and start the asset server on 5181 and media fixtures on 5180. Then run from samples/, replacing these example LAN addresses:

HS_TEST_PLATFORM=roku \
HS_TEST_TARGET=device \
HOSANNA_ROKU_DEVICE_IP=192.168.1.50 \
HOSANNA_ROKU_DEV_PASSWORD='<developer-password>' \
HS_TEST_ASSET_SERVER_BASE_URL=http://192.168.1.20:5181 \
HS_TEST_STREAM_BASE_URL=http://192.168.1.20:5180 \
npm run test:ui

Set HS_TEST_DEBUG_HOST only when automatic LAN selection chooses an address the Roku cannot reach. Keep device credentials out of source and uploaded artifacts.

Talk to us