cy.prompt: Cypress is Testing Behavior with Behavior

Plain Language Meets Testing

Cypress has quietly introduced something new: cy.prompt. The idea is simple yet powerful: you write a plain-language instruction, and an AI agent translates it into executable code behind the scenes. Instead of coding selectors and assertions, you can now write behavioral instructions, like ["Enter 'John Doe' in the 'Name' field", "Click the 'Submit' button"], and the system interprets those steps and translates them into test code on the backend.


End-to-end testing has traditionally been built on code; we’ve been using Code to test Code, and Code to test Behavior. Now, with cy.prompt, we can now use Behavior to test Behavior! We can program with the language of our users to validate that our software works for them.


Decoupling Testing from Code

By removing dependencies away from selectors, nested-element locators, or custom attributes, cy.prompt reduces the complexity of testing. Where traditional end-to-end tests often break when a selector name or DOM structure changes, something that happens frequently during active development, behavior-driven instructions shift the focus onto outcomes. The test no longer says “get('.submit-btn').click(),” it now says “Click on the 'Submit' button.” This evolution moves us closer to true behavior-based testing.


Functionality-Testing with Reduced Noise

The AI agent that interprets cy.prompt has more visibility into the DOM structure than the average user. For example, a human user might struggle to visually locate a button, while the AI agent can find it instantly. That means cy.prompt is focused on confirming that features work, regardless of how the underlying selectors are written or displayed visually. A human tester may get hung up on the element’s appearance, but cy.prompt ensures the underlying functionality works.


Hybrid Approach

Just as the good ol' Page Object Model is no longer required in modern testing frameworks, but is still useful, cy.prompt doesn’t eliminate the value of hardcoded selectors. Instead, it opens the door to a hybrid approach. These plain-language instructions work well for general behaviors, navigating flows, submitting forms, and verifying outcomes, but for edge cases like verifying help text or tooltip messages, you can still use hardcoded selectors to compare text against expected values. This blend uses plain-language where it makes sense and keeps precision where it’s needed, taking full advantage of the benefits of both processes.


A New Level of Behavior Testing

The arrival of cy.prompt feels like the next step forward in behavior-based testing. We’re moving from writing Code to test Behavior, to writing Behavior to test Behavior. It’s a bold step into the future of automation, test design, and maintenance, and one step closer to the larger goal of software itself being replaced by intuition.


Click the link to find out what's next for Cypress --> cy.prompt

@