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

💻DeveloppementAdvancedAll AIs

Implement CSP with nonces

Prevent XSS with strict CSP

0232
💻DeveloppementIntermediateAll AIs

DALL-E Prompt to Generate JavaScript Code

DALL-E, the image generation model developed by OpenAI, is not designed to produce executable JavaScript code. However, it can play a valuable complementary role in a JavaScript developer's workflow. DALL-E excels at creating visuals related to development: user interface mockups, architecture diagrams, data flow schemas, or illustrations to document your code. By crafting precise prompts, you can obtain visual representations of complex JavaScript concepts like closures, the event loop, or design patterns. These visuals then serve as references for implementing your code, creating attractive technical documentation, or designing educational materials. The approach is to use DALL-E as a rapid visual prototyping tool: generate a UI mockup, then translate it into JavaScript components. This method accelerates the design phase and reduces back-and-forth between designers and developers. In this guide, we offer optimized prompts to get the most out of DALL-E in your JavaScript development process, from UI prototyping to visual documentation of your code.

0496
💻DeveloppementAdvancedAll AIs

Create a High-Performance Scalable Redis Cache System

A complete prompt to design and implement a Redis cache system with invalidation strategies, error handling and monitoring.

0169
💻DeveloppementAdvancedAll AIs

Prompt to Create Optimized Serverless Functions

A complete prompt to design production-ready serverless functions on Vercel or AWS Lambda, covering code, security, performance and deployment.

0164