GitHub Copilot Prompt for Creating E2E Tests
End-to-end (E2E) tests are essential for validating the overall functionality of an application, but writing them is often time-consuming and repetitive. GitHub Copilot, integrated directly into your code editor, can significantly speed up this process by generating complete test scenarios from natural language descriptions. Whether you use Playwright, Cypress, or Selenium, Copilot understands your project's context—components, routes, selectors—to produce realistic and maintainable tests. The challenge is to formulate precise enough prompts to obtain tests that cover critical user paths, handle wait states, and assertions robustly, while respecting best practices of your test framework. In this guide, you'll find one main optimized prompt as well as variants adapted to your experience level to get the most out of GitHub Copilot in creating your E2E tests.
The prompt
Generate a suite of end-to-end tests with Playwright in TypeScript for the following user journey: [DESCRIBE_THE_JOURNEY, e.g., registration, login, add to cart, payment]. For each step of the journey, create an independent test in a describe block. Use the following best practices: accessible selectors (getByRole, getByText, getByTestId), explicit expectations with expect and toBeVisible/toHaveText, handling loading states with waitForLoadState, fixtures for reusable authentication, and the Page Object Model to encapsulate interactions with each page. Add assertions on URLs, displayed content, and visual states. Include a playwright.config.ts configuration file with baseURL, retries, and HTML reporter. Comment each section to explain the test logic.
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
Why it works
This prompt works because it specifies the framework (Playwright), the language (TypeScript), and the concrete user journey, eliminating ambiguity for Copilot. It imposes precise architectural patterns like the Page Object Model and accessible selectors, guiding generation towards maintainable code. Finally, it explicitly requests configuration, assertions, and comments, producing a complete and ready-to-execute deliverable.
Expected result
Variants by level
FAQ
How does GitHub Copilot handle dynamic selectors in E2E tests?
Can Copilot generate E2E tests for Cypress or Selenium in addition to Playwright?
How to integrate Copilot-generated E2E tests into a CI/CD pipeline?
Related prompts
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ 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
GitHub Copilot Prompt for Creating Illustrations
GitHub Copilot, initially designed as a programming assistant, proves to be a remarkable tool for generating code to create illustrations
GitHub Copilot Prompt for Creating Infographics
GitHub Copilot, the AI-powered coding assistant, proves to be a formidable ally for generating SVG, HTML, and CSS code to create infographics.
GitHub Copilot Prompt for Creating Mockups
GitHub Copilot, GitHub's AI-powered code assistant, proves to be a formidable tool for creating mockups directly in your code editor.
GitHub Copilot Prompt for Debugging Code
Debugging is one of the most time-consuming tasks in software development. GitHub Copilot, integrated directly into your code editor, can significantly
GitHub Copilot Prompt for Extracting Data Insights
GitHub Copilot, the AI coding assistant integrated into IDEs, is a powerful ally for extracting insights from raw data. Whether you are working with CSV files, SQL databases, or pandas DataFrames, Copilot can quickly generate exploratory analysis, visualization, and statistical summary code. The main challenge lies in crafting the prompt: a well-structured prompt allows Copilot to produce relevant analysis code on the first try, without unnecessary iterations. By clearly specifying the data format, the metrics you're looking for, and the type of visualization desired, you turn Copilot into a true data analyst capable of detecting trends, anomalies, and hidden correlations in your datasets. This page offers an optimized main prompt as well as variants tailored to your skill level, to get the most out of GitHub Copilot in your data analysis workflows.
GitHub Copilot Prompt for Generating a Database Schema
GitHub Copilot radically transforms how developers design their databases. Instead of starting from a blank page and manually writing every CREATE TABLE statement, you can now describe your business domain in natural language and get a complete schema in seconds.
Go further
Get new prompts every week
Join our newsletter.