|
5 | 5 | */
|
6 | 6 | namespace Magento\FunctionalTestingFramework\Allure\Adapter;
|
7 | 7 |
|
| 8 | +use Codeception\Codecept; |
| 9 | +use Codeception\Test\Cest; |
8 | 10 | use Codeception\Step\Comment;
|
9 | 11 | use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
|
10 | 12 | use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
|
|
19 | 21 | use Yandex\Allure\Adapter\Event\TestCaseFailedEvent;
|
20 | 22 | use Yandex\Allure\Adapter\Event\TestCaseFinishedEvent;
|
21 | 23 | use Yandex\Allure\Adapter\Event\TestCaseBrokenEvent;
|
| 24 | +use Yandex\Allure\Adapter\Event\AddAttachmentEvent; |
22 | 25 | use Codeception\Event\FailEvent;
|
23 | 26 | use Codeception\Event\SuiteEvent;
|
24 | 27 | use Codeception\Event\StepEvent;
|
| 28 | +use Codeception\Event\TestEvent; |
25 | 29 |
|
26 | 30 | /**
|
27 | 31 | * Class MagentoAllureAdapter
|
@@ -246,9 +250,11 @@ public function testError(FailEvent $failEvent)
|
246 | 250 | /**
|
247 | 251 | * Override of parent method, polls stepStorage for testcase and formats it according to actionGroup nesting.
|
248 | 252 | *
|
249 |
| - * @return void |
| 253 | + * @param TestEvent $testEvent |
| 254 | + * |
| 255 | + * @throws \Yandex\Allure\Adapter\AllureException |
250 | 256 | */
|
251 |
| - public function testEnd() |
| 257 | + public function testEnd(TestEvent $testEvent) |
252 | 258 | {
|
253 | 259 | // Pops top of stepStorage, need to add it back in after processing
|
254 | 260 | $rootStep = $this->getLifecycle()->getStepStorage()->pollLast();
|
@@ -309,6 +315,14 @@ function () use ($rootStep, $formattedSteps) {
|
309 | 315 |
|
310 | 316 | $this->getLifecycle()->getStepStorage()->put($rootStep);
|
311 | 317 |
|
| 318 | + // attachments supported since Codeception 3.0 |
| 319 | + if (version_compare(Codecept::VERSION, '3.0.0') > -1 && $testEvent->getTest() instanceof Cest) { |
| 320 | + $artifacts = $testEvent->getTest()->getMetadata()->getReports(); |
| 321 | + foreach ($artifacts as $name => $artifact) { |
| 322 | + Allure::lifecycle()->fire(new AddAttachmentEvent($artifact, $name, null)); |
| 323 | + } |
| 324 | + } |
| 325 | + |
312 | 326 | $this->getLifecycle()->fire(new TestCaseFinishedEvent());
|
313 | 327 | }
|
314 | 328 |
|
|
0 commit comments