Add end-to-end tests: Free AI Prompt | SheCodes

Free AI prompt · The Optimize Book

Add end-to-end tests

A ready-to-use prompt from the chapter Testing Basics. Paste it into Claude, ChatGPT, Lovable, Bolt or any AI coding tool.

The prompt

“Set up Playwright for end-to-end testing. Create tests that: open the homepage, check the navigation links work, fill out the main form and submit it, and verify the success page appears. Make the tests run in headless mode.”

How to use it

  1. Copy the prompt and paste it into your AI coding tool.
  2. Check the result in the preview, then ask for changes one at a time: "make the buttons bigger", "use my brand colours".
  3. Read the chapter to understand why it works and what to do next.

More prompts like this

All prompts

Set up testing in your project

“Add Vitest to my project for unit testing. Set up the configuration file and create a simple example test that passes. Also add a test script to my package.json so I can run tests easily.”

Write tests for your forms

“Write tests for my contact form. Test that: the form renders correctly, required fields show an error when submitted empty, the email field rejects invalid emails, and a successful submission shows a confirmation message. Use Vitest and React Testing Library.”

Test an existing feature

“Look at my project and write tests for the most critical user flows. Focus on anything involving forms, authentication, or data submission. Use Vitest for unit tests and explain what each test checks.”

Add basic tests

“Add basic tests to my app. Write tests for my [component/function/API route] that check [expected behavior]. Use Vitest and Testing Library.”

Pre-deploy checklist

“Review my project and tell me if it's ready to go live. Check for: any leftover test URLs that point to my computer instead of the real site, any missing API keys or settings, any large unoptimized images, any debug messages left behind, any missing error pages, and any missing SEO tags. List everything I need to fix before I publish.”