Skip to content

Commit 553a763

Browse files
authored
Merge pull request #405 from magento/develop
MFTF 2.4.3 - Merge to Master
2 parents 4a430db + 656f819 commit 553a763

File tree

56 files changed

+696
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+696
-281
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ dev/tests/functional/MFTF.suite.yml
1616
dev/tests/functional/_output
1717
dev/mftf.log
1818
dev/tests/mftf.log
19-
dev/tests/docs/*
19+
dev/tests/docs/*
20+
dev/tests/_output
21+
dev/tests/functional.suite.yml

CHANGELOG.md

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

4+
2.4.3
5+
-----
6+
* Customizability
7+
* Use of `_CREDS` has been extended to `<magentoCLI>` and `<createData>` actions
8+
* Traceability
9+
* A Test step is now generated and injected in the allure report when a test is reported as `BROKEN`.
10+
11+
### Fixes
12+
* `static-checks` command now properly returns `1` if any static check failed.
13+
* MFTF Console Printer class correctly utilizes `--steps` and other flags passed directly to `codecept commands`.
14+
* `*source` actions correctly print when using `userInput` or `html` attributes.
15+
* XML Comments should no longer throw an error in parsing when used outside `test/actionGroup`
16+
17+
### GitHub Issues/Pull requests:
18+
* [#703](https://github.com/magento/magento2-functional-testing-framework/pull/403) -- SMALL_CHANGE: Minor change suggested
19+
420
2.4.2
521
-----
622
* Traceability

bin/mftf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ try {
2929
try {
3030
$application = new Symfony\Component\Console\Application();
3131
$application->setName('Magento Functional Testing Framework CLI');
32-
$application->setVersion('2.4.2');
32+
$application->setVersion('2.4.3');
3333
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
3434
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
3535
foreach ($commandList->getCommands() as $command) {

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.4.2",
5+
"version": "2.4.3",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php

Lines changed: 118 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use AspectMock\Test as AspectMock;
99
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
1010
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
11+
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
12+
use Magento\FunctionalTestingFramework\Exceptions\XmlException;
1113
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
1214
use Magento\FunctionalTestingFramework\Test\Util\ActionMergeUtil;
1315
use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor;
@@ -100,7 +102,7 @@ public function testResolveActionStepEntityData()
100102
$dataFieldName = 'myfield';
101103
$dataFieldValue = 'myValue';
102104
$userInputKey = "userInput";
103-
$userinputValue = "{{" . "${dataObjectName}.${dataFieldName}}}";
105+
$userInputValue = "{{" . "${dataObjectName}.${dataFieldName}}}";
104106
$actionName = "myAction";
105107
$actionType = "myCustomType";
106108

@@ -113,10 +115,10 @@ public function testResolveActionStepEntityData()
113115
AspectMock::double(DataObjectHandler::class, ['getInstance' => $mockDOHInstance]);
114116

115117
// Create test object and action object
116-
$actionAttributes = [$userInputKey => $userinputValue];
118+
$actionAttributes = [$userInputKey => $userInputValue];
117119
$actions[$actionName] = new ActionObject($actionName, $actionType, $actionAttributes);
118120

119-
$this->assertEquals($userinputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]);
121+
$this->assertEquals($userInputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]);
120122

121123
$mergeUtil = new ActionMergeUtil("test", "TestCase");
122124
$resolvedActions = $mergeUtil->resolveActionSteps($actions);
@@ -127,8 +129,14 @@ public function testResolveActionStepEntityData()
127129
/**
128130
* Verify that an XmlException is thrown when an action references a non-existant action.
129131
*
132+
* @throws TestReferenceException
133+
* @throws XmlException
130134
* @return void
131135
*/
136+
/**
137+
* @throws TestReferenceException
138+
* @throws XmlException
139+
*/
132140
public function testNoActionException()
133141
{
134142
$actionObjects = [];
@@ -151,6 +159,8 @@ public function testNoActionException()
151159
/**
152160
* Verify that a <waitForPageLoad> action is added after actions that have a wait (timeout property).
153161
*
162+
* @throws TestReferenceException
163+
* @throws XmlException
154164
* @return void
155165
*/
156166
public function testInsertWait()
@@ -173,6 +183,111 @@ public function testInsertWait()
173183
$this->assertEquals($expected, $actual);
174184
}
175185

186+
/**
187+
* Verify that a <fillField> action is replaced by <fillSecretField> when secret _CREDS are referenced.
188+
*
189+
* @throws TestReferenceException
190+
* @throws XmlException
191+
*/
192+
public function testValidFillFieldSecretFunction()
193+
{
194+
$actionObjectOne = new ActionObject(
195+
'actionKey1',
196+
'fillField',
197+
['userInput' => '{{_CREDS.username}}']
198+
);
199+
$actionObject = [$actionObjectOne];
200+
201+
$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');
202+
203+
$result = $actionMergeUtil->resolveActionSteps($actionObject);
204+
205+
$expectedValue = new ActionObject(
206+
'actionKey1',
207+
'fillSecretField',
208+
['userInput' => '{{_CREDS.username}}']
209+
);
210+
$this->assertEquals($expectedValue, $result['actionKey1']);
211+
}
212+
213+
/**
214+
* Verify that a <magentoCLI> action uses <magentoCLI> when secret _CREDS are referenced.
215+
*
216+
* @throws TestReferenceException
217+
* @throws XmlException
218+
*/
219+
public function testValidMagentoCLISecretFunction()
220+
{
221+
$actionObjectOne = new ActionObject(
222+
'actionKey1',
223+
'magentoCLI',
224+
['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']
225+
);
226+
$actionObject = [$actionObjectOne];
227+
228+
$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');
229+
230+
$result = $actionMergeUtil->resolveActionSteps($actionObject);
231+
232+
$expectedValue = new ActionObject(
233+
'actionKey1',
234+
'magentoCLISecret',
235+
['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']
236+
);
237+
$this->assertEquals($expectedValue, $result['actionKey1']);
238+
}
239+
240+
/**
241+
* Verify that a <field> override in a <createData> action uses <field> when secret _CREDS are referenced.
242+
*
243+
* @throws TestReferenceException
244+
* @throws XmlException
245+
*/
246+
public function testValidCreateDataSecretFunction()
247+
{
248+
$actionObjectOne = new ActionObject(
249+
'actionKey1',
250+
'field',
251+
['value' => '{{_CREDS.payment_authorizenet_login}}']
252+
);
253+
$actionObject = [$actionObjectOne];
254+
255+
$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');
256+
257+
$result = $actionMergeUtil->resolveActionSteps($actionObject);
258+
259+
$expectedValue = new ActionObject(
260+
'actionKey1',
261+
'field',
262+
['value' => '{{_CREDS.payment_authorizenet_login}}']
263+
);
264+
$this->assertEquals($expectedValue, $result['actionKey1']);
265+
}
266+
267+
/**
268+
* Verify that a <click> action throws an exception when secret _CREDS are referenced.
269+
*
270+
* @throws TestReferenceException
271+
* @throws XmlException
272+
*/
273+
public function testInvalidSecretFunctions()
274+
{
275+
$this->expectException(TestReferenceException::class);
276+
$this->expectExceptionMessage(
277+
'You cannot reference secret data outside of the fillField, magentoCLI and createData actions'
278+
);
279+
280+
$actionObjectOne = new ActionObject(
281+
'actionKey1',
282+
'click',
283+
['userInput' => '{{_CREDS.username}}']
284+
);
285+
$actionObject = [$actionObjectOne];
286+
287+
$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');
288+
$actionMergeUtil->resolveActionSteps($actionObject);
289+
}
290+
176291
/**
177292
* After class functionality
178293
* @return void

dev/tests/verification/Resources/ActionGroupUsingCreateData.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ActionGroupUsingCreateDataCest
3131
"hook",
3232
"ApiCategory",
3333
[],
34-
null
34+
[]
3535
);
3636

3737
$I->comment("[createConfigProductKey1] create 'ApiConfigurableProduct' entity");
@@ -40,7 +40,7 @@ class ActionGroupUsingCreateDataCest
4040
"hook",
4141
"ApiConfigurableProduct",
4242
["createCategoryKey1"],
43-
null
43+
[]
4444
);
4545

4646
$I->comment("Exiting Action Group [Key1] actionGroupWithCreateData");

dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ActionGroupWithDataOverrideTestCest
3131
"hook",
3232
"ReplacementPerson",
3333
[],
34-
null
34+
[]
3535
);
3636

3737
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");

dev/tests/verification/Resources/ActionGroupWithDataTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ActionGroupWithDataTestCest
3131
"hook",
3232
"ReplacementPerson",
3333
[],
34-
null
34+
[]
3535
);
3636

3737
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");

dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ActionGroupWithNoDefaultTestCest
3131
"hook",
3232
"ReplacementPerson",
3333
[],
34-
null
34+
[]
3535
);
3636

3737
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");

0 commit comments

Comments
 (0)