DEV.co
Open-Source Testing · dmtrKovalenko

cypress-real-events

Cypress Real Events is a Cypress plugin that fires native system events instead of simulated JavaScript events, enabling testing of features like hover states, native focus management, and clipboard interactions. It works only in Chromium-based browsers and uses the Chrome DevTools Protocol (CDP) to communicate with the browser.

Source: GitHub — github.com/dmtrKovalenko/cypress-real-events
837
GitHub stars
74
Forks
HTML
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositorydmtrKovalenko/cypress-real-events
OwnerdmtrKovalenko
Primary languageHTML
LicenseMIT — OSI-approved
Stars837
Forks74
Open issues32
Latest releasev1.15.0 (2025-09-05)
Last updated2025-09-05
Sourcehttps://github.com/dmtrKovalenko/cypress-real-events

What cypress-real-events is

This plugin extends Cypress with real event commands (realClick, realHover, realPress, realType, realTouch, realMouseDown/Up/Move, realMouseWheel, realSwipe) by leveraging CDP to dispatch native browser events rather than synthetic JavaScript events. Supports pointer types (mouse/pen), positional targeting, and keyboard shortcuts; Firefox is not supported.

Quickstart

Get the cypress-real-events source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/dmtrKovalenko/cypress-real-events.gitcd cypress-real-events# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Testing hover-based UI interactions

Use realHover to test CSS hover states, dropdown menus, and tooltips that require genuine pointer interaction—simulated events cannot reliably trigger these.

Accessibility and keyboard navigation testing

Use realPress and realTab to validate focus management, keyboard shortcuts, and screen reader behavior in ways that purely JavaScript events cannot replicate.

Native browser features (alerts, clipboard, file inputs)

Use real events to test interactions with native dialogs, clipboard operations, and file upload flows that require trusted events and cannot work with simulated events.

Implementation considerations

  • Installation is straightforward (npm install + single import in support file), but requires Chromium-based browser; verify browser availability in CI/CD pipeline before rollout.
  • Commands are named with 'real' prefix (realClick, realType) to mirror standard Cypress commands—team should document which events require native vs. simulated behavior.
  • CI/CD must use standard Docker images (cypress/default or node:lts) and run cypress install to fetch browsers; cypress-browsers image is explicitly not recommended.
  • Real events are global (not scoped to a single element for realPress and realType); focus management may be required before calling these commands.
  • Performance impact via CDP communication is unknown; large test suites using real events should be benchmarked against simulated events in your environment.

When to avoid it — and what to weigh

  • Firefox support is required — Real events work only in Chromium-based browsers. If your test matrix must include Firefox, you will need to fall back to Cypress's default simulated events or run different test suites.
  • Using Docker images with known CDP issues — The README explicitly warns against cypress-browsers Docker images; real events sometimes fail due to CDP protocol instability. Requires standard cypress/default or node:lts images with browser installation.
  • Simple, high-volume synthetic tests without complex user interactions — Overhead of native events via CDP may be unnecessary for straightforward form fills and button clicks; Cypress's default simulated events are faster and sufficient for basic workflows.
  • Production code that depends on isTrusted flag being false — Real events will set event.isTrusted to true, potentially breaking code that explicitly checks or rejects trusted events in non-test environments.

License & commercial use

Licensed under MIT (MIT License), a permissive OSI-approved open-source license.

MIT License permits commercial use, modification, and distribution with proper attribution. No license restrictions prevent commercial testing infrastructure adoption. However, no explicit warranty or support terms are provided; review the LICENSE file for standard MIT disclaimers regarding liability and fitness for purpose.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Real events fire actual system-level interactions via CDP, which increases attack surface compared to simulated events if test environment is compromised. Test code and environments should follow standard security hardening practices. No security vulnerabilities or CVEs are mentioned in the provided data. CDP communication should be restricted to trusted test runners and isolated CI/CD agents.

Alternatives to consider

Cypress default (simulated) events

Built-in, no dependencies, works in Firefox. Suitable for most workflows, but cannot test hover states, native focus, or trusted events reliably.

Puppeteer with native events

Lower-level control over browser automation; this plugin was inspired by Puppeteer's event system. Requires rewriting tests and managing two tools (Cypress + Puppeteer) in parallel.

Playwright

Cross-browser automation with first-class support for real mouse, keyboard, and touch events. Requires migration from Cypress; better Firefox/Safari support if needed.

Software development agency

Build on cypress-real-events with DEV.co software developers

Cypress Real Events solves hover, focus, and trusted-event testing. Let's integrate it into your E2E pipeline and validate complex user interactions that simulated events cannot reach.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

cypress-real-events FAQ

Why would I use real events instead of Cypress's default click and type?
Cypress's default events are simulated via JavaScript, so event.isTrusted is false and features like hover (:hover CSS), clipboard access, native alerts, and proper focus management do not work. Real events use CDP to fire actual browser events, making them trusted and triggering real browser behavior.
Does this work in headless mode or CI/CD?
Yes, real events work in CI/CD as long as you use a real Chromium-based browser installed via 'cypress install' in a standard Docker image (cypress/default or node:lts). The cypress-browsers Docker image has known CDP protocol issues and is not recommended.
Can I use this with Firefox?
No, real events are limited to Chromium-based browsers (Chrome, Edge, etc.). Firefox is not supported because it does not expose the same CDP interface.
Do I need to change my test structure or add new dependencies?
No structural changes are required. Install the npm package, import it in your Cypress support file, and replace cy.click() with cy.realClick(), cy.type() with cy.realType(), etc. No new dependencies beyond Cypress itself.

Software development & web development with DEV.co

DEV.co helps companies turn open-source tools like cypress-real-events into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source testing stack.

Need Native Event Testing in Your Cypress Suite?

Cypress Real Events solves hover, focus, and trusted-event testing. Let's integrate it into your E2E pipeline and validate complex user interactions that simulated events cannot reach.