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
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
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 4800+ 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 Flashcards
GitHub Copilot, the AI-powered coding assistant, is not limited to code generation. It also excels at creating structured content li
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 Documenting Code
Code documentation is often overlooked by developers, yet it is a fundamental pillar of software maintainability.
Go further
Get new prompts every week
Join our newsletter.