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

Answer 3 questions and Léa tailors the prompt to your situation.

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.

Learn more

Check the full skill on Prompt Guide to master this technique from A to Z.

View on Prompt Guide

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Similar Prompts

💻DeveloppementIntermediateAll AIs

Generate Mocks and Fixtures for Your Automated Tests

A prompt to automatically generate realistic mocks, stubs and data fixtures adapted to your test framework and use cases.

091
💻DeveloppementIntermediateAll AIs

Automatically Generate Unit Tests with AI

Automatically generate an exhaustive unit test suite covering nominal cases, edge cases, and error cases for any source code.

0223
💻DeveloppementIntermediateGemini

Create a Python Automation Script

Create a professional Python automation script with CLI configuration, structured logging, error handling, and tests.

24239
💻DeveloppementAdvancedAll AIs

Analyze and Optimize Algorithmic Complexity

Analyze the Big O complexity of your algorithms and optimize them with appropriate data structures and more efficient algorithms.

40233