Created
July 13, 2018 14:44
-
-
Save mglaman/47b05ee405de4487d788fcef3e5c8389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: | |
autoload: | |
- '%paths.base%/tests/features/bootstrap' | |
suites: | |
default: | |
filters: | |
tags: "~@skip" | |
failure_path: '%paths.base%/tests/failures' | |
paths: | |
features: '%paths.base%/tests/features' | |
contexts: | |
- FailureContext | |
- FeatureContext | |
# Support BigPipe in Behat - https://github.com/jhedstrom/drupalextension/pull/325 | |
# Modified to not require Drupal driver. | |
- BigPipeContext | |
- Drupal\DrupalExtension\Context\DrupalContext | |
- Drupal\DrupalExtension\Context\MinkContext | |
- Drupal\DrupalExtension\Context\MessageContext | |
- Drupal\DrupalExtension\Context\DrushContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\DrupalExtension\Context\RawDrupalContext; | |
use Behat\Mink\Exception\UnsupportedDriverActionException; | |
/** | |
* Big Pipe context. | |
*/ | |
class BigPipeContext extends RawDrupalContext { | |
/** | |
* Prepares Big Pipe NOJS cookie if needed. | |
* | |
* TODO: breaking change, this executes before wdSession connected. | |
* // @BeforeScenario | |
*/ | |
public function prepareBigPipeNoJsCookie() { | |
try { | |
// Check if JavaScript can be executed by Driver. | |
$this->getSession()->getDriver()->executeScript('true'); | |
} catch (UnsupportedDriverActionException $e) { | |
// Set NOJS cookie. | |
$this->getSession()->setCookie('big_pipe_nojs', TRUE); | |
} catch (\Exception $e) { | |
// Mute exceptions. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment