How to Write Cypress Tests in Plain English with AI
Use Cypress cy.prompt or Cypress Studio to turn a test idea into editable end-to-end code. Learn the setup, review steps, limits, and fixes.
Cypress offers two ways to create end-to-end tests with AI assistance: describe actions with cy.prompt(), or record real interactions with Cypress Studio. Both produce Cypress commands you can inspect and edit. Treat generated code as a draft: verify the selectors, add assertions that express the behavior you need to protect, and run the test before committing it.
Use cy.prompt() when you already know the steps and can describe them clearly. Use Cypress Studio when demonstrating the flow in the application is easier than describing it. AI prompt interpretation and Studio AI recommendations require Cypress Cloud; basic Studio recording and manual assertions do not.
1. Choose a workflow
| Workflow | How you provide the flow | Best fit | Cloud requirement |
|---|---|---|---|
cy.prompt() |
Write natural-language steps in the test. | A known, step-by-step user journey. | Cloud connection required to interpret prompts. |
| Cypress Studio | Interact with the application while Studio records. | A flow that is quicker to demonstrate than describe. | Recording and manual assertions can work without Cloud. |
| Studio AI | Record interactions and request suggested assertions. | Getting suggestions for visible UI changes. | Cloud account and linked project required. |
This fit is a practical inference from Cypress’s descriptions, not a measured claim that one workflow is faster or more reliable. Studio AI observes visible UI changes; it does not know your business rules or backend requirements.
2. Set up a Cypress test
Start with a Cypress project and an end-to-end spec. The example below uses the documented cy.prompt() syntax. Put it in an E2E spec in your project, for example cypress/e2e/cart.cy.js. Ensure your project can reach Cypress Cloud and is authenticated, such as by logging in or using --record with a valid key. For current prerequisites and command behavior, see the Cypress AI test-generation guide and the cy.prompt() API reference.
describe('shopping cart', () => {
it('adds a laptop to the cart', () => {
cy.prompt([
'visit https://example.com/products',
'search for "laptop" in the search field',
'click the "Add to Cart" button',
'verify the cart shows 1 item',
])
})
})
Replace the example URL and wording with the real application and behavior. A complete prompt test includes the outcome you care about, but still needs review: confirm that the final command checks the actual cart count and not just a nearby label or transient message.
Write prompts Cypress can act on
- Start each step with an action, such as “visit,” “type,” or “click.”
- Use one action per step.
- Name the target clearly: use the button’s visible label or the field’s purpose.
- Add context when a page has repeated controls, such as “the Add to Cart button for the laptop result.”
- Use an absolute URL when visiting a page.
- Use English. Cypress says English prompts are optimized; accuracy and support for other languages are not guaranteed.
Cypress summarizes its guidance as: “Prompt clarity determines reliability.” See its prompt-writing guidance for the current recommendations. The guide says only force and timeout options are currently supported through natural-language prompting; check the API reference for the current command surface.
3. Record a flow with Cypress Studio
- Open the application under test with Cypress and start Studio recording for the spec.
- Perform the user journey in the browser. Studio records interactions as Cypress commands in the spec.
- Stop recording and inspect the generated commands and selectors in the code panel.
- Add assertions manually, or request Studio AI recommendations if the project is linked to Cypress Cloud.
- Review every suggested assertion against the intended product behavior, then run the spec.
Studio AI requires Cypress 15.11.0 or later according to the current Cypress Studio guide. The guide documents E2E-only support, no Cucumber-style tests, no recording across multiple origins, and no iframe or Shadow DOM support. These constraints can change, so check the guide when upgrading or planning a workflow.
4. Review and strengthen generated tests
Generated code is ordinary Cypress code, so keep the final spec readable and focused on a user-visible requirement.
- Check the target: make sure each selector points to the intended control, especially when labels repeat.
- Check the assertion: assert the business outcome, such as a cart count changing or a signed-in user seeing protected content.
- Check state and setup: confirm the test starts from a known state and does not depend on a previous test’s data.
- Check timing: prefer Cypress’s retrying assertions over arbitrary waits where possible; verify the app’s expected loading behavior.
- Check readability: remove redundant actions and split unrelated outcomes into separate tests.
- Run it: a generated command sequence is not proof that the test passes consistently or protects the intended requirement.
Cypress Studio’s documented selector preference order is data-cy, data-test, data-testid, data-qa, name, id, class, tag, attributes, then nth-child. Prefer stable test-specific attributes where your application provides them. Projects can configure selection preferences with Cypress.ElementSelector; see the Studio guide.
5. Requirements, privacy, and current limits
cy.prompt()needs a secure Cypress Cloud connection for prompt interpretation. Cypress documents availability on the free Starter plan; paid plans increase usage allowances.- Basic Cypress Studio recording and manual assertions do not require Cloud. Studio AI assertion recommendations require a Cloud account and linked project.
- Cypress documents these Studio AI limits: 60 recommendations per hour for a free Cloud account; 300 per hour for a paid account or free trial; 10 parallel recommendation requests across plans. An anonymous trial allows up to 6 recommendations in a browser session before login or project linking is requested. These are Cypress’s published limits, accessed in 2026, and may change. Check the current Studio guide.
- Cypress says prompts are not used to train AI models, and organization-level controls can disable AI features. Confirm current privacy and administrative details in the Cypress Cloud AI documentation before enabling the workflow for a team.
- AI recommendations do not understand your application’s business logic. Review generated steps, selectors, and assertions before relying on them.
6. Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
cy.prompt() cannot interpret the steps or does not run as expected. |
The test cannot reach an authenticated, secure Cypress Cloud connection, or the steps are vague. | Verify Cloud login or the --record key and connection. Rewrite steps as clear, single actions with specific targets. |
| A generated action hits the wrong element. | The page has repeated or ambiguous targets, or the selector is brittle. | Add positional or page context to the prompt; inspect the generated selector. Add stable test attributes and configure selector preferences if appropriate. |
| The test passes but does not protect the intended behavior. | The assertion checks a visual detail or message instead of the user outcome. | Rewrite or add an assertion tied to the requirement, such as the resulting count, state, or access outcome. Have a reviewer confirm its meaning. |
| Studio AI recommendations are unavailable. | The project is not linked to a Cloud account, the account’s recommendation limit was reached, or the project uses an unsupported flow. | Link the project, check the current account limits, and confirm the E2E, origin, iframe, and Shadow DOM constraints in the Studio guide. Continue recording and adding assertions manually if needed. |
| Studio fails to record the intended journey. | The flow crosses origins or uses an iframe, Shadow DOM, or a test style Studio does not support. | Check Studio’s current compatibility limits. Author the unsupported portion directly in Cypress code or divide the journey into supported tests. |
| Selectors break after a UI change. | The generated selector relies on classes, element position, or other unstable markup. | Use stable test-specific attributes or accessible, meaningful selectors, then inspect the updated command before rerunning the spec. |
7. Performance, reliability, and cost
AI authoring changes how commands are drafted; it does not remove the runtime cost or maintenance needs of an end-to-end test. Keep flows focused, avoid unnecessary navigation and arbitrary waiting, and use meaningful assertions that Cypress can retry. Reliability comes from stable selectors, controlled test data, clear test intent, and running the spec against the relevant application state.
The documented AI features require Cloud access for interpretation or recommendations. Cypress says cy.prompt() is available on the free Starter plan and that paid plans increase some allowances. Studio recording and manual assertions do not require Cloud. Current account limits, plan details, and privacy controls are documented by Cypress prompt docs and Cypress Cloud AI docs. No independent productivity benchmark is established here.
8. Or skip the browser setup
If you need a screenshot of the page under test for a bug report, review, or test artifact, ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP, or PDF. The API documentation covers its request options.
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://example.com/products \
-o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com/products"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://example.com/products',
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await Bun.write('shot.webp', res);
- Cookie and consent banners, newsletter popups, and chat widgets are removed before the capture; each cleanup step can be turned off.
- Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Response headers report the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - The free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is on every plan.
Sign up for ScreenshotNeo’s free 1,000 screenshots a month, with no card required.
9. FAQ
Can Cypress generate a complete test from one sentence?
You can describe a sequence with cy.prompt(), but you still need to inspect its commands and ensure assertions cover the behavior you care about.
Can I use prompts in a language other than English?
Cypress optimizes prompts for English and does not guarantee accuracy or support for other languages.
Do I need Cypress Cloud for every AI-assisted workflow?
Cloud is required for prompt interpretation and Studio AI recommendations. It is not required for Studio’s basic recording or manual assertions.
Does Cypress AI know whether an assertion matches my product rules?
No. Reviewers must judge generated assertions against application behavior and business requirements.
Where can I check whether current limits changed?
Use Cypress’s current Studio guide, prompt guide, and Cloud AI documentation.


