Pest 4 + Playwright: Combiner assets returning 404 during browser tests

Hi,

I’m having an issue with browser tests using Pest 4 and Playwright.

All assets generated by the Combiner are unavailable (CSS and JS), which causes the tests to fail.

When running the test in debug mode, I can see that the asset URL is generated correctly in the page source, for example:

http://127.0.0.1:44527/combine/797f24cc7e39f90d447ea38c483205ae-1782468093

However, in the browser console the asset returns a 404 error, and opening the URL in a new tab displays the following message:

/* We’re sorry, but something went wrong and the page cannot be displayed. */

What is the problem here?

Hi @Wojciech !

This isn’t a combiner bug; it’s the cache driver in your test environment.

Combiner URLs are backed by the Laravel cache: rendering the page stores the file combination under the hash, and /combine/{hash} looks it up on the next request. Browser tests set CACHE_DRIVER=array (in phpunit.xml / .env.testing by default), which is in-memory and per-process, and Pest 4 serves the app to Playwright in a separate HTTP process, so the cache entry is gone by the time the browser requests the asset, hence the 404.

Fix: use a persistent cache driver for browser tests, e.g. in phpunit.xml:

<env name="CACHE_DRIVER" value="file" />

Also, check the same for the rest of your test env: SESSION_DRIVER=array and DB_DATABASE=:memory: have the same cross-process problem in browser tests (use file/cookie sessions and a file-based SQLite database).

This is a general constraint of Pest 4 browser testing rather than anything October-specific.