public function SocialDrupalContext::prepareBigPipeNoJsCookie in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.3 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.4 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.5 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.6 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.7 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 8.8 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::prepareBigPipeNoJsCookie()
- 10.1.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 31
Class
- SocialDrupalContext
- Provides pre-built step definitions for interacting with Open Social.
Namespace
Drupal\social\BehatCode
public function prepareBigPipeNoJsCookie(BeforeScenarioScope $scope) {
// Start a session if not already done.
// Needed since https://github.com/minkphp/Mink/pull/705
// Otherwise executeScript or setCookie will throw an error.
if (!$this
->getSession()
->isStarted()) {
$this
->getSession()
->start();
}
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.
}
}