Playwright UI Mode
Tired of debugging E2E tests in a headless terminal? Playwright UI mode offers visual time-travel debugging to identify root causes and fix flaky tests in seconds.

Software teams are shipping updates faster than ever right now, and ensuring nothing breaks is a daily struggle. When an end-to-end test fails in a Continuous Integration (CI) pipeline, figuring out exactly what went wrong in a sea of headless text logs can waste hours of precious engineering time.
If you are tired of staring at cryptic TimeoutError messages and wondering why a button was not clicked, you need a better approach.
This is where Playwright's interactive visual runner comes in. This comprehensive guide will show you exactly how Playwright UI mode provides a powerful visual time-travel window to walk through your test execution step by step. You will learn how to leverage its live DOM snapshots, network intercepts, and action timelines to fix flaky tests in seconds, making your debugging workflow incredibly fast and efficient.
What is Playwright UI mode?
Playwright UI mode is an interactive desktop interface (introduced in v1.32) that lets developers visually explore, run, and debug automation scripts. It replaces standard terminal output with a time-travel workspace containing a live DOM viewer, timeline scrubber, and network intercept logs.
When engineers ask what is Playwright UI mode, they are usually looking for a better way to visualize test execution without relying on console logs. Think of it as a complete command center for your entire test automation workflow. It allows you to observe every single action your test takes inside a real browser window, capturing the exact state of the DOM at every millisecond.
Instead of reading a long stack trace to figure out why an element was hidden, you get to see exactly what the user would see. You can inspect the Document Object Model at the exact moment a failure occurs, dramatically reducing the time spent guessing why a specific element was not found.
Many teams struggle with flaky tests because they cannot see the network state during a run. This interactive runner captures all network requests and console logs automatically. You do not need to write extra code or complex configurations to enable these features, it hooks directly into the Chrome DevTools Protocol (CDP) to gather massive amounts of debugging data with almost zero performance penalty.
Why engineers need Playwright UI mode
Relying solely on terminal outputs for E2E testing is a massive bottleneck. You need a faster way to understand why a dynamic React component didn't render or why a GraphQL mutation timed out. This visual approach removes the friction from the troubleshooting process entirely.
One major benefit is the ability to isolate specific test files instantly. You can filter your test tree and only execute the exact describe block you are actively working on. This targeted approach saves computing resources and tightens your feedback loop.
Tip: Use the built-in search bar in the test explorer to filter by @tags. If you tag tests with @auth or @checkout, typing @auth instantly scopes the UI runner down to just those critical paths.
Another huge advantage is the live Watch Mode. When you edit your TypeScript or JavaScript test files, the runner instantly detects the change and triggers a rerun automatically. You can check your browser compatibility on the fly without restarting the Node process.
Context switching is a known productivity killer. By keeping the code execution, the browser rendering, and the network logs in one unified dashboard, cognitive load is heavily reduced. Furthermore, it simplifies the onboarding process for junior developers. Visual tools are universally easier to grasp than dense command line outputs, making UI mode an invaluable teaching tool for teams scaling their software quality initiatives.
How to launch Playwright UI mode
Learning how to use Playwright UI mode is incredibly straightforward. Ensure you are running Playwright v1.32 or higher, and append the --ui flag to your standard testing command in the terminal. No complex playwright config changes or external dependencies are required.
# Launch the interactive UI mode for the entire test suite
npx playwright test --ui
Running the command above will immediately spin up the interactive desktop application. By default, no tests will execute until you explicitly click the play button. This prevents massive suites from overwhelming your local machine on startup.
If you have a large repository, passing a specific file name saves startup time and focuses the interface solely on the module you care about.
# Target a specific test file
npx playwright test tests/authentication.spec.ts --ui
For surgical precision, you can target a specific line number. This is a lifesaver when dealing with massive 500-line test files.
# Target a specific line number within a file
npx playwright test tests/checkout.spec.ts:42 --ui
UI mode automatically respects your custom playwright config, inheriting your base URL, viewport sizes, and authentication setup scripts. This makes transitioning from CI runs to local debugging completely seamless.
Exploring the visual interface panels

The interface is divided into several intelligent panels that work together to provide deep context:
- Test Explorer (Left Panel): Lists your entire test directory. You can expand folders, filter by text, and trigger individual tests or entire suites with a single click.
- Timeline Scrubber (Top Bar): Shows every action taken by the script. Hovering over this timeline reveals a snapshot of the browser at that exact millisecond. This is where the magic of ai codegen and smart debugging truly shines.
- DOM Snapshot (Center Area): Displays the fully rendered web page. You can pop this view out into a separate window for multi-monitor setups.
- Action Details (Bottom Panel): Contains dedicated tabs for Console, Network, Source, and Attachments. Each tab updates dynamically as you scrub back and forth through the execution timeline.
Note: The DOM snapshot isn't just a static image, it is a reconstructed DOM. You can actually open Chrome DevTools inside the UI mode window to inspect CSS classes and layout shifts long after the test has finished.
The Attachments tab is particularly useful for viewing visual diffs. If your test captures screenshots for a visual regression suite, they will appear here neatly organized, preventing your local directory from getting cluttered.
Playwright UI mode vs trace viewer
Many engineers get confused when comparing Playwright UI mode vs trace viewer. While they share an identical visual interface, they serve completely different purposes in the development lifecycle.
Trace Viewer is a static, post-mortem report generated after a test completes (usually in a CI pipeline). When a test fails on GitHub Actions, you download the trace.zip file, open it in the trace viewer, and analyze the historical data statically.
Playwright UI Mode is a live, dynamic environment for active local development. You can edit code, click play, and watch the test execute in real time on your machine. You cannot run new tests or watch for file changes from within a static trace report.

If you want to write or debug tests locally, UI mode is the absolute winner. If you need to figure out why a test failed remotely, you use the trace viewer. Both are essential for maintaining a high test suite health.
Because they share the same underlying rendering engine, learning how to navigate one tool automatically teaches you how to navigate the other. This significantly lowers the learning curve and simplifies e2e testing for the whole team.
How to debug tests like a pro

To effectively debug your application, you must master the timeline scrubber. When a test fails, the runner automatically highlights the exact step that caused the fatal error. Follow this proven workflow to resolve any failing test quickly:
- Locate the Error: Find the red failing step in the action list on the left side panel.
- Inspect the DOM: Click the step to reveal the exact DOM state at the time of the failure. Use the locator playground (the pick locator button) to test new selectors directly on the live screen.
- Check the Network: Open the Network tab to check for failed 500 API responses or pending requests that caused a timeout.
- Verify the Source: Open the Source tab to see which exact line of code threw the error message.
Here is a realistic example of using the page.pause() method to halt execution right before a tricky assertion. This acts like a traditional debugger breakpoint:
import { test, expect } from '@playwright/test';
test('should display error on invalid login', async ({ page }) => {
await page.goto('/login');
await page.getByRole('textbox', { name: 'Email' }).fill('[email protected]');
await page.getByRole('textbox', { name: 'Password' }).fill('badpass');
await page.getByRole('button', { name: 'Submit' }).click();
// The runner will pause here, allowing you to manually inspect
// the DOM and Network state before the assertion fires
await page.pause();
await expect(page.getByText('Invalid credentials')).toBeVisible();
});
This technique allows engineers to inspect complex state changes that happen too fast to see normally. You can then step through the remaining actions manually using the top toolbar controls.
Advanced network and console debugging

Modern Single Page Applications (SPAs) rely heavily on asynchronous data loading. When a test fails, the root cause is frequently a slow backend API call, not a broken UI component. The built-in network panel is designed specifically to expose these hidden communication errors.
As you scroll through the timeline, the Network panel filters requests to match that exact moment. You can click on any specific request to view its Headers, Payload, and Response Body. This eliminates the need to add messy console.log statements throughout your application code.
If your test is timing out, sort the network traffic by "Duration" or filter by Fetch/XHR to quickly find the specific API call that is hanging.
Similarly, if your React or Vue application throws a JavaScript exception, it will immediately appear in the Console tab. You can view warnings, errors, and standard log outputs just like in Chrome DevTools.
Optimizing your local test runs
Speed is critical when working with a large test suite locally. You do not want to wait several minutes just to verify a minor CSS selector change.
Utilizing the Watch feature correctly is the single best way to maintain developer momentum. Click the "eye" icon next to a specific test file to enable watch mode. Now, every time you press save in your code editor, only that specific file will rerun automatically.
If your test suite is growing too large, you might need to start sharding tests. While sharding is mostly used in CI environments, keeping your local runs lean is equally important. Always ensure you are only running the automated tests relevant to your current feature branch.
You can also integrate this efficient workflow with a custom github action. This ensures that the exact tests you perfected locally will behave the same way in production. Aligning your local and remote execution environments is the key to preventing unexpected pipeline failures.
Conclusion
Mastering Playwright UI mode will fundamentally change how you approach test automation. It removes the sheer frustration of headless terminal logs and replaces it with clear, visual, actionable feedback. By utilizing time-travel debugging, network inspection, and live watch features, you will solve complex issues in a fraction of the time.
Start running your suite with the --ui flag today. Your entire team will benefit from faster bug resolutions and much more reliable code deployments. You can calculate your potential time savings by checking out your ci budget metrics online today.
FAQs

Savan Vaghani
Product Developer



