Skip to content

Commit a75cc90

Browse files
committed
MQE-1181: Fatal error while test running
- reintroduced functional.suite.dist.yml restart: true - MagentoWebDriver overwrites parent _after function and remaps it (to be called in TestContextExtension
1 parent 462088e commit a75cc90

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Magento Functional Testing Framework Changelog
44
2.3.4
55
-----
66
### Fixes
7-
* Config option `restart: true` removed from `etc/config/functional.suite.dist.yml`.
7+
* MagentoWebDriver overrides `parent::_after()` function and remaps to `runAfter()`, necessary to solve compatibility issues in Codeception `2.3.x`.
88

99
2.3.3
1010
-----

etc/config/functional.suite.dist.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ modules:
2828
url: "%MAGENTO_BASE_URL%"
2929
backend_name: "%MAGENTO_BACKEND_NAME%"
3030
browser: 'chrome'
31+
restart: true
3132
window_size: 1280x1024
3233
username: "%MAGENTO_ADMIN_USERNAME%"
3334
password: "%MAGENTO_ADMIN_PASSWORD%"

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use \Codeception\Events;
1010
use Magento\FunctionalTestingFramework\Extension\ErrorLogger;
11+
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver;
1112

1213
/**
1314
* Class TestContextExtension
@@ -89,6 +90,8 @@ function () use ($cest, $I) {
8990
null,
9091
$cest
9192
));
93+
// Reset Session and Cookies, workaround due to functional.suite.yml restart: true
94+
$this->getModule(MagentoWebDriver::class)->_runAfter($e->getTest());
9295
} catch (\Exception $e) {
9396
// Do not rethrow Exception
9497
}

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

+19
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,25 @@ public function _resetConfig()
125125
$this->config = ConfigSanitizerUtil::sanitizeWebDriverConfig($this->config);
126126
}
127127

128+
/**
129+
* Remap parent::_after, called in TestContextExtension
130+
* @param TestInterface $test
131+
* @return void
132+
*/
133+
public function _runAfter(TestInterface $test)
134+
{
135+
parent::_after($test); // TODO: Change the autogenerated stub
136+
}
137+
138+
/**
139+
* Override parent::_after to do nothing.
140+
* @return void
141+
*/
142+
public function _after()
143+
{
144+
// DO NOT RESET SESSIONS
145+
}
146+
128147
/**
129148
* Returns URL of a host.
130149
*

0 commit comments

Comments
 (0)