diff --git a/cypress.config.ts b/cypress.config.ts index 2ff3cead21..3f90e8524e 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -13,7 +13,6 @@ export default defineConfig({ openMode: 0, }, e2e: { - experimentalStudio: true, supportFile: false, baseUrl: "http://localhost:3000", setupNodeEvents(on, config) { diff --git a/docs/api/commands/prompt.mdx b/docs/api/commands/prompt.mdx new file mode 100644 index 0000000000..e0d2d9c2ab --- /dev/null +++ b/docs/api/commands/prompt.mdx @@ -0,0 +1,779 @@ +--- +title: 'cy.prompt() - Generate Cypress Tests with Natural Language and AI' +description: Generate Cypress tests from plain English using AI. Automate test creation, reduce maintenance, and enable self-healing with cy.prompt. +sidebar_label: prompt +slug: /api/commands/prompt +e2eSpecific: true +sidebar_custom_props: { 'new_label': true } +--- + + + +:::warning + +`cy.prompt` is currently invite-only. [Request access](https://on.cypress.io/cy-prompt-early-access?utm_source=docs.cypress.io&utm_medium=prompt-command&utm_content=Request-access) to get early access. + +::: + +# prompt + +`cy.prompt` is a Cypress command that uses AI to convert natural language test steps into executable Cypress tests. It's designed to be flexible - you can use it to quickly generate tests and commit them to source control, or keep it running continuously for self-healing tests that adapt to your app's changes. You can choose the workflow that fits your project's needs. + +:::note + +Before you start coding with `cy.prompt` + +- [How it works](#How-it-works) — understand the AI-powered process behind `cy.prompt` +- [Choosing your workflow](#Choose-your-workflow) — decide between one-time generation or continuous self-healing +- [How to write effective prompts](#How-to-write-effective-prompts) — craft clear, reliable natural language steps +- [What you can do](#What-you-can-do) — explore supported actions and capabilities +- [Setup](#Setup) — enable the command and configure authentication + +::: + + + +_The demo above shows `cy.prompt` in action with [Cypress Studio](/app/guides/cypress-studio)._ + +## Syntax + +```typescript +interface PromptCommand { + ( + steps: string[], // array of steps to execute + options?: { + placeholders?: { [key: string]: string } // redacted dynamic inputs that are ignored for cache identity + } + ): void +} +``` + +### Arguments + + **steps _(String[])_** + +An array of steps to execute. + + **options _(Object)_** + +Pass in an options object to `cy.prompt()`. + +| Option | Default | Description | +| -------------- | ------- | --------------------------------------------------------------------------------------------------------------------- | +| `placeholders` | `{}` | Dynamic or sensitive values that enable high performance caching. See [placeholders](#Placeholders) for more details. | + + + +`cy.prompt()` yields the value yielded by the last Cypress command executed in the prompt. In most cases, this will be an element, but it depends on the last command executed in the prompt. + +```javascript +cy.prompt([ + // Executes cy.visit('/user-management') + 'visit https://cloud.cypress.io/login', + // Executes cy.get('#login-button').click() + 'click the login button', +]) // yields