Kernel and browser lifecycle
Understand in-process routing, browser reuse, per-test context isolation, assets, and external requests.
PlaywrightTestCase boots the Symfony kernel, starts a real Playwright browser, and installs a route handler for configured hosts. A navigation such as visit('/account') becomes a browser request, then a Symfony Request, then a kernel Response, and finally a browser response.
No separate Symfony web server is needed for intercepted application routes.
What is shared
The browser process is reused across tests in the same test class. Reusing the process avoids paying the full launch cost for every method.
The browser context is restarted between tests. Cookies, storage, pages, and other context state therefore begin clean unless a test deliberately prepares them again.
The Symfony kernel runs in the test environment. The test can use static::getContainer() for application setup and can inspect the last intercepted request and response.
What is not shared automatically
The bundle does not provide automatic database transactions or fixture cleanup. Use the same reset strategy as the rest of the application's test suite, such as factories, fixtures, transaction tooling, or a recreated test database.
Application state can still leak if the database, filesystem, queues, or external services are not reset. Browser-context isolation only protects browser state.
Assets and external traffic
Configured public roots and prefixes let the bundle serve CSS, JavaScript, images, and fonts directly. The Assets reference covers AssetMapper, filesystem roots, cache policy, and routing diagnostics.
Only hosts in intercepted_hosts enter the Symfony kernel. A request to a payment sandbox, analytics endpoint, or third-party API uses the real browser network unless the test intercepts it with Playwright routing.
Choose in-process or black-box HTTP
Use in-process routing when you need container access, deterministic app setup, request inspection, or profiler data. Use the core package against a running server when the deployment boundary itself is under test or when the application should be treated as an external system.
Do not start a local web server for the same hostname while expecting the bundle to route that hostname into the kernel. Pick one boundary for the suite and make it explicit.