AI testing in Cypress: scroll elements into view with cy.prompt

November 12, 2025

By Jennifer Shehane

Scroll elements into view with cy.pr

When testing how users interact with real applications, scrolling is one of those natural actions that happens without thinking. Whether it is revealing a hidden button, checking a future calendar date, or loading more results, being able to scroll is an important part of realistic browser behavior.

Now, cy.prompt can do that too.

cy.prompt now supports scrolling elements into view

With the latest release of Cypress, cy.prompt can automatically scroll elements into view before interacting with them. It understands your intent when you describe an action in plain language and handles the scrolling for you. This makes AI-powered test automation in Cypress even more capable of mirroring real user behavior.

See it in action

Here is a real example from a test that checks a calendar:

it('Verify available calendar dates are scrollable, visible, and clickable', () => {
  cy.visit('/blog-calendar-website.html')
  cy.prompt([
    'click to view the calendar',
    'scroll the calendar to "Dec 7"',
    'Dec 7 should be visible',
    'Dec 7 should contain the text "Available"',
    'click on Dec 7',
    'Dec 7 should have the selected class',
  ])
})

In the video below, you can see the full cycle in action. The AI generates the test code, scrolls the calendar, and executes every step in just 8 seconds from start to finish. Each subsequent run will be even faster since it will utilize caching.

0:00
/0:24

Cypress AI scrolls the calendar until Dec 7 is visible, confirms the date is available, and then clicks it. There's no need to manually write scrollIntoView or add extra wait logic. cy.prompt understands what you mean when you say “scroll to Dec 7” and performs the right action automatically.

Try it yourself

Here are just a few examples of how you might describe scroll actions in natural language:

"Scroll to today's date in the calendar and click it"
"Scroll the element with text 'Settings' into view"
"Scroll until you see the privacy notice"
"Bring the sale's banner into view"

Behind the scenes, cy.prompt generates and executes a scrollIntoView command to ensure these elements are visible.

Note: At this stage, cy.prompt supports scrolling elements into view, but not scrolling to general positions such as 'scroll to the top' or 'scroll to the bottom'.

Expanding what AI can do in Cypress

cy.prompt is still experimental, and we are actively expanding its capabilities. Scrolling is one of the first steps in connecting cy.prompt to the full set of browser driver features that power Cypress tests.

Our goal is to make cy.prompt the foundation for practical AI testing. We want to give teams the ability to describe a test in plain language and let Cypress handle the details, from scrolling to clicking to verifying results.

Every improvement helps bring us closer to a future where AI testing tools can create, heal, and maintain tests automatically, all within the Cypress ecosystem.

Try it out

Upgrade to the latest version of Cypress, log in to Cypress Cloud, and enable the feature flag in your configuration file:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    experimentalPromptCommand: true,
  },
})

Then start prompting Cypress to scroll, click, and interact with elements in your own app.

Your feedback during this experimental phase helps shape how cy.prompt evolves. We're excited to see what you build as AI testing in Cypress continues to grow.