This has a little history behind it.
Mink is the library that build on top of phpunit for functional testing:
One of the most important parts in the web is a browser. A browser is the window through which web users interact with web applications and other users. Users are always talking with web applications through browsers.
So, in order to test that our web application behaves correctly, we need a way to simulate this interaction between the browser and the web application in our tests. We need Mink.
Mike supports several ways to simulate a browser, through drivers.
Normal functional tests use BrowserTestBase
, which uses the Goutte driver.
Javascript tests used to use the PhantomJS driver, but that is an abandoned project now. This has been migrated to WebDriverTestBase
, which uses the Selenium2 driver.
Selenium2 essentially does a remote control of a headless browser, through the WebDriver protocol. This allows you to run the same driver against multiple browsers (Chrome, Firefox, and I think Safari).
The problem is that Selenium2 gives you the advantage of a real browser, but has limitations. It is slow. The other is that there isn't full parity between the other drivers, and getting the response code is one of these limitations.
So, this is a Mink/Selenium2 problem and not a genral Drupal testing framework problem.