Skip to content

Commit 62deaf9

Browse files
committed
Fix ActionGroups
1 parent 11f3278 commit 62deaf9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public function stepName(\Codeception\Event\StepEvent $e)
323323
$stepKey = null;
324324

325325
if (!($e->getStep() instanceof Comment)) {
326-
$stepKey = $this->retrieveStepKeyForAllure($e->getStep());
326+
$stepKey = $this->retrieveStepKeyForAllure($e->getStep(), $e->getTest()->getMetadata()->getFilename());
327327
$isActionGroup = (
328328
strpos(
329329
$e->getStep()->__toString(),
@@ -457,15 +457,20 @@ protected function localizePath($path)
457457
* Reading stepKey from file.
458458
*
459459
* @param Step $step
460+
* @param String $filePath
460461
* @return string|null
461462
*/
462-
private function retrieveStepKeyForAllure(Step $step)
463+
private function retrieveStepKeyForAllure(Step $step, string $filePath)
463464
{
464465
$stepKey = null;
465466
$stepLine = $step->getLineNumber();
466-
$filePath = $step->getFilePath();
467467
$stepLine = $stepLine - 1;
468468

469+
//If the step's filepath is different from the test, it's a comment action.
470+
if ($this->getRootDir() . $step->getFilePath() != $filePath) {
471+
return "";
472+
}
473+
469474
if (!array_key_exists($filePath, $this->testFiles)) {
470475
$this->testFiles[$filePath] = explode(PHP_EOL, file_get_contents($filePath));
471476
}

0 commit comments

Comments
 (0)