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");

dev/tests/verification/Resources/ActionGroupWithPersistedData.txt

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

3737
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
@@ -78,7 +78,7 @@ class ActionGroupWithPersistedDataCest
7878
"test",
7979
"DefaultPerson",
8080
[],
81-
null
81+
[]
8282
);
8383

8484
$I->comment("Entering Action Group [actionGroupWithPersistedData1] FunctionalActionGroupWithData");

dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ActionGroupWithStepKeyReferencesCest
3434
"test",
3535
"simpleData",
3636
[],
37-
null
37+
[]
3838
);
3939

4040
$grabTextDataActionGroup = $I->grabTextFrom(".class"); // stepKey: grabTextDataActionGroup
@@ -46,7 +46,6 @@ class ActionGroupWithStepKeyReferencesCest
4646
$action3ActionGroup = $I->executeJS($action3ActionGroup); // stepKey: action3ActionGroup
4747
$action4ActionGroup = $I->magentoCLI($action4ActionGroup, "\"stuffHere\""); // stepKey: action4ActionGroup
4848
$I->comment($action4ActionGroup);
49-
5049
$date = new \DateTime();
5150
$date->setTimestamp(strtotime("{$action5}"));
5251
$date->setTimezone(new \DateTimeZone("America/Los_Angeles"));
@@ -82,7 +81,7 @@ class ActionGroupWithStepKeyReferencesCest
8281
"test",
8382
"{$action10}",
8483
[],
85-
null
84+
[]
8685
);
8786

8887
$action11ActionGroup = $I->grabAttributeFrom($action11ActionGroup, "someInput"); // stepKey: action11ActionGroup

dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt

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

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

dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt

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

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

dev/tests/verification/Resources/AssertTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AssertTestCest
3030
"hook",
3131
"ReplacementPerson",
3232
[],
33-
null
33+
[]
3434
);
3535

3636
}
@@ -50,7 +50,7 @@ class AssertTestCest
5050
"test",
5151
"UniquePerson",
5252
[],
53-
null
53+
[]
5454
);
5555

5656
$grabTextFrom1 = $I->grabTextFrom(".copyright>span"); // stepKey: grabTextFrom1

dev/tests/verification/Resources/BasicActionGroupTest.txt

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

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

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,14 @@ class BasicFunctionalTestCest
9292
$I->dontSeeElementInDOM(".functionalTestSelector"); // stepKey: dontSeeElementInDOMKey1
9393
$I->dontSeeInCurrentUrl("/functionalUrl"); // stepKey: dontSeeInCurrentUrlKey1
9494
$I->dontSeeInField(".functionalTestSelector"); // stepKey: dontSeeInFieldKey1
95-
$I->dontSeeInPageSource("someInput"); // stepKey: dontSeeInPageSourceKey1
96-
$I->dontSeeInSource("<myHtmlHere>"); // stepKey: dontSeeInSourceKey1
95+
$I->dontSeeInPageSource("Cosmo Kramer"); // stepKey: dontSeeInPageSourceKey1
96+
$I->dontSeeInPageSource("<p>Jerry Seinfeld</p>"); // stepKey: dontSeeInPageSourceKey2
97+
$I->dontSeeInPageSource("Cosmo Kramer"); // stepKey: dontSeeInPageSourceKey3
98+
$I->dontSeeInPageSource("<p>Jerry Seinfeld</p>"); // stepKey: dontSeeInPageSourceKey4
99+
$I->dontSeeInPageSource("foo"); // stepKey: dontSeeInPageSourceKey5
100+
$I->dontSeeInPageSource("<p>foo</p>"); // stepKey: dontSeeInPageSourceKey6
101+
$I->dontSeeInSource("Cosmo Kramer"); // stepKey: dontSeeInSourceKey1
102+
$I->dontSeeInSource("<p>Jerry Seinfeld</p>"); // stepKey: dontSeeInSourceKey2
97103
$I->dontSeeInTitle("someInput"); // stepKey: dontSeeInTitleKey1
98104
$I->dontSeeLink("someInput", "/functionalUrl"); // stepKey: dontSeeLinkKey1
99105
$I->dontSeeOptionIsSelected(".functionalTestSelector", "someInput"); // stepKey: dontSeeOptionIsSelectedKey1
@@ -121,7 +127,6 @@ class BasicFunctionalTestCest
121127
$grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector"); // stepKey: grabValueFromKey1
122128
$magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\""); // stepKey: magentoCli1
123129
$I->comment($magentoCli1);
124-
125130
$I->makeScreenshot("screenShotInput"); // stepKey: makeScreenshotKey1
126131
$I->maximizeWindow(); // stepKey: maximizeWindowKey1
127132
$I->moveBack(); // stepKey: moveBackKey1
@@ -147,9 +152,11 @@ class BasicFunctionalTestCest
147152
$I->seeElementInDOM(".functionalTestSelector"); // stepKey: seeElementInDOMKey1
148153
$I->seeInCurrentUrl("/functionalUrl"); // stepKey: seeInCurrentUrlKey1
149154
$I->seeInField(".functionalTestSelector", "someInput"); // stepKey: seeInFieldKey1
150-
$I->seeInPageSource("<myHtmlHere>"); // stepKey: seeInPageSourceKey1
155+
$I->seeInPageSource("Home Page"); // stepKey: seeInPageSourceKey1
156+
$I->seeInPageSource("<h1 class=\"page-title\">"); // stepKey: seeInPageSourceKey2
151157
$I->seeInPopup("someInput"); // stepKey: seeInPopupKey1
152-
$I->seeInSource("<myHtmlHere>"); // stepKey: seeInSourceKey1
158+
$I->seeInSource("Home Page"); // stepKey: seeInSourceKey1
159+
$I->seeInSource("<h1 class=\"page-title\">"); // stepKey: seeInSourceKey2
153160
$I->seeInTitle("someInput"); // stepKey: seeInTitleKey1
154161
$I->seeLink("someInput", "/functionalUrl"); // stepKey: seeLinkKey1
155162
$I->seeNumberOfElements(".functionalTestSelector"); // stepKey: seeNumberOfElementsKey1

0 commit comments

Comments
 (0)