/**
  *
  * @BeforeScenario
  *
  * @param BeforeScenarioScope $scope
  */
 public function beforeScenario(BeforeScenarioScope $scope)
 {
     $this->scenarioData = ['file' => $scope->getFeature()->getFile(), 'line' => $scope->getScenario()->getLine(), 'title' => $scope->getScenario()->getTitle(), 'tags' => $scope->getScenario()->getTags()];
     $this->_w3c = $scope->getEnvironment()->getContext(W3CValidationContext::class);
     $this->_screenshot = $scope->getEnvironment()->getContext(ScreenshotContext::class);
     $this->setLogPath();
 }
示例#2
0
 /**
  * @BeforeScenario
  */
 public function before(BeforeScenarioScope $scope)
 {
     if (!self::$isPrepared) {
         $this->prepare();
         self::$isPrepared = true;
     }
     // Scenario skips a line so it's not a new example
     if ($scope->getScenario()->getLine() !== self::$lastScenarioLine + 1) {
         $this->reset();
     }
     self::$lastScenarioLine = $scope->getScenario()->getLine();
     return;
 }
示例#3
0
 /**
  * @BeforeScenario
  */
 public function registerScenario(BeforeScenarioScope $scope)
 {
     // Scenario not usually available to steps, so we do ourselves.
     // See issue
     $this->scenario = $scope->getScenario();
     //print  $this->scenario->getTitle();
 }
 /**
  * @BeforeScenario
  *
  * Enable the testing app before the first scenario of the feature and
  * reset the configs before each scenario
  * @param BeforeScenarioScope $event
  */
 public function prepareParameters(BeforeScenarioScope $event)
 {
     $user = $this->currentUser;
     $this->currentUser = '******';
     $scenarios = $event->getFeature()->getScenarios();
     if ($event->getScenario() === reset($scenarios)) {
         $this->setStatusTestingApp(true);
     }
     $this->resetAppConfigs();
     $this->currentUser = $user;
 }
 /**
  * @param BeforeScenarioScope $scope
  *
  * @BeforeScenario
  */
 public function beforeScenario(BeforeScenarioScope $scope)
 {
     $this->tags += array_merge($scope->getFeature()->getTags(), $scope->getScenario()->getTags());
     // Any page should be visited due to using jQuery and checking the cookies.
     $this->getSession()->visit($this->locatePath('/'));
 }
示例#6
0
 private function getCoverageKeyFromScope(BeforeScenarioScope $scope)
 {
     $name = $scope->getFeature()->getTitle() . '::' . $scope->getScenario()->getTitle();
     return $name;
 }
 /**
  * @BeforeScenario
  */
 public function registerScenario(BeforeScenarioScope $scope)
 {
     // Scenario not usually available to steps, so we do ourselves.
     $this->scenario = $scope->getScenario();
     $this->environment = $scope->getEnvironment();
 }
 /**
  * @BeforeScenario
  * @param BeforeScenarioScope $event
  */
 public function start(BeforeScenarioScope $event)
 {
     self::$coverage->start($event->getScenario()->getTitle());
 }
示例#9
0
 /**
  * @param Scope\BeforeScenarioScope $scope
  *
  * @BeforeScenario
  */
 public function beforeScenario(Scope\BeforeScenarioScope $scope)
 {
     foreach (array_merge($scope->getFeature()->getTags(), $scope->getScenario()->getTags()) as $tag) {
         $values = explode(':', $tag);
         $value = '';
         if (count($values) > 1) {
             list($tag, $value) = $values;
         }
         self::$tags[strtolower($tag)] = $value;
     }
     // Any page should be visited due to using jQuery and checking the cookies.
     $this->visitPath('/');
     // By "Goutte" session we need to visit any page to be able to set a cookie
     // for this session and use it for checking request status codes.
     $this->visitPath('/', 'goutte');
 }
示例#10
0
 /**
  * @BeforeScenario
  */
 public function startCoverage(BeforeScenarioScope $scope)
 {
     self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}");
 }
示例#11
0
 /**
  * @param Scope\BeforeScenarioScope $scope
  *   Scope of the processing scenario.
  *
  * @BeforeScenario
  */
 public function beforeScenario(Scope\BeforeScenarioScope $scope)
 {
     self::collectTags($scope->getScenario()->getTags());
     // No need to keep working element between scenarios.
     $this->unsetWorkingElement();
     // Any page should be visited due to using jQuery and checking the cookies.
     $this->visitPath('/');
     // By "Goutte" session we need to visit any page to be able to set a cookie
     // for this session and use it for checking request status codes.
     $this->visitPath('/', 'goutte');
 }
 /**
  * @BeforeScenario
  *
  * Allow access to the MinkContext.
  */
 public function gatherContexts(BeforeScenarioScope $scope)
 {
     $environment = $scope->getEnvironment();
     $this->minkContext = $environment->getContext('Drupal\\DrupalExtension\\Context\\MinkContext');
     $this->currentScenario = $scope->getScenario();
     $this->scenarioName = $this->currentScenario->getTitle();
 }
 /**
  * set scenario line number to make screenshots for background steps
  *
  * @BeforeScenario
  *
  * @param BeforeScenarioScope $scope [description]
  *
  * @return null
  */
 public function setCurrentScenarioLine(BeforeScenarioScope $scope)
 {
     $this->currentScenarioLineNumber = $scope->getScenario()->getLine();
 }
示例#14
0
 private function getCoverageKeyFromScope(BeforeScenarioScope $scope) : string
 {
     return sprintf('%s::%s', $scope->getFeature()->getTitle(), $scope->getScenario()->getTitle());
 }