{"slug": "how-to-improve-playwright-test-coverage-using-agent-context", "title": "How to Improve Playwright Test Coverage Using Agent Context", "summary": "A developer used Entire, a tool that captures agent session context, to improve Playwright test coverage for a music app built with an AI agent. The app, called Air Jam, uses MediaPipe for hand tracking and Tone.js for audio, and the developer leveraged session context to identify and fix the most important gap in its tests.", "body_md": "I don’t know how to play an instrument, so obviously I built one as an app. Literally, everyone in my family can sign or play an instrument, and I’m the odd one out.\n\nAnd I know what you’re thinking, “Who cares? With AI, you can build almost anything.” I’m more excited about the technique I chose to build the app with my agent. Specifically I used context from the agent session that built the app to find and fix the most important gap in its Playwright tests.\n\nHere’s how I did it.\n\nEntire captures the prompts, transcripts, tool calls, and decisions behind agent-generated code, seamlessly connecting that underlying context to your Git commits through lightweight checkpoints.\n\n**On macOS:**\n\n```\nbrew tap entireio/tap\nbrew install --cask entire\n```\n\nCheck out these [instructions](https://docs.entire.io/installation) to install on your operating system.\n\nI created an empty directory (or you can ask your agent to do this)\n\n```\nmkdir music-app\ncd music-app\n```\n\nBefore handing off any work to the agent, I initialized Entire directly within the repository because I wanted to capture my agent sessions:\n\n```\nentire enable -y\n```\n\nYou can also target a specific agent (I personally use Codex):\n\n```\nentire enable -y --agent codex\n```\n\nThis sets up the background hooks Entire relies on to capture agent activity, binding that session context directly to the commits generated along the way.\n\nRather than starting with a rigid technical spec, I simply shared my initial idea:\n\n```\nI'm not entirely sure about the app i want to build..but i want to build a music app that enables me to play instruments even though idk how..this should use computer vision and it should be able to work with real instruments or just like \"air\" instruments as in there's no instrument there..but i am moving fingers and sounds are being made..and it should like im making real music. idk if this should be sonic pi..but i know i should use media pipe for it. lets start working on a plan together\n```\n\nWorking together, the agent helped refine this into an “Air Jam” concept: a browser app where MediaPipe tracks hand gestures, a custom gesture engine interprets them, and Tone.js handles the audio output.\n\nWanting it to double as a learning tool, I followed up with:\n\n```\ncan it still show keys and chords etc..like still be a learning tool in some way\n```\n\nThat added a crucial new dimension. Beyond being a fun novelty, the app could now render notes, highlight active scales and chord tones, and eventually break down the music theory behind what was being played.\n\nTo lock this down, I asked the agent to document everything:\n\n```\nok lets put this plan into a markdown file\n```\n\nIt generated `PRODUCT_PLAN.md`\n\n, detailing the vision, architecture, development stages, MVP targets, and explicit success criteria.\n\nPhase 1 focused on laying the foundation:\n\nMost importantly, it defined a clear exit condition: *Deliberate movements reliably produce one corresponding sound with few false triggers.*\n\nI prefer keeping commits bite-sized, which is especially helpful when an agent is touching multiple parts of a codebase. To enforce this, I added a repo rule:\n\n```\nalso in an agents.md write a rule that says every time we make a change to a file, make a commit\n```\n\nSince I didn't want that configuration change committed just yet, I quickly clarified:\n\n```\nno dont make any commits..just add the note\n```\n\nFrom then on, the agent created neat, focused commits as features were built. And thanks to Entire, every single commit remained tied to the exact session context that created it.\n\nWith the roadmap in place, we dove straight into implementation:\n\n```\nlets start with phase 1..gesture to sound experiment\n```\n\nThe agent systematically assembled the foundation:\n\nAnd just like that, it worked. I could wave a finger across a virtual string and play a fully functional air harp.\n\nBefore expanding the app, I wanted a solid browser test suite to protect what we’d built. I kept my request broad:\n\n```\nwrite some playwright tests\n```\n\nThe agent generated five passing Playwright tests covering:\n\nOn paper, everything was green. But a passing test suite doesn't automatically mean you're testing what actually matters. Because I hadn't written the code or designed the test architecture myself, I wasn't entirely convinced these five tests actually protected the core user experience.\n\nBy this time, my original session had consumed roughly 87 percent of its context window.\n\nI generally avoid pushing agents when their context gets that crowded. It puts them right into what I call the \"dumb zone.\" While the agent technically retains the conversation history, its ability to prioritize key details begins to degrade.\n\nMy usual fix is to compact the history or spin up a fresh session. I opted for a fresh start here, not as a staged setup for this article, but as a natural next step after an extended session spent planning, building, debugging, and testing.\n\nWhile the new agent could easily read the code, I wanted it to evaluate the application using the rich context Entire had captured from our earlier planning, implementation, and testing sessions.\n\nI passed it this prompt:\n\n```\nlook at the existing Playwright tests and compare to my entire sessions and checkpoints. Do they actually test the main user experience from beginning to end, or do they only test separate pieces of it? Tell me what important behavior is still untested, and show me what you found in the sessions that led you to that conclusion.\n```\n\nThe agent pulled up the Playwright suite, cross-referencing it with our earlier Entire checkpoints. Codex summarized its findings:\n\nWe tested the camera. We tested the notes. But we never tested that moving your hand actually plays a note.\n\nAnd there it was. It hadn't actually tested whether waving your hand played a note, which is the fundamental purpose of the app.\n\nDigging deeper into the suite revealed why:\n\nEntire provided the agent with concrete historical context to back up this realization:\n\nWith the gap exposed, I gave a final instruction:\n\n```\ngenerate tests for the missing gap\n```\n\nThe agent updated the MediaPipe mock to supply realistic 21-point hand coordinates, simulating an index fingertip sweeping across a virtual string.\n\nThe new test verified that:\n\nThat brought our suite from five tests to six. But more than just increasing the count, that sixth test mapped directly back to the success criteria we set during our very first planning session.\n\nIt’s easy to fake a bug or throw in a superficial assertion to craft a good story, but that wasn't the case here. This test is fundamentally better because it:\n\nTo be clear, it doesn't guarantee that a real-world MediaPipe model will capture every single hand type or that audio physically plays through a user's speakers. Those require dedicated smoke runs or hardware testing. But it *does* prove that when realistic hand coordinates hit the app, the entire gesture-to-note pipeline executes flawlessly.\n\nI don’t use Entire to save my chat transcript and scroll through later on. Instead, I gave it to my agent to use as the historical evidence it needs to make better engineering decisions.\n\nPlease note that I wrote some of this by hand but for much of it I asked my agent to look at my session context and turn it into a blog. Because I have other work to do, and I'm trying to catch up!!", "url": "https://wpnews.pro/news/how-to-improve-playwright-test-coverage-using-agent-context", "canonical_source": "https://dev.to/entire/how-to-improve-playwright-test-coverage-using-agent-context-14l9", "published_at": "2026-08-18 00:23:30+00:00", "updated_at": "2026-08-18 00:42:14.042542+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "computer-vision"], "entities": ["Entire", "Playwright", "MediaPipe", "Tone.js", "Codex"], "alternates": {"html": "https://wpnews.pro/news/how-to-improve-playwright-test-coverage-using-agent-context", "markdown": "https://wpnews.pro/news/how-to-improve-playwright-test-coverage-using-agent-context.md", "text": "https://wpnews.pro/news/how-to-improve-playwright-test-coverage-using-agent-context.txt", "jsonld": "https://wpnews.pro/news/how-to-improve-playwright-test-coverage-using-agent-context.jsonld"}}