P

Mistral Prompt to Create E2E Tests

End-to-end (E2E) tests are essential to ensure an application works as a whole, 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 E2E test creation. Thanks to its fine-grained understanding of technical context and ability to produce idiomatic code, Mistral can generate comprehensive test scenarios covering critical user paths. 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 paths, and testing conventions, you get E2E test suites ready to be integrated into your CI/CD pipeline. This approach drastically reduces writing time while improving test coverage.

The prompt

Mistral

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 paths to test

  1. [Describe the first path, e.g., New user registration]
  2. [Describe the second path, e.g., Login and access dashboard]
  3. [Describe the third path, e.g., Create and modify a project]

Conventions to follow

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

Expected deliverables

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

Personalize this prompt with Léa · AI assistant

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

Why it works

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

Expected result

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 produced code is directly executable after adapting CSS/data-testid selectors to your actual application.

Variants by level

FAQ

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 right APIs and conventions of the chosen framework.
How do I adapt tests generated by Mistral to my existing application?
The generated tests use generic selectors (data-testid) that need to be replaced with those of your application. Start by adding data-testid attributes to your interactive elements if not already done. Then adjust URLs, test data in fixtures, and wait times according to your application's actual performance. Run tests one by one to calibrate them before running 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 API to avoid going through the UI for each test, interceptors to handle tokens, and fixtures with different user roles. For OAuth flows, it is recommended to ask for a mock strategy for the external provider to avoid unstable dependencies in your tests.

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

Go further

Get new prompts every week

Join our newsletter.