Cy Prompt | Bondar Academy
Course: Cypress UI Testing with JavaScript
Module: Advanced Features
Instructor: Artem Bondar
Lesson Summary
Cypress has introduced an AI-powered command called CyPrompt that translates natural language steps into executable Cypress commands. Here’s how to set it up and use it effectively. Setup Instructions Register for a Cypress Cloud account (required for this feature). Add the following configuration to your cypress.config.js file: experimentalPromptCommand: true Log in to Cypress Cloud through the Cypress runner to enable synchronization. Using CyPrompt To demonstrate, a simple script is created to navigate to an application, sign in, and execute commands using Cy.prompt . The command takes an array of strings, each representing a step that Cypress will interpret and execute. Execution and Performance When running the test, the AI processes each step quickly, and results are cached for faster future executions. Modifications to the prompt trigger the AI to regenerate steps. Considerations Generated locators may be questionable and less stable, particularly in complex applications. Self-healing features attempt to adjust to changes in the application but require supervision. Usage limits apply: free accounts are limited to 100 prompts per hour; paid accounts allow 600 prompts per hour. Overall, while CyPrompt can speed up script generation, caution is advised regarding the reliability of generated locators and the self-healing feature. For critical applications, manual verification of locators is recommended.