# How to Build Robust Applications with Cursor AI + Playwright <!-- ref: @content/youtube/yifan-bth/how-to-build-robust-applications-with-cursor-ai-playwright tags: [end-to-end testing, Playwright, Cursor Composer, notepads, test-driven AI development, authentication in tests, transcript editor] version: 2 updated_at: 2026-11-24T07:21:32.674Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=kH4hM0H_WPg)** # How to Build Robust Applications with Cursor AI + Playwright *Synthesized from Yifan on Beyond the Hype, 2024-10-18.* Yifan presents a solo walkthrough of using Playwright end-to-end tests, written with Cursor, to guard features in his podcast transcript editor. The transcript is a rough automatic transcription. ## Core Thesis Yifan argues that tests matter more as AI speeds up shipping, and that end-to-end tests are the most useful place to start because they follow a user's path through the app. He uses a Cursor notepad built from Playwright's documentation to have the AI write those tests alongside each feature, and he says unit and integration tests are still needed for critical logic. ## Key Insights - **Why end-to-end first.** For a small team, end-to-end tests force the developer to think about the user journey, and a hard-to-write test can signal a journey that is too complex. - **Test structure.** Each Playwright test navigates to a page, takes an action, and checks the result. The UI mode lists the suites, runs them one at a time, and shows each step with screenshots and locator highlights. - **Verify the test.** He broke the code on purpose, by returning an undefined edit time, to confirm the test failed, then restored it and confirmed the pass. Playwright's built-in waiting and retries mean most tests need no explicit timeouts. - **Notepad from docs.** He passed Playwright's documentation pages to the chat, asked it to merge them with his existing notes, and attached the result to later test tasks. The notepad covers file locations, naming, grouping and authentication, and ends with an example that he edited to match his style. - **Feature by feature.** Search was added with a test first; the test checks that items appear and hide as the query changes, and the AI implemented the component with little manual work. - **Larger feature.** The upload feature sent files to the AssemblyAI transcription service through a new API route, updated the list, and added a test that runs the real transcription. It took about 30 minutes with tests, and five follow-up prompts to fix errors that he passed back from the test output. - **Delete feature.** Deletion took about an hour, including the data-access permission check. The first attempt left out the test, which he had to request again. - **Login state.** Playwright's codegen can save cookies and local storage to a file, which every test can load, so tests can run as a logged-in user. ## Actionable Takeaways 1. Start with end-to-end tests that follow the main user journey, then add unit and integration tests for critical logic. 2. Build a test notepad from the framework's own best-practice docs, and attach it to each test-writing task. 3. Confirm each new test fails when the feature is broken before trusting it. 4. Save a logged-in browser state once and reuse it across tests, rather than logging in every time. 5. Pass test failure output back to the AI as the debugging input. ## Notable Quotes > "testing has now become even more important than ever before" — Yifan > "I didn't write a single line of code" — Yifan --- *Related: `@content/youtube/yifan-bth/5x-your-cursor-ai-coding-quality-with-these-pro-tips` · `@content/youtube/yifan-bth/let-the-agent-write-the-tests-and-the-fixes` · `@content/youtube/yifan-bth/claude-code-beat-cursor-4-2-heres-why-im-still-using-both` · `@content/youtube/yifan-bth/my-day-to-day-ai-dev-workflow-git-cursor-windsurf-cline-playwright-supabase-replit` · `@content/youtube/langchain/agent-that-can-browse-the-web-with-managed-deep-agents-and-browserbases-stagehand`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*