P
💻DeveloppementIntermediateAll AIs

Mistral Prompt for Creating E2E Tests

End-to-end (E2E) tests are essential to ensure the overall proper functioning of an application, but writing them is often time-consuming and repetitive. Mistral, the language model developed by Mistral AI, excels at generating structured code and can significantly speed up the creation of E2E tests. With its deep understanding of technical context and ability to produce idiomatic code, Mistral can generate complete test scenarios covering critical user journeys. Whether you use Playwright, Cypress, or Selenium, Mistral adapts to your chosen framework and produces maintainable tests following best practices. By providing a well-structured prompt describing your application, its key journeys, and your testing conventions, you get E2E test suites ready to be integrated into your CI/CD pipeline. This approach drastically reduces writing time while improving your applications' test coverage.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

You are a senior QA engineer specialized in end-to-end testing. Generate a complete E2E test suite for my web application.

Application Context

  • Type: [describe your application, e.g., project management SaaS]
  • Tech Stack: [e.g., React, Next.js, REST API]
  • Test Framework: [Playwright / Cypress / Selenium]
  • Base URL: [e.g., http://localhost:3000]

User Journeys to Test

  1. [Describe the first journey, e.g., New user registration]
  2. [Describe the second journey, e.g., Login and dashboard access]
  3. [Describe the third journey, e.g., Creating and editing a project]

Conventions to Follow

  • Use the Page Object Model pattern to isolate selectors
  • Each test must be independent and idempotent
  • Include explicit assertions at every critical step
  • Handle wait states with explicit waits (no sleep)
  • Add comments explaining the business logic being tested
  • Name tests using the format: "should [ACTION] when [CONDITION]"

Expected Deliverables

  1. Page Object files for each involved page
  2. Test files organized by feature
  3. A configuration file for the test framework
  4. Necessary fixtures and test data
  5. Reusable custom commands or helpers

Personalize this prompt with Léa

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

Why this prompt works

This prompt leverages the QA expert role to steer Mistral toward professional testing practices. The detailed structure with application context, user journeys, and conventions imposes a precise framework that eliminates ambiguity. The request for multiple deliverables (Page Objects, fixtures, configuration) forces the model to produce a complete and coherent test architecture rather than isolated tests.

Use Cases

Create E2E Tests

Variants

Expected Output

Mistral generates a structured E2E test suite with reusable Page Objects, test files organized by feature, and data fixtures. Each test follows the Arrange-Act-Assert pattern with explicit assertions and robust selectors. The code produced is directly executable after adapting CSS/data-testid selectors to your actual application.

Frequently Asked Questions

Which E2E testing framework does Mistral handle best?

Mistral produces excellent results with Playwright and Cypress, the two most popular frameworks. Playwright is recommended for projects requiring multi-browser support and native parallel execution, while Cypress is better suited for teams looking for quick onboarding with an excellent debugging dashboard. Always specify the framework in your prompt to get idiomatic code using the correct APIs and conventions for the chosen framework.

How do I adapt Mistral-generated tests to my existing application?

Generated tests use generic selectors (data-testid) that need to be replaced with your application's selectors. Start by adding data-testid attributes to your interactive elements if you haven't already. Then, adjust the URLs, test data in fixtures, and wait times based on your application's actual performance. Run the tests one by one to calibrate them before executing them as a full suite.

Can Mistral generate E2E tests for applications with complex authentication?

Yes, provided you precisely describe the authentication mechanism in your prompt (OAuth, JWT, session cookies, 2FA). Mistral can generate authentication helpers that log in via the API to avoid going through the UI for every test, interceptors for managing tokens, and fixtures with different user roles. For OAuth flows, it is recommended to request a mocking strategy for the external provider to avoid unstable dependencies in your tests.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Pensez à préciser dans les conventions l’usage de sélecteurs stables (`data-testid`) plutôt que des sélecteurs CSS fragiles, et demandez explicitement des scénarios négatifs (erreurs 401, champs invalides, timeouts). Ajoutez aussi la configuration headless pour CI avec capture d’écran/vidéo en cas d’échec : vous obtiendrez une suite plus robuste et exploitable.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateAll AIs

Sora Prompt for Creating E2E Tests

End-to-end (E2E) tests are essential for ensuring application reliability, but writing them remains time-consuming and repetitive. Sora, thanks to its advanced generation capabilities, makes it possible to automate the creation of complete E2E test scenarios in seconds. By formulating a precise prompt describing user journeys, expected interactions, and validation criteria, you obtain structured test suites covering nominal cases as well as edge cases. The prompt engineering approach applied to Sora transforms how QA and development teams approach test coverage. Instead of starting from a blank page, you describe the expected behavior of your application in natural language, and Sora generates the corresponding test code with appropriate assertions. This method significantly reduces the time needed to set up an E2E suite while maintaining a professional quality level. Whether you use Playwright, Cypress, or Selenium, the prompts presented here adapt to your technical stack and the complexity of your application.

383
💻DeveloppementIntermediateAll AIs

Implement rate limiting

Protect APIs from abuse

395
💻DeveloppementIntermediateAll AIs

GitHub Copilot Prompt for Creating a REST API

GitHub Copilot has become an essential assistant for developers looking to accelerate the creation of REST APIs. Thanks to its direct integration into the code editor, it understands the context of your project and generates structured code in real time. Whether you work with Node.js and Express, Python and FastAPI, or Java and Spring Boot, Copilot adapts to your tech stack to produce endpoints conforming to REST conventions. The main challenge lies in formulating the prompt: a well-structured prompt yields a complete API with data validation, error handling, authentication, and documentation. A vague prompt, on the other hand, will produce generic code requiring many adjustments. In this guide, we offer an optimized prompt that fully leverages GitHub Copilot's capabilities to generate a professional, testable, production-ready REST API. You will also discover variants adapted to your experience level as well as practical tips to get the most out of this tool on a daily basis.

425
💻DeveloppementAdvancedAll AIs

Implement CSP with nonces

Prevent XSS with strict CSP

429