ChatGPT Prompt for Creating E2E Tests
End-to-end (E2E) tests are essential for ensuring an application works as a whole, but writing them is often time-consuming and repetitive. ChatGPT can significantly speed up this process by generating complete test scenarios covering critical user paths, edge cases, and required assertions. Whether you use Cypress, Playwright, Selenium, or any other framework, the AI can produce structured and maintainable tests from a simple functional description. The key is to provide a precise enough prompt to obtain realistic tests that follow best practices (stable selectors, async handling, test isolation) and integrate directly into your CI/CD pipeline. In this guide, you'll find a main optimized prompt as well as variants adapted to your expertise level, to transform your functional specifications into robust E2E test suites in seconds.
The prompt
You are a senior QA engineer specialized in end-to-end testing. I will describe a feature of my web application and I want you to generate a complete E2E test suite.
Technical context:
- Testing framework: [Cypress / Playwright / Selenium]
- Language: [TypeScript / JavaScript]
- Application: [BRIEF_APP_DESCRIPTION]
Feature to test:
[DESCRIBE_USER_JOURNEY]
Mandatory instructions:
- Use stable selectors (data-testid, ARIA roles) — never fragile CSS selectors
- Each test must be independent and idempotent
- Handle async correctly (explicit waits, no arbitrary sleeps)
- Cover the happy path, at least 2 error cases, and 1 edge case
- Add comments explaining the logic of each test block
- Include necessary setup and teardown (fixtures, test data, initial state)
- Name tests descriptively with the pattern: "should [ACTION] when [CONDITION]"
Generate the complete code, ready to be copied into a test file.
Personalize this prompt with Léa
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why it works
This prompt works because it assigns the AI a precise expert role and strictly frames the technical constraints, eliminating generic responses. By imposing concrete rules (stable selectors, test independence, async handling), it forces ChatGPT to produce code that follows best practices recognized by the QA community. The structure in distinct sections (context, feature, instructions) leverages the AI's ability to follow multi-level instructions for a directly usable result.
Expected result
Variants by level
FAQ
Which E2E testing framework should I specify in the prompt for best results?
How can I ensure the tests generated by ChatGPT are reliable and not flaky?
Can I use ChatGPT to generate E2E tests from user stories or mockups?
Related prompts
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 4800+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More prompts to explore
ChatGPT Prompt for Creating Flashcards
Flashcards are one of the most effective learning methods, based on the principle of spaced repetition and active recall. Yet, creating high-quality flashcards manually requires considerable time: formulating questions, synthesizing answers, structuring information by difficulty level. That's precisely where ChatGPT becomes a valuable ally.
ChatGPT Prompt for Creating Infographics
Infographics have become an essential communication tool to synthesize complex data into impactful visuals. Whether you are a marketer, teacher, journalist or entrepreneur, the ability to create clear and engaging infographics is a major asset. ChatGPT revolutionizes this process by allowing you to structure, write and conceptualize your infographics without graphic design skills. With well-crafted prompts, you can get a complete visual architecture: information hierarchy, key data selection, catchy titles, captions and layout suggestions. ChatGPT excels particularly in transforming raw data into coherent visual stories, identifying the most striking statistics and proposing narrative structures adapted to your audience. This guide provides optimized prompts for each step of infographic creation, from initial brainstorming to final writing of texts that will accompany your visuals. You will discover how to leverage artificial intelligence to produce professional infographics that capture attention and convey your message with impact.
ChatGPT Prompt for Creating UI Design
User interface (UI) design is an area where ChatGPT can become a valuable assistant, even if it doesn't generate visual mockups directly.
ChatGPT Prompt for Creating YouTube Thumbnails
YouTube thumbnails are the first visual element your viewers see before clicking on a video. An eye-catching thumbnail can make the difference between an ignored video and viral content.
ChatGPT Prompt for Data Analysis
Data analysis has become an indispensable strategic lever for businesses and professionals. Yet extracting relevant insights from raw datasets remains a technical challenge that usually requires skills in statistics, programming, or specialized tools like advanced Excel, Python, or R. ChatGPT radically transforms this approach by allowing anyone to analyze complex data through natural language instructions.
ChatGPT Prompt for Evaluating Skills
Skills assessment is a central issue for recruiters, managers, and trainers. Traditionally time-consuming and subjective, this process can be significantly improved with ChatGPT.
Go further
Get new prompts every week
Join our newsletter.