You are here

public function SocialDrupalContext::prepareBigPipeNoJsCookie in Open Social 8.2

Prepares Big Pipe NOJS cookie if needed.

Add support for Bigpipe in Behat tests.

Original PR here: https://github.com/jhedstrom/drupalextension/pull/325

@BeforeScenario

File

tests/behat/features/bootstrap/SocialDrupalContext.php, line 27

Class

SocialDrupalContext
Provides pre-built step definitions for interacting with Open Social.

Code

public function prepareBigPipeNoJsCookie(BeforeScenarioScope $scope) {
  try {

    // Check if JavaScript can be executed by Driver.
    $this
      ->getSession()
      ->getDriver()
      ->executeScript('true');
  } catch (UnsupportedDriverActionException $e) {

    // Set NOJS cookie.
    if ($this
      ->getSession()) {
      $this
        ->getSession()
        ->setCookie(BigPipeStrategy::NOJS_COOKIE, TRUE);
    }
  } catch (\Exception $e) {

    // Mute exceptions.
  }
}