public function beforeStep(\Codeception\Event\StepEvent $e)
 {
     $step = $e->getStep();
     // access to the protected property using reflection
     $refArgs = new ReflectionProperty(get_class($step), 'arguments');
     // change property accessibility to public
     $refArgs->setAccessible(true);
     // retrieve 'arguments' value
     $args = $refArgs->getValue($step);
     foreach ($args as $index => $arg) {
         if (is_string($arg)) {
             // case if arg is a string
             // e.g. I see "{{param}}"
             $args[$index] = $this->getValueFromParam($arg);
         } elseif (is_a($arg, '\\Behat\\Gherkin\\Node\\TableNode')) {
             // case if arg is a table
             // e.g. I see :
             //  | paramater |
             //  | {{param}} |
             $table = array();
             foreach ($arg->getRows() as $i => $row) {
                 foreach ($row as $j => $cell) {
                     $table[$i][$j] = $this->getValueFromParam($cell);
                 }
             }
             $args[$index] = new TableNode($table);
         }
     }
     // set new arguments value
     $refArgs->setValue($step, $args);
 }
 public function afterStep(StepEvent $e)
 {
     list($usec, $sec) = explode(" ", microtime());
     $stepEndTime = (double) $sec;
     $stepTime = $stepEndTime - self::$tmpStepStartTime;
     // If the Step has taken more than 5 seconds
     if ($stepTime > self::$maxStepPerformantTime) {
         $step = new \stdClass();
         $currentStep = (string) $e->getStep();
         $step->name = $currentStep;
         $step->time = $stepTime;
         self::$notPerformantStepsByTest[self::$tmpCurrentTest][] = $step;
     }
 }
Exemplo n.º 3
0
 public function beforeStep(StepEvent $e)
 {
     if (!$this->steps or !$e->getTest() instanceof ScenarioDriven) {
         return;
     }
     $metaStep = $e->getStep()->getMetaStep();
     if ($metaStep and $this->metaStep != $metaStep) {
         $this->message(' ' . $metaStep->getPrefix())->style('bold')->append($metaStep->__toString())->writeln();
     }
     $this->metaStep = $metaStep;
     $this->printStep($e->getStep());
 }
Exemplo n.º 4
0
 public function beforeStep(StepEvent $e)
 {
     if (!$this->steps or !$e->getTest() instanceof ScenarioDriven) {
         return;
     }
     $metaStep = $e->getStep()->getMetaStep();
     if ($metaStep and $this->metaStep != $metaStep) {
         $this->output->writeln("* {$metaStep}");
     }
     $this->metaStep = $metaStep;
     $msg = $this->message($e->getStep()->__toString());
     $this->metaStep ? $msg->prepend('  ')->style('comment') : $msg->prepend('* ');
     $msg->writeln();
 }
Exemplo n.º 5
0
 public function beforeStep(StepEvent $e)
 {
     $this->logger->info($e->getStep()->getHumanizedAction());
 }
Exemplo n.º 6
0
 public function afterStep(StepEvent $e)
 {
     if (!$this->webDriverModule or !$this->dir) {
         return;
     }
     if ($e->getStep() instanceof CommentStep) {
         return;
     }
     $step = $e->getStep();
     if ($step->getAction() == "makeScreenshot") {
         $filename = str_pad($this->stepNum, 3, "0", STR_PAD_LEFT) . '.png';
         //echo "aa".$this->stepNum;
         //echo "bb".$filename;
         //echo "CC".$this->dir;
         //die();
         $this->webDriverModule->_saveScreenshot($this->dir . DIRECTORY_SEPARATOR . $filename);
         $this->stepNum++;
         $this->slides[$filename] = $e->getStep();
     }
 }
Exemplo n.º 7
0
 public function beforeStep(StepEvent $e)
 {
     if (!$this->steps or !$e->getTest() instanceof ScenarioDriven) {
         return;
     }
     $this->output->writeln("* " . $e->getStep());
 }
 public function stepFail(\Codeception\Event\StepEvent $e)
 {
     $name = get_class($e->getTest());
     teamcity_console_logger(MessageTemplate::TestFailed($name, 'Step Failed'));
 }
Exemplo n.º 9
0
 public function afterStep(StepEvent $e)
 {
     foreach (SuiteManager::$modules as $module) {
         $module->_afterStep($e->getStep(), $e->getTest());
     }
 }
 public function step(StepEvent $stepEvent)
 {
     $this->penultimateStep = $this->lastStep;
     $this->lastStep = $stepEvent->getStep()->getPhpCode();
 }
Exemplo n.º 11
0
 public function afterStep(StepEvent $e)
 {
     foreach ($this->modules as $module) {
         $module->_afterStep($e->getStep(), $e->getTest());
     }
 }
Exemplo n.º 12
0
 public function afterStep(StepEvent $e)
 {
     if (!$this->webDriverModule or !$this->dir) {
         return;
     }
     if ($e->getStep() instanceof CommentStep) {
         return;
     }
     $filename = str_pad($this->stepNum, 3, "0", STR_PAD_LEFT) . '.png';
     $this->webDriverModule->_saveScreenshot($this->dir . DIRECTORY_SEPARATOR . $filename);
     $this->stepNum++;
     $this->slides[$filename] = $e->getStep();
 }
Exemplo n.º 13
0
 public function beforeStep(StepEvent $e)
 {
     if (!$this->steps or !$e->getTest() instanceof ScenarioDriven) {
         return;
     }
     $metaStep = $e->getStep()->getMetaStep();
     if ($metaStep and $this->metaStep != $metaStep) {
         $this->message(' ' . $metaStep->getPrefix())->style('bold')->append($metaStep->__toString())->writeln();
     }
     $this->metaStep = $metaStep;
     $text = $e->getStep()->__toString();
     if ($e->getStep() instanceof Comment and !$text) {
         return;
         // don't print empty comments
     }
     $msg = $this->message(' ');
     $msg->append($e->getStep()->getPrefix());
     if (!$metaStep) {
         $msg->style('bold');
     }
     $msg->append($text);
     if ($metaStep) {
         $msg->style('info')->prepend('  ');
     }
     $msg->writeln();
 }
Exemplo n.º 14
0
 public function beforeStep(StepEvent $e)
 {
     $this->logger->info((string) $e->getStep());
 }
 public function stepBefore(StepEvent $stepEvent)
 {
     $stepName = $stepEvent->getStep()->getName();
     $this->getLifecycle()->fire(new StepStartedEvent($stepName));
 }
 /**
  * @param StepEvent $stepEvent
  */
 public function stepAfter(StepEvent $stepEvent)
 {
     if ($stepEvent->getStep()->hasFailed() && $stepEvent->getStep()->getAction('seeNoDifferenceToReferenceImage')) {
         /** @var WebDriver $stepWebDriver */
         $stepWebDriver = $stepEvent->getTest()->getScenario()->current('modules')['WebDriver'];
         $identifier = $stepEvent->getStep()->getArguments()[0];
         $windowSize = $this->fileSystemUtil->getCurrentWindowSizeString($stepWebDriver);
         $this->failedIdentifiers[] = array('identifier' => $identifier, 'windowSize' => $windowSize, 'failImage' => base64_encode(file_get_contents($this->fileSystemUtil->getFailImagePath($identifier, $windowSize, 'fail'))), 'diffImage' => base64_encode(file_get_contents($this->fileSystemUtil->getFailImagePath($identifier, $windowSize, 'diff'))), 'referenceImage' => base64_encode(file_get_contents($this->fileSystemUtil->getReferenceImagePath($identifier, $windowSize))));
     }
 }