Prompt to Write End-to-End Tests with Playwright
Generates a complete Playwright end-to-end test suite with Page Object Model, nominal and error scenarios, fixtures and optimized configuration.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Tu es un ingénieur QA senior spécialisé en tests end-to-end avec Playwright. Génère une suite de tests E2E complète pour l'application suivante :
- Type d'application : [TYPE_APPLICATION (ex: e-commerce, SaaS, blog, application bancaire)]
- Stack technique : [STACK_TECHNIQUE (ex: Next.js + API REST, Vue.js + GraphQL, React + Node.js)]
- Fonctionnalités à tester : [FONCTIONNALITES (ex: inscription, connexion, ajout au panier, paiement, tableau de bord)]
- URL de base : [URL_BASE (ex: http://localhost:3000)]
Pour chaque fonctionnalité, génère :
-
Un fichier de test Playwright (.spec.ts) avec :
- Des descriptions de test claires en français
- L'utilisation du Page Object Model pour isoler les sélecteurs
- Des assertions explicites avec
expect - La gestion des états (beforeEach, afterEach) pour l'isolation des tests
- Des data-testid pour les sélecteurs (pas de sélecteurs CSS fragiles)
-
Les scénarios suivants pour chaque fonctionnalité :
- Le parcours nominal (happy path)
- Au moins 2 cas d'erreur (champs vides, données invalides, timeout réseau)
- Un test de régression visuelle si pertinent
-
Un fichier de fixtures (test-data.ts) contenant les données de test réutilisables.
-
La configuration playwright.config.ts adaptée avec :
- Les navigateurs cibles (Chromium, Firefox, WebKit)
- Les timeouts appropriés
- Le base URL configuré
- Le reporter HTML activé
Respecte ces bonnes pratiques :
- Chaque test doit être indépendant et idempotent
- Utilise
test.describepour regrouper les tests par fonctionnalité - Privilégie
locatoravec des rôles ARIA ou data-testid - Ajoute des commentaires expliquant la logique métier testée
- Inclus des
await page.waitForLoadState()aux endroits critiques - Gère l'authentification via storageState pour éviter de se reconnecter à chaque test
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
Why this prompt works
<p>This prompt lets you quickly generate a professional end-to-end test suite with Playwright. By specifying the <strong>application type</strong> and <strong>tech stack</strong>, the AI adapts tests to your project's real context: appropriate selectors, framework-specific state management, and relevant business scenarios.</p><p>The prompt enforces the use of <strong>Page Object Model</strong>, an essential pattern for maintaining readable and scalable tests. Selectors based on <strong>data-testid</strong> and ARIA roles ensure robust tests that don't break with the slightest CSS change. The systematic inclusion of error cases and visual regression tests ensures comprehensive coverage.</p><p>To get the most from this prompt:</p><ul><li>Be specific about the <strong>features to test</strong> — list critical user journeys rather than generic pages</li><li>Mention <strong>external dependencies</strong> (third-party API, database) so the AI proposes appropriate network mocks or interceptors</li><li>Iterate by requesting performance or accessibility tests once the base is in place</li></ul>
Use Cases
Expected Output
A suite of ready-to-use TypeScript files including Playwright tests organized by feature, corresponding Page Objects, a fixtures file with test data, and an optimized Playwright configuration for multi-browser execution.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
Be the first to comment on this prompt.
📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Go further
Similar Prompts
Implement OWASP security headers
Add security headers
Implement secrets management
Secure credentials management
Gemini Prompt for Creating a Chatbot
Gemini, Google's artificial intelligence model, offers remarkable capabilities for designing high-performance chatbots tailored to your needs. Whether you want to create a customer assistant for your e-commerce site, a technical support bot or a conversational companion, Gemini excels at understanding natural language nuances and generating contextual responses. Thanks to its extended context window and multimodal capability, Gemini enables building chatbots that can process text, images and even documents. The main challenge lies in the quality of the initial prompt that will define your chatbot's personality, tone, limits and skills. A well-structured prompt transforms Gemini into a true conversational architect, capable of generating the code, dialogue flows and business logic needed. In this guide, we offer optimized prompts to get the most out of Gemini when creating chatbots, from rapid prototyping to production deployment with error handling and advanced customization.
Transform JSON data with business logic
Transform data between different API formats