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

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

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.

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