Profiler and debugging
Inspect Symfony requests, responses, profiler data, logs, and browser artifacts without mixing framework and UI assertions.
An in-process test can inspect both the rendered browser state and the Symfony objects that produced it. Use each source for the fact it can prove.
Inspect the last request and response
public function testCheckoutReturnsSuccess(): void
{
$this->visit('/checkout?currency=EUR');
$request = $this->getLastRequest();
$response = $this->getLastResponse();
self::assertSame('EUR', $request?->query->get('currency'));
self::assertSame(200, $response?->getStatusCode());
}
These helpers track the last request routed through the Symfony kernel. Asset requests served directly and external requests do not become the last Symfony request.
Use this evidence for status codes, headers, request attributes, and controller output. Use locators and Playwright assertions for visibility, accessible names, interaction state, and JavaScript behavior.
Enable the profiler for one request
Profiling is opt-in. Enable it immediately before the navigation you need to inspect:
public function testDashboardProfileIsAvailable(): void
{
$this->client->enableProfiler();
$this->visit('/dashboard');
$profile = $this->client->getProfile();
self::assertNotNull($profile);
}
enableProfiler() applies to the next request. A later navigation needs another call. The profiler services must be installed and enabled in the Symfony test environment.
Add targeted request logging
Enable bundle logging when routing itself is unclear:
playwright:
debug_logging: true
The PLAYWRIGHT_VERBOSE=1 environment variable enables the same diagnostic path for a run. Keep verbose routing logs off in routine CI unless they are attached only after failure.
Keep browser evidence too
Symfony diagnostics do not replace screenshots, traces, console messages, or browser network evidence. A useful failure report answers both questions: what did the kernel return, and what did the user-visible page do with it?
See Debugging for browser-side tools and Capture for artifact policy.