P
💻DeveloppementIntermediateAll AIs

Perplexity Prompt to Create E2E Tests

End-to-end (E2E) tests are essential to ensure your application works correctly from the end user's perspective. However, manually writing them is time-consuming and error-prone. Perplexity, thanks to its ability to synthesize updated technical information and generate contextual code, becomes a valuable ally for creating robust E2E test suites. By combining its knowledge of modern testing frameworks (Playwright, Cypress, Selenium) with a fine understanding of your user journeys, Perplexity can produce comprehensive test scenarios covering nominal cases, edge cases, and error scenarios. This guide provides an optimized prompt to fully leverage Perplexity in generating E2E tests, whether you are working on a web, mobile, or complex API application. You will obtain structured, maintainable tests aligned with current automated testing best practices.

Paste in your AI

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

Act as a senior QA engineer specialized in end-to-end testing. I am developing a [APP_TYPE: web/mobile/SaaS] application built with [TECH_STACK: React, Node.js, PostgreSQL, etc.]. Generate a comprehensive E2E test suite using the [Playwright/Cypress/Selenium] framework for the following user journey: [describe the journey, e.g., signup → login → project creation → sharing → deletion]. For each test, include: (1) a descriptive name following the convention 'should + action + expected result', (2) setup and teardown steps with test data management, (3) precise assertions on DOM elements, redirects, and application states, (4) error case handling (network, validation, timeout), (5) robust selectors using data-testid rather than CSS classes. Organize tests by feature in a consistent file structure. Add comments explaining the tested business logic. Also include a framework configuration file with best practices for parallelization and reporting.

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 works because it assigns a precise expert role to Perplexity, which directs the quality and technical level of responses. The detailed specification of the tech stack and user journey allows the AI to generate code directly compatible with your environment. Finally, the imposed structure (naming, selectors, error handling) guarantees maintainable tests that meet professional QA automation standards.

Use Cases

Create E2E Tests

Variants

Expected Output

You will obtain a complete and functional E2E test suite, organized by feature, with test files ready to be integrated into your project. Each test covers the nominal journey as well as error scenarios, with precise assertions and robust selectors. The result will also include the test framework configuration with parallelization settings, reporters, and recommended fixtures.

Frequently Asked Questions

Which E2E testing framework does Perplexity recommend most often and why?

Perplexity tends to recommend Playwright for new projects due to its comprehensive documentation, native cross-browser support (Chromium, Firefox, WebKit), built-in auto-wait that reduces flaky tests, and native parallelization capabilities. However, it will suggest Cypress if you're working in a pure JavaScript ecosystem with a strong need for real-time visual debugging. The key is to specify your stack in the prompt to get a recommendation tailored to your context.

How can I prevent Perplexity from generating flaky tests or unstable selectors?

Explicitly specify in your prompt to use data-testid attributes as primary selectors rather than CSS classes or complex XPath selectors. Also ask for the use of the Page Object Model pattern to centralize selectors and make maintenance easier. Specify that you want assertions that wait for elements (auto-wait) instead of fixed delays (sleep). Finally, request explicit handling of intermediate states like loading screens to avoid false positives.

Can Perplexity be used to generate E2E tests for an existing application without documentation?

Yes, but you need to adapt your approach. Describe the user journeys in detail in your prompt instead of providing documentation. You can also give Perplexity snippets of your source code (components, routes, data models) so it understands your application's structure. An effective technique is to copy the HTML structure of a key page and ask Perplexity to identify testable elements and generate the corresponding tests. Then iterate by correcting the selectors and assertions to match your actual implementation.

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 à enrichir le prompt en demandant explicitement l’interception des appels API (via `page.route()` dans Playwright ou `cy.intercept()` dans Cypress) et l’utilisation de fixtures pour les données de test. Vos tests deviendront alors indépendants du backend, plus rapides et fiables, surtout en CI. Précisez aussi le mode headless et le format du rapport (JUnit/HTML) pour une intégration directe dans votre pipeline.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementBeginnerAll AIs

Write an ORM query

Write efficient ORM queries

437
💻DeveloppementIntermediateAll AIs

Stable Diffusion Prompt to Generate JavaScript Code

Stable Diffusion is an AI image generation model, not a proper code generation tool. However, it can be used creatively in the context of JavaScript development. Stable Diffusion excels at creating code-related visuals: stylized screenshots of JavaScript snippets, illustrations of programming concepts, software architecture diagrams, or educational images for tutorials and technical documentation. By combining well-crafted prompts, you can generate visual representations of JavaScript code on screen, infographics explaining algorithms, or illustrations for your technical blog posts. This approach is particularly useful for tech content creators, web development instructors, and marketing teams who need professional visuals around JavaScript programming. In this guide, we offer optimized prompts for achieving high-quality visual renderings featuring JavaScript code in various visual contexts.

472
💻DeveloppementAdvancedAll AIs

Implement property-based testing

Add property-based tests

497
💻DeveloppementIntermediateAll AIs

Implement rate limiting

Protect APIs from abuse

397