Skip to content

Commit cbe8670

Browse files
committed
MQE-761: Generation of _failed method with createData action will lead test execution to fatal error
- reference _after method in _failed block - remove unused extractor - change Test Generator to skip generated stubs for failed function
1 parent a1f0632 commit cbe8670

18 files changed

+183
-128
lines changed

dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ActionGroupWithDataOverrideTestCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/ActionGroupWithDataTest.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ActionGroupWithDataTestCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ActionGroupWithNoDefaultTestCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/ActionGroupWithPersistedData.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ActionGroupWithPersistedDataCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ActionGroupWithTopLevelPersistedDataCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ArgumentWithSameNameAsElementCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BasicFunctionalTestCest
4848
public function _failed(AcceptanceTester $I)
4949
{
5050
$I->saveScreenshot();
51-
$I->amOnPage("/afterUrl");
51+
$this->_after($I);
5252
}
5353

5454
/**
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_generated\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use \Codeception\Util\Locator;
9+
use Yandex\Allure\Adapter\Annotation\Features;
10+
use Yandex\Allure\Adapter\Annotation\Stories;
11+
use Yandex\Allure\Adapter\Annotation\Title;
12+
use Yandex\Allure\Adapter\Annotation\Description;
13+
use Yandex\Allure\Adapter\Annotation\Parameter;
14+
use Yandex\Allure\Adapter\Annotation\Severity;
15+
use Yandex\Allure\Adapter\Model\SeverityLevel;
16+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
17+
18+
/**
19+
*/
20+
class HookActionsTestCest
21+
{
22+
/**
23+
* @var DataPersistenceHandler $sampleCreateBefore;
24+
*/
25+
protected $sampleCreateBefore;
26+
27+
/**
28+
* @var DataPersistenceHandler $sampleCreateForAfter;
29+
*/
30+
protected $sampleCreateForAfter;
31+
32+
/**
33+
* @param AcceptanceTester $I
34+
* @throws \Exception
35+
*/
36+
public function _before(AcceptanceTester $I)
37+
{
38+
$I->amGoingTo("create entity that has the stepKey: sampleCreateBefore");
39+
$sampleCreatedEntity = DataObjectHandler::getInstance()->getObject("sampleCreatedEntity");
40+
$this->sampleCreateBefore = new DataPersistenceHandler($sampleCreatedEntity);
41+
$this->sampleCreateBefore->createEntity();
42+
$I->amGoingTo("delete entity that has the createDataKey: sampleCreateBefore");
43+
$this->sampleCreateBefore->deleteEntity();
44+
$I->amGoingTo("create entity that has the stepKey: sampleCreateForAfter");
45+
$sampleCreatedEntity = DataObjectHandler::getInstance()->getObject("sampleCreatedEntity");
46+
$this->sampleCreateForAfter = new DataPersistenceHandler($sampleCreatedEntity);
47+
$this->sampleCreateForAfter->createEntity();
48+
}
49+
50+
/**
51+
* @var DataPersistenceHandler $sampleCreateAfter;
52+
*/
53+
protected $sampleCreateAfter;
54+
55+
/**
56+
* @param AcceptanceTester $I
57+
* @throws \Exception
58+
*/
59+
public function _after(AcceptanceTester $I)
60+
{
61+
$I->amGoingTo("create entity that has the stepKey: sampleCreateAfter");
62+
$sampleCreatedEntity = DataObjectHandler::getInstance()->getObject("sampleCreatedEntity");
63+
$this->sampleCreateAfter = new DataPersistenceHandler($sampleCreatedEntity);
64+
$this->sampleCreateAfter->createEntity();
65+
$I->amGoingTo("delete entity that has the createDataKey: sampleCreateForAfter");
66+
$this->sampleCreateForAfter->deleteEntity();
67+
}
68+
69+
/**
70+
* @param AcceptanceTester $I
71+
* @throws \Exception
72+
*/
73+
public function _failed(AcceptanceTester $I)
74+
{
75+
$I->saveScreenshot();
76+
$this->_after($I);
77+
}
78+
79+
/**
80+
* @Parameter(name = "AcceptanceTester", value="$I")
81+
* @param AcceptanceTester $I
82+
* @return void
83+
* @throws \Exception
84+
*/
85+
public function HookActionsTest(AcceptanceTester $I)
86+
{
87+
}
88+
}

dev/tests/verification/Resources/MergedActionGroupTest.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class MergedActionGroupTestCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

dev/tests/verification/Resources/MultipleActionGroupsTest.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class MultipleActionGroupsTestCest
5959
public function _failed(AcceptanceTester $I)
6060
{
6161
$I->saveScreenshot();
62-
$I->fillField("#foo", "myData1");
63-
$I->fillField("#bar", "myData2");
62+
$this->_after($I);
6463
}
6564

6665
/**

0 commit comments

Comments
 (0)