magento / magento2-functional-testing-framework

Magento2 Functional Testing Framework
Other
155 stars 132 forks source link

Serialization of 'Closure' is not allowed #902

Open snez opened 1 year ago

snez commented 1 year ago

We have started noticing failures in our test suite about a week ago, with no changes on our side. After investigation, we found the problem to have been caused by the release of v4.3.0 of the Magento functional testing framework. After downgrading to v4.2.1, the problem was resolved. Reporting the details here for reference.

Preconditions

  1. Magento 2.4.6
  2. PHP 8.2
  3. v4.3.0 of the framework

Steps to reproduce

  1. Implement an MFTF test which fails intentionally. Successful tests do not have this problem
  2. Add the test in a test suite, with at least one more test after it

Expected result

  1. The test should fail with a recorded screenshot
  2. The next test should start

Actual result

  1. The test fails, and the entire test suite stops in its track, preventing allure reports from being generated. Example below:

  [waitForFullScreenIframe] wait for element "//iframe[@name='acsFrame']",30
  [saveScreenshot] save screenshot
  [] [START AFTER HOOK]
[] [logoutStorefront] StorefrontCustomerLogoutActionGroup
  [storefrontSignOut] am on page "customer/account/logout/"
  [waitForSignOut] wait for page load 60
[END AFTER HOOK]
 ERROR

--------------------------------------------------------------------------------

In AllureHelper.php line 26:

  [Exception]
  Serialization of 'Closure' is not allowed

Exception trace:
  at vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php:26
 serialize() at vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php:26
 Magento\FunctionalTestingFramework\Allure\AllureHelper::addAttachmentToCurrentStep() at vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php:268
 Magento\FunctionalTestingFramework\Extension\TestContextExtension->attachExceptionToAllure() at vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php:139
 Magento\FunctionalTestingFramework\Extension\TestContextExtension->testEnd() at vendor/symfony/event-dispatcher/EventDispatcher.php:206
 Symfony\Component\EventDispatcher\EventDispatcher->callListeners() at vendor/symfony/event-dispatcher/EventDispatcher.php:56
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at vendor/codeception/codeception/src/Codeception/Test/Test.php:243
 Codeception\Test\Test->realRun() at vendor/codeception/codeception/src/Codeception/Suite.php:130
 Codeception\Suite->run() at vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
 Codeception\SuiteManager->run() at vendor/codeception/codeception/src/Codeception/Codecept.php:260
 Codeception\Codecept->runSuite() at vendor/codeception/codeception/src/Codeception/Codecept.php:216
 Codeception\Codecept->run() at vendor/codeception/codeception/src/Codeception/Command/Run.php:646
 Codeception\Command\Run->runSuites() at vendor/codeception/codeception/src/Codeception/Command/Run.php:467
 Codeception\Command\Run->execute() at vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at vendor/codeception/codeception/src/Codeception/Application.php:112
 Codeception\Application->run() at vendor/codeception/codeception/app.php:45
 {closure}() at vendor/codeception/codeception/app.php:46
 require() at vendor/codeception/codeception/codecept:7
 include() at vendor/bin/codecept:120
m2-assistant[bot] commented 1 year ago

Hi @snez. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.