Assert how core's caching layers answered the last navigation, via the X-Drupal-Cache (Internal Page Cache — anonymous, whole-response) and X-Drupal-Dynamic-Cache (Dynamic Page Cache — authenticated, per-block) headers. A "HIT" is a cached response; anything else — "MISS", "UNCACHEABLE" or a missing header — is not.
Reads the headers recorded for the original navigation rather than re-requesting the URL, because a second request would report its own cache state and turn every MISS into a HIT.
Examples
Then the page should be served from the page cache
And the response should be served from the page cache
Then the page should not be served from the page cache
And the page should be served from the dynamic page cache
Then the page should not be served from the dynamic page cache
Pattern
Then(/^(?:the )?(?:page|response) should( not)* be served from the (dynamic page|internal page|page) cache$/, …)
Part of @webship-js/drupal-core-steps (github.com/webship/drupal-core-steps), a step pack for Webship-js 2.0.x.