Lupa API Reference / commands / Events
Class: Events
Defined in: src/commands/events.ts:1263
Synthetic event dispatcher for browser DOM testing.
Use
when
- Fast event dispatching is required without Playwright IPC overhead.
- Testing event handlers in isolated web components or DOM subtrees.
Dont
use when
- Testing native browser behaviors that depend on OS-level input drivers or Playwright actionability checks.
Example
import { events, KeyCode } from '@pawel-up/lupa/commands'
const input = document.querySelector('input')!
events(input).focus.in()
events(input).input.fill('Hello World')
events(input).clipboard.paste('Pasted Text')
await events(input).keyboard.press('Enter')
events(input).focus.out()Constructors
Constructor
new Events(
target):Events
Defined in: src/commands/events.ts:1294
Creates a new instance of the Events class.
Parameters
target
EventTarget
The target DOM node for dispatching synthetic events.
Returns
Events
Properties
clipboard
readonlyclipboard:ClipboardEvents
Defined in: src/commands/events.ts:1282
Synthetic clipboard event helper.
focus
readonlyfocus:FocusEvents
Defined in: src/commands/events.ts:1287
Synthetic focus and blur event helper.
input
readonlyinput:InputEvents
Defined in: src/commands/events.ts:1277
Synthetic input/form control event helper.
keyboard
readonlykeyboard:KeyboardEvents
Defined in: src/commands/events.ts:1267
Synthetic keyboard event helper.
mouse
readonlymouse:MouseEvents
Defined in: src/commands/events.ts:1272
Synthetic mouse event helper.