P

Gemini Prompt for Creating E2E Tests

End-to-end (E2E) tests are essential to ensure the overall functioning of an application, but writing them is often time-consuming and repetitive. Google's AI model Gemini excels in generating structured code and can significantly speed up the creation of comprehensive E2E test suites. By providing the technical context of your application — technology stack, critical user journeys, and the test framework used — Gemini can produce robust test scenarios covering main flows and edge cases. Whether you use Playwright, Cypress, or Selenium, the AI adapts to your framework's conventions to generate directly usable code. The prompt engineering approach allows you to specify the desired coverage level, preferred selector patterns, and test data management strategy. The result: maintainable, readable tests aligned with your team's best practices, produced in a fraction of the usual time.

The prompt

Gemini

You are a senior QA engineer specialized in end-to-end testing. I am working on a [APPLICATION TYPE: web/mobile/desktop] application built with [TECH STACK: e.g. React, Node.js, PostgreSQL].

E2E test framework used: [FRAMEWORK: Playwright/Cypress/Selenium]
Base URL: [URL]

Here is the user path to test:
[DESCRIBE THE COMPLETE FLOW STEP BY STEP]

Generate a complete E2E test suite following these rules:

  1. Use resilient selectors (data-testid, ARIA roles) — never fragile CSS selectors
  2. Each test must be independent and idempotent
  3. Include test data setup and teardown
  4. Handle loading states and async waits explicitly
  5. Cover the happy path, error cases (invalid form, network timeout, 403/404) and edge cases
  6. Add comments explaining the business logic being tested
  7. Use the Page Object Model pattern for reusability
  8. Include meaningful assertions at each key step

Structure your response as follows:

  • Required Page Objects with their methods
  • Configuration and fixtures file
  • Test suite organized by feature
  • Helper for test data seeding

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 a specific expert role to Gemini and provides all the technical context needed to generate code tailored to your environment. The numbered rules act as quality constraints that eliminate common anti-patterns (fragile selectors, coupled tests, implicit waits). The required output structure enforces an organized result following the Page Object Model pattern, directly integrable into a professional codebase.

Expected result

You get a complete and structured E2E test suite: Page Objects encapsulating interactions with each page, fixtures for data seeding, and test files organized by feature covering the happy path and error cases. The generated code uses resilient selectors, properly handles async operations, and includes business comments facilitating long-term maintenance.

Variants by level

FAQ

Which E2E test framework does Gemini handle best?
Gemini produces excellent results with Playwright and Cypress, the two most documented frameworks in its training data. Playwright is recommended for projects requiring multi-browser support and native parallelization, while Cypress is better suited for frontend teams that prioritize developer experience. Always specify the framework and its version in your prompt to get up-to-date syntax and avoid deprecated APIs.
How can I ensure that tests generated by Gemini are maintainable in the long term?
Three key practices ensure maintainability: first, require the Page Object Model pattern in your prompt to encapsulate selectors and interactions per page. Second, enforce the use of data-testid selectors rather than style-related CSS selectors, which break with every visual refactoring. Finally, ask Gemini to add comments explaining the business intent of each test, not just the technical action. Always review the generated code and adapt variable names and file structure to your team's conventions.
Can Gemini generate E2E tests from user stories or mockups?
Yes, Gemini can transform user stories into E2E test scenarios if you formulate them clearly in your prompt. Describe each story in the format 'As a [ROLE], I want [ACTION] so that [BENEFIT]' followed by detailed acceptance criteria. For mockups, Gemini (in multimodal version) can analyze screenshots and infer the interactive elements to test. Combine both approaches — story + screenshot — for the most complete coverage.

Related prompts

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. 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

Gemini Prompt for Creating Illustrations

Gemini, Google's artificial intelligence model, offers remarkable capabilities for creating original and detailed illustrations. Whether you are a...

Gemini Prompt for Creating Images

Gemini, Google's artificial intelligence model, now integrates advanced image generation capabilities directly into its responses. Unlike classic image generators, Gemini combines deep language understanding with visual generation, allowing you to create images from highly detailed text descriptions in English. Whether you're a graphic designer looking to quickly prototype concepts, an entrepreneur creating visuals for social media, or simply curious about AI-assisted creation, mastering the art of prompting Gemini will save you considerable time. The key lies in the precision of your instructions: artistic style, composition, lighting, color palette, and overall atmosphere are all parameters that Gemini can interpret to produce striking results. In this guide, you'll discover an optimized main prompt as well as variants suited to your skill level, to get the most out of image generation with Gemini.

Gemini Prompt for Creating Infographics

Gemini, Google's artificial intelligence, offers remarkable capabilities for creating impactful infographics. Whether you are a marketer, teacher, journalist, or entrepreneur, AI-generated infographics radically transform your visual communication workflow. Whereas before you had to master tools like Canva, Illustrator, or Piktochart, a well-structured prompt in Gemini allows you to obtain complete infographic concepts: narrative structure, visual hierarchy, color palette, data layout, and typographic recommendations. The challenge is not simply to ask for an infographic, but to provide Gemini with the necessary context to produce a professional result tailored to your audience. A good prompt specifies the topic, the target audience, the desired tone, the output format, and the key data to highlight. By mastering these prompting techniques, you can produce infographic briefs in minutes that would have required hours of work with a designer. This guide offers optimized prompts, tested and classified by level, to fully exploit Gemini's potential in creating impactful infographics.

Gemini Prompt for Creating Instagram Stories

Instagram Stories have become an essential tool for capturing your audience's attention. With over 500 million daily users, this ephemeral format demands striking visuals, catchy text, and a narrative that makes people want to swipe. Gemini, Google's AI, proves to be a powerful ally for designing professional stories without spending hours on content creation. Thanks to its text and image generation capabilities, Gemini can help you write magnetic hooks, structure coherent story sequences, propose engaging scripts, and even suggest visual palettes adapted to your brand identity. Whether you're a community manager, entrepreneur, or content creator, using Gemini for your stories allows you to maintain a regular publishing cadence while keeping a high quality level. This prompt has been designed to fully leverage Gemini's strengths in creating Instagram stories that generate engagement, DM responses, and conversions. It incorporates best practices for the vertical format, narrative codes of high-performing stories, and copywriting techniques adapted for mobile.

Gemini Prompt for Creating Mockups

Gemini, Google's artificial intelligence model, offers remarkable capabilities for creating mockups thanks to its multimodal understanding and ability to generate images.

Gemini Prompt for Creating Personas

Creating personas is a fundamental step in any marketing strategy, UX design, or product development. A well-constructed persona allows you to make informed decisions by putting yourself in your target user's shoes.

Go further

Get new prompts every week

Join our newsletter.