|
10 | 10 | use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
|
11 | 11 | use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
|
12 | 12 | use Magento\FunctionalTestingFramework\Util\TestGenerator;
|
| 13 | +use Yandex\Allure\Adapter\Model\Failure; |
13 | 14 | use Yandex\Allure\Adapter\Model\Provider;
|
14 | 15 | use Yandex\Allure\Adapter\Model\Status;
|
15 | 16 | use Yandex\Allure\Adapter\Model\Step;
|
@@ -260,13 +261,7 @@ public function testEnd()
|
260 | 261 |
|
261 | 262 | $actionGroupStepKey = null;
|
262 | 263 | foreach ($rootStep->getSteps() as $step) {
|
263 |
| - //Remove Attachments if verbose flag is not true AND test did not fail |
264 |
| - if (getenv('VERBOSE_ARTIFACTS') !== true && $testFailed === null) { |
265 |
| - foreach ($step->getAttachments() as $index => $attachment) { |
266 |
| - $step->removeAttachment($index); |
267 |
| - unlink(Provider::getOutputDirectory() . DIRECTORY_SEPARATOR . $attachment->getSource()); |
268 |
| - } |
269 |
| - } |
| 264 | + $this->removeAttachments($step, $testFailed); |
270 | 265 | $stepKey = str_replace($actionGroupStepKey, '', $step->getName());
|
271 | 266 | if ($stepKey !== '[]' && $stepKey !== null) {
|
272 | 267 | $step->setName($stepKey);
|
@@ -364,4 +359,21 @@ private function retrieveStepKey($stepLine)
|
364 | 359 |
|
365 | 360 | return $stepKey;
|
366 | 361 | }
|
| 362 | + |
| 363 | + /** |
| 364 | + * Removes attachments from step depending on MFTF configuration |
| 365 | + * @param Step $step |
| 366 | + * @param Failure $testFailed |
| 367 | + * @return void |
| 368 | + */ |
| 369 | + private function removeAttachments($step, $testFailed) |
| 370 | + { |
| 371 | + //Remove Attachments if verbose flag is not true AND test did not fail |
| 372 | + if (getenv('VERBOSE_ARTIFACTS') !== true && $testFailed === null) { |
| 373 | + foreach ($step->getAttachments() as $index => $attachment) { |
| 374 | + $step->removeAttachment($index); |
| 375 | + unlink(Provider::getOutputDirectory() . DIRECTORY_SEPARATOR . $attachment->getSource()); |
| 376 | + } |
| 377 | + } |
| 378 | + } |
367 | 379 | }
|
0 commit comments