Skip to content

Commit 766eb08

Browse files
committed
Merge branch 'MQE-795' into develop
2 parents 3dad0ea + 53ca172 commit 766eb08

39 files changed

+2497
-2196
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
Magento Functional Testing Framework Changelog
22
================================================
33

4+
2.0.3
5+
-----
6+
### Enhancements
7+
* Readability
8+
* Added the ability to refer to `custom_attribute` data in persisted entities via `key` instead of index.
9+
* ex. `url_key` in category entity: `$category.custom_attributes[3][value]$` and `$category.custom_attributes[url_key]$` are both valid.
10+
* Maintainability
11+
* Added check for duplicate `stepKey` attributes at test generation. This check is scoped to `<testAction>` tags within a single `<test>` tag in a single file.
12+
13+
### Fixes
14+
* Fixed inability to use `<actionGroup>` with `<arguments>` in test hooks.
15+
* Fixed inability to use `0` as data in an entity.
16+
* Fixed an issue where using `<annotation>` tag of `<useCaseId>` would cause test generation failures.
17+
* Fixed an issue where the `<closeAdminNotification>` action could not be used twice in in a `<test>`.
18+
* Fixed an issue where specifying duplicate test actions in test delta's would cause generation errors.
19+
* Fixed an issue where test failure screenshots were being taken at the end of the test hook, as opposed to at the point of failure.
20+
* Operation `metadata` with an `auth` of type `adminFormKey` will now automatically append specified `MAGENTO_BACKEND_NAME` if necessary.
21+
22+
2.0.2
23+
-----
24+
25+
### Enhancements
26+
* Customizability
27+
* Added the `<magentoCLI>` test action. Action takes the given `command=""` and passes it for execution in Magento Environment.
28+
* Note: Installation step to enable above action has been added. See `Step 5` in the MFTF `Getting Started` article.
29+
* Maintainability
30+
* Tests now run actions declared in `<after>` hook in both successful and failed test runs.
31+
32+
### Fixes
33+
* Fixed inability to use `[]` characters within selector/url parameters.
34+
* Fixed a bug where the `<formatMoney>` action did not return a variable for test use.
35+
* Fixed a bug where the `<waitForLoadingMaskToDisappear>` action could not be used twice in an `<actionGroup>`.
36+
437
2.0.1
538
-----
639

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "2.0.1",
5+
"version": "2.0.3",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/TestObjectHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function testGetTestObject()
5858
[]
5959
);
6060
$expectedFailedActionObject = new ActionObject(
61-
$testDataArrayBuilder->testActionAfterName,
62-
$testDataArrayBuilder->testActionType,
61+
'saveScreenshot',
62+
'saveScreenshot',
6363
[]
6464
);
6565

@@ -95,7 +95,7 @@ public function testGetTestObject()
9595
TestObjectExtractor::TEST_AFTER_HOOK => $expectedAfterHookObject,
9696
TestObjectExtractor::TEST_FAILED_HOOK => $expectedFailedHookObject
9797
],
98-
[]
98+
null
9999
);
100100

101101
$this->assertEquals($expectedTestObject, $actualTestObject);

dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ActionGroupWithDataOverrideTestCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/ActionGroupWithDataTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ActionGroupWithDataTestCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ActionGroupWithNoDefaultTestCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/ActionGroupWithPersistedData.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ActionGroupWithPersistedDataCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ActionGroupWithTopLevelPersistedDataCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ArgumentWithSameNameAsElementCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class BasicFunctionalTestCest
4747
*/
4848
public function _failed(AcceptanceTester $I)
4949
{
50-
$I->amOnPage("/afterUrl");
50+
$I->saveScreenshot();
51+
$this->_after($I);
5152
}
5253

5354
/**
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/MergeFunctionalTest.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class MergeFunctionalTestCest
4848
*/
4949
public function _failed(AcceptanceTester $I)
5050
{
51-
$I->amOnPage("/afterUrl1");
51+
$I->saveScreenshot();
52+
$this->_after($I);
5253
}
5354

5455
/**

dev/tests/verification/Resources/MergedActionGroupTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class MergedActionGroupTestCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**

dev/tests/verification/Resources/MultipleActionGroupsTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class MultipleActionGroupsTestCest
5858
*/
5959
public function _failed(AcceptanceTester $I)
6060
{
61-
$I->fillField("#foo", "myData1");
62-
$I->fillField("#bar", "myData2");
61+
$I->saveScreenshot();
62+
$this->_after($I);
6363
}
6464

6565
/**
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="HookActionsTest">
12+
<before>
13+
<createData entity="sampleCreatedEntity" stepKey="sampleCreateBefore"/>
14+
<deleteData createDataKey="sampleCreateBefore" stepKey="sampleDeleteBefore"/>
15+
<createData entity="sampleCreatedEntity" stepKey="sampleCreateForAfter"/>
16+
</before>
17+
<after>
18+
<createData entity="sampleCreatedEntity" stepKey="sampleCreateAfter"/>
19+
<deleteData createDataKey="sampleCreateForAfter" stepKey="sampleDeleteAfter"/>
20+
</after>
21+
</test>
22+
</tests>

dev/tests/verification/TestModule/Test/XmlDuplicateTest.xml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<amOnSubdomain stepKey="aosd2" url="1"/>
1919
<amOnUrl stepKey="aou1" url="1"/>
2020
<amOnUrl stepKey="aou2" url="1"/>
21-
<appendField selector="1" stepKey="ap1"/>
22-
<appendField selector="1" stepKey="ap2"/>
21+
<appendField selector="1" stepKey="app1"/>
22+
<appendField selector="1" stepKey="app2"/>
2323
<attachFile selector="1" stepKey="atf1"/>
2424
<attachFile selector="1" stepKey="atf2"/>
2525
<cancelPopup stepKey="cp1"/>
@@ -34,6 +34,8 @@
3434
<clickWithLeftButton stepKey="clb2"/>
3535
<clickWithRightButton stepKey="crb1"/>
3636
<clickWithRightButton stepKey="crb2"/>
37+
<closeAdminNotification stepKey="closeadminb1"/>
38+
<closeAdminNotification stepKey="closeadminb2"/>
3739
<closeTab stepKey="clt1"/>
3840
<closeTab stepKey="clt2"/>
3941
<comment userInput="1" stepKey="comm1"/>
@@ -166,8 +168,8 @@
166168
<seeInField stepKey="seeinfield12"/>
167169
<seeInFormFields selector="2" parameterArray="[2]" stepKey="seeinformfields1"/>
168170
<seeInFormFields selector="2" parameterArray="[2]" stepKey="seeinformfields12"/>
169-
<seeInPageSource html="1" stepKey="seeinsource1"/>
170-
<seeInPageSource html="1" stepKey="seeinsource12"/>
171+
<seeInPageSource html="1" stepKey="seeinpagesource1"/>
172+
<seeInPageSource html="1" stepKey="seeinpagesource12"/>
171173
<seeInPopup stepKey="seeinpopup1"/>
172174
<seeInPopup stepKey="seeinpopup12"/>
173175
<seeInSource html="1" stepKey="seeinsource1"/>
@@ -232,8 +234,8 @@
232234
<amOnSubdomain stepKey="aosd2" url="1"/>
233235
<amOnUrl stepKey="aou1" url="1"/>
234236
<amOnUrl stepKey="aou2" url="1"/>
235-
<appendField selector="1" stepKey="ap1"/>
236-
<appendField selector="1" stepKey="ap2"/>
237+
<appendField selector="1" stepKey="app1"/>
238+
<appendField selector="1" stepKey="app2"/>
237239
<attachFile selector="1" stepKey="atf1"/>
238240
<attachFile selector="1" stepKey="atf2"/>
239241
<cancelPopup stepKey="cp1"/>
@@ -248,6 +250,8 @@
248250
<clickWithLeftButton stepKey="clb2"/>
249251
<clickWithRightButton stepKey="crb1"/>
250252
<clickWithRightButton stepKey="crb2"/>
253+
<closeAdminNotification stepKey="closeadmina1"/>
254+
<closeAdminNotification stepKey="closeadmina2"/>
251255
<closeTab stepKey="clt1"/>
252256
<closeTab stepKey="clt2"/>
253257
<comment userInput="1" stepKey="comm1"/>
@@ -380,8 +384,8 @@
380384
<seeInField stepKey="seeinfield12"/>
381385
<seeInFormFields selector="2" parameterArray="[1]" stepKey="seeinformfields1"/>
382386
<seeInFormFields selector="2" parameterArray="[1]" stepKey="seeinformfields12"/>
383-
<seeInPageSource html="1" stepKey="seeinsource1"/>
384-
<seeInPageSource html="1" stepKey="seeinsource12"/>
387+
<seeInPageSource html="1" stepKey="seeinpagesource1"/>
388+
<seeInPageSource html="1" stepKey="seeinpagesource12"/>
385389
<seeInPopup stepKey="seeinpopup1"/>
386390
<seeInPopup stepKey="seeinpopup12"/>
387391
<seeInSource html="1" stepKey="seeinsource1"/>
@@ -445,8 +449,8 @@
445449
<amOnSubdomain stepKey="aosd2" url="1"/>
446450
<amOnUrl stepKey="aou1" url="1"/>
447451
<amOnUrl stepKey="aou2" url="1"/>
448-
<appendField selector="1" stepKey="ap1"/>
449-
<appendField selector="1" stepKey="ap2"/>
452+
<appendField selector="1" stepKey="app1"/>
453+
<appendField selector="1" stepKey="app2"/>
450454
<attachFile selector="1" stepKey="atf1"/>
451455
<attachFile selector="1" stepKey="atf2"/>
452456
<cancelPopup stepKey="cp1"/>
@@ -461,6 +465,8 @@
461465
<clickWithLeftButton stepKey="clb2"/>
462466
<clickWithRightButton stepKey="crb1"/>
463467
<clickWithRightButton stepKey="crb2"/>
468+
<closeAdminNotification stepKey="closeadmin1"/>
469+
<closeAdminNotification stepKey="closeadmin2"/>
464470
<closeTab stepKey="clt1"/>
465471
<closeTab stepKey="clt2"/>
466472
<comment userInput="1" stepKey="comm1"/>
@@ -593,8 +599,8 @@
593599
<seeInField stepKey="seeinfield12"/>
594600
<seeInFormFields selector="2" parameterArray="[1]" stepKey="seeinformfields1"/>
595601
<seeInFormFields selector="2" parameterArray="[1]" stepKey="seeinformfields12"/>
596-
<seeInPageSource html="1" stepKey="seeinsource1"/>
597-
<seeInPageSource html="1" stepKey="seeinsource12"/>
602+
<seeInPageSource html="1" stepKey="seeinpagesource1"/>
603+
<seeInPageSource html="1" stepKey="seeinpagesource12"/>
598604
<seeInPopup stepKey="seeinpopup1"/>
599605
<seeInPopup stepKey="seeinpopup12"/>
600606
<seeInSource html="1" stepKey="seeinsource1"/>

0 commit comments

Comments
 (0)