Skip to main content

BigPipe

DrevOps\BehatSteps\Steps\Drupal\BigPipeTrait - Source, Example, Helpers

Wait for Drupal BigPipe placeholders to be replaced on JavaScript scenarios.

Drupal BigPipe streams parts of a page in after the initial response and replaces its <span data-big-pipe-placeholder-id="..."> markers with the real markup using JavaScript. An assertion that runs before those replacements complete fails intermittently with "element not found".

With this trait included, every @javascript scenario waits before each step until no BigPipe placeholder marker remains in the DOM. The wait removes the race without an explicit step.

The wait is best-effort: on timeout the step still runs, so a placeholder that is never replaced fails the following assertion rather than the wait.

A browser driver that runs no JavaScript never replaces those placeholders, and does not follow the http-equiv=refresh fallback either. An authenticated-user assertion on such a browser driver silently misses the content BigPipe deferred.

A scenario tagged @bigpipe on such a browser driver gets the big_pipe_nojs cookie, so Drupal renders the page in full server-side.

Skip processing with tag: @behat-steps-skip:BigPipeTrait.

Special tags:

  • @bigpipe - render server-side on a browser driver without JavaScript.

Set the big_pipe.wait_timeout option to change the maximum wait, or assign $bigPipeWaitTimeout to override it for 1 scenario.

Options​

OptionTypeDefaultTagDescription
big_pipe.enabledbooleanTRUE@behat-steps-skip:BigPipeTraitWait for BigPipe placeholders to be replaced before each step of a @javascript scenario.
big_pipe.wait_timeoutinteger10000-Maximum time, in milliseconds, to wait for BigPipe placeholders to be replaced.