Skip to content

Commit

Permalink
Fix #4413 HTML Report wrong steps/substeps nesting
Browse files Browse the repository at this point in the history
Previously using/calling the same meta step more than once (e.g. calling the same PageObject method twice),
led to rendering all the steps from the meta step nested below the first meta step execution/node again and again,
instead of several meta step executions/nodes (with each having just all steps from the meta step once).
  • Loading branch information
Reinhold Füreder authored and Naktibalda committed Nov 23, 2019
1 parent 8e203e9 commit d3b6116
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ResultPrinter/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ public function endTest(\PHPUnit\Framework\Test $test, $time)
}

$stepsBuffer = '';
$subStepsBuffer = '';
$subStepsRendered = [];

foreach ($steps as $step) {
if ($step->getMetaStep()) {
$subStepsRendered[$step->getMetaStep()->getAction()][] = $this->renderStep($step);
$key = $step->getMetaStep()->getLine() . $step->getMetaStep()->getAction();
$subStepsRendered[$key][] = $this->renderStep($step);
}
}

foreach ($steps as $step) {
if ($step->getMetaStep()) {
if (! empty($subStepsRendered[$step->getMetaStep()->getAction()])) {
$subStepsBuffer = implode('', $subStepsRendered[$step->getMetaStep()->getAction()]);
unset($subStepsRendered[$step->getMetaStep()->getAction()]);

$key = $step->getMetaStep()->getLine() . $step->getMetaStep()->getAction();
if (! empty($subStepsRendered[$key])) {
$subStepsBuffer = implode('', $subStepsRendered[$key]);
unset($subStepsRendered[$key]);
$stepsBuffer .= $this->renderSubsteps($step->getMetaStep(), $subStepsBuffer);
}
} else {
Expand Down

0 comments on commit d3b6116

Please sign in to comment.