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.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

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

💻DeveloppementIntermediateAll AIs

Namespace and Quota Management

Manage a multi-tenant cluster

0108
💻DeveloppementBeginnerAll AIs

Artifact Retention Policy

Optimize artifact storage costs

097
💻DeveloppementAdvancedAll AIs

Build a virtualized list

Handle massive data lists

0142
💻DeveloppementIntermediateChatGPT

Prompt ChatGPT to Generate SQL Queries

Generating SQL queries is an essential skill for any developer, data analyst, or database administrator. However, writing complex queries involving multiple joins, nested subqueries, or aggregate functions can be time-consuming and error-prone. ChatGPT transforms this practice radically by allowing you to describe your needs in natural language to obtain optimized and functional SQL queries in seconds. Whether you work with MySQL, PostgreSQL, SQL Server, or SQLite, the AI adapts to the specific syntax of your database management system. By providing your table schema and a clear description of what you want, you can generate perfectly structured SELECT, INSERT, UPDATE, or DELETE queries. ChatGPT also excels at line-by-line explanations of generated queries, making it a valuable learning tool for beginners and professionals alike who wish to explore advanced SQL features like CTEs, window functions, or recursive queries.

0118