Skip to content

MFTF 2.3.4 Merge develop to master #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Magento Functional Testing Framework Changelog
================================================

2.3.4
-----
### Fixes
* MagentoWebDriver overrides `parent::_after()` function and remaps to `runAfter()`, necessary to solve compatibility issues in Codeception `2.3.x`.

2.3.3
-----
### Fixes
Expand Down
2 changes: 1 addition & 1 deletion bin/mftf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ try {
try {
$application = new Symfony\Component\Console\Application();
$application->setName('Magento Functional Testing Framework CLI');
$application->setVersion('2.3.0');
$application->setVersion('2.3.4');
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
foreach ($commandList->getCommands() as $command) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/magento2-functional-testing-framework",
"description": "Magento2 Functional Testing Framework",
"type": "library",
"version": "2.3.3",
"version": "2.3.4",
"license": "AGPL-3.0",
"keywords": ["magento", "automation", "functional", "testing"],
"config": {
Expand Down
96 changes: 48 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 25 additions & 8 deletions dev/tests/verification/Resources/functionalSuiteHooks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ class functionalSuiteHooks extends \Codeception\GroupObject
$this->create = new DataPersistenceHandler($createThis, [], $createFields);
$this->create->createEntity();
$webDriver->see("John", msq("uniqueData") . "John");

// reset configuration and close session
$this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver')->_resetConfig();
$webDriver->webDriver->close();
$webDriver->webDriver = null;

} catch (\Exception $exception) {
$this->preconditionFailure = $exception->getMessage();
}
Expand All @@ -74,16 +75,37 @@ class functionalSuiteHooks extends \Codeception\GroupObject

public function _after(\Codeception\Event\TestEvent $e)
{
$this->executePostConditions();
$this->executePostConditions($e);
}


private function executePostConditions()
private function executePostConditions(\Codeception\Event\TestEvent $e)
{
if ($this->currentTestRun == $this->testCount) {
print sprintf(self::$HOOK_EXECUTION_INIT, "after");

try {
// Find out if Test in Suite failed, will cause potential failures in suite after
$cest = $e->getTest();

//Access private TestResultObject to find stack and if there are any errors (as opposed to failures)
$testResultObject = call_user_func(\Closure::bind(
function () use ($cest) {
return $cest->getTestResultObject();
},
$cest
));
$errors = $testResultObject->errors();

if (!empty($errors)) {
foreach ($errors as $error) {
if ($error->failedTest()->getTestMethod() == $cest->getName()) {
// Do not attempt to run _after if failure was in the _after block
// Try to run _after but catch exceptions to prevent them from overwriting original failure.
print("LAST TEST IN SUITE FAILED, TEST AFTER MAY NOT BE SUCCESSFUL\n");
}
}
}
$webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');

// close any open sessions
Expand All @@ -97,11 +119,6 @@ class functionalSuiteHooks extends \Codeception\GroupObject
$webDriver->amOnPage("some.url");
$webDriver->deleteEntityByUrl("deleteThis");
$webDriver->see("John", msq("uniqueData") . "John");

// reset configuration and close session
$this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver')->_resetConfig();
$webDriver->webDriver->close();
$webDriver->webDriver = null;
} catch (\Exception $exception) {
print $exception->getMessage();
}
Expand Down
Loading