You are here

public function SocialDrupalContext::prepareBigPipeNoJsCookie in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  2. 8.3 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  3. 8.4 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  4. 8.6 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  5. 8.7 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  6. 8.8 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  7. 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  8. 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  9. 10.1.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
  10. 10.2.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()

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 29

Class

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

Namespace

Drupal\social\Behat

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.
  }
}