Skip to content

feat: expose sendText on test hooks for Puppeteer/Playwright automation (#787)#1332

Draft
adamshiervani wants to merge 1 commit into
devfrom
fix/787
Draft

feat: expose sendText on test hooks for Puppeteer/Playwright automation (#787)#1332
adamshiervani wants to merge 1 commit into
devfrom
fix/787

Conversation

@adamshiervani
Copy link
Copy Markdown
Contributor

Summary

  • Adds sendText(text) to window.__kvmTestHooks — converts a string to layout-aware HID keystrokes using the existing keyboard layout conversion from PasteModal
  • Bridges _getKeyboardLayout from the settings store into test hooks so sendText knows which layout to use
  • Adds sendText helper to ui/e2e/helpers.ts for use in Playwright tests

This lets Puppeteer/Playwright users type text into the remote machine via page.evaluate(t => window.__kvmTestHooks.sendText(t), "hello") — working around the fact that keyboard.type() fires DOM events which JetKVM's WebRTC HID path never sees.

Closes #787

)

Add sendText(text) to window.__kvmTestHooks for Playwright E2E tests.
This bridges the keyboard-layout-aware character-to-HID-keystroke conversion
(already in PasteModal) to the test hooks API, since Puppeteer's keyboard.type()
bypasses the WebRTC HID data channel.

- Add _getKeyboardLayout to TestHooksInternal, populated from registerTestHandlers
- Implement sendText() in initTestHooks() using layout.chars lookup with shift/altRight/deadKey/accentKey handling
- Add getKeyboardLayout handler in devices.$id.tsx route
- Add sendText() helper in e2e/helpers.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make JetKVM controllable by Puppeteer/Playwright/Headless Chrome/Chromium

1 participant