Skip to content

Commit 7111f9d

Browse files
authored
Merge branch 'develop' into MQE-3124
2 parents 6900633 + 7adbae6 commit 7111f9d

File tree

11 files changed

+89
-21
lines changed

11 files changed

+89
-21
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Magento Functional Testing Framework Changelog
22
================================================
3+
3.7.3
4+
---------
5+
6+
### Updates:
7+
* Fix encoding issue when secret key contains plus sign
8+
* Adding pagebuilder file upload spinner to loadingMaskLocators
9+
10+
311
3.7.2
412
---------
513

composer.json

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

composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/functional/tests/MFTF/DevDocs/Helper/CustomHelper.php

+11
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,15 @@ public function goTo(
4646
print('$bla = ' . $bla . PHP_EOL);
4747
print('array $arraysomething = [' . implode(', ', $arraysomething) . ']' . PHP_EOL);
4848
}
49+
50+
/**
51+
* Returns value of provided param $text
52+
*
53+
* @param string $text
54+
* @return string
55+
*/
56+
public function getText(string $text): string
57+
{
58+
return $text;
59+
}
4960
}

dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml

+8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
<argument name="int">987</argument>
4343
</helper>
4444

45+
<helper class="\MFTF\DevDocs\Helper\CustomHelper" method="getText" stepKey="getText">
46+
<argument name="text">some text</argument>
47+
</helper>
48+
<assertEquals stepKey="assertHelperReturnValue" message="Method getText of CustomHelper should return value which may be used as variable in test">
49+
<expectedResult type="string">some text</expectedResult>
50+
<actualResult type="variable">getText</actualResult>
51+
</assertEquals>
52+
4553
<actionGroup ref="HelperActionGroup" stepKey="actionGroupWithCustomHelper">
4654
<argument name="test" value="{{HelperData.entityField}}" />
4755
<argument name="entityTest" value="HelperData" />

dev/tests/verification/Resources/DataActionsTest.txt

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class DataActionsTestCest
5353
*/
5454
public function DataActionsTest(AcceptanceTester $I)
5555
{
56+
$I->waitForElementClickable(".functionalTestSelector"); // stepKey: waitForElementClickable
5657
$I->createEntity("createdInTest", "test", "entity", [], []); // stepKey: createdInTest
5758
$I->updateEntity("createdInTest", "test", "entity",[]); // stepKey: updateInTest
5859
$I->deleteEntity("createdInTest", "test"); // stepKey: deleteInTest

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
<createData entity="entity" stepKey="createdInBefore"/>
1414
<updateData entity="entity" createDataKey="createdInBefore" stepKey="updateInBefore"/>
1515
<deleteData createDataKey="createdInBefore" stepKey="deleteInBefore"/>
16-
</before>
1716

17+
</before>
18+
<waitForElementClickable selector=".functionalTestSelector" time="30" stepKey="waitForElementClickable" />
1819
<createData entity="entity" stepKey="createdInTest"/>
1920
<updateData entity="entity" createDataKey="createdInTest" stepKey="updateInTest"/>
2021
<deleteData createDataKey="createdInTest" stepKey="deleteInTest"/>

docs/test/actions.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -2374,10 +2374,28 @@ Attribute|Type|Use|Description
23742374
#### Example
23752375

23762376
```xml
2377-
<!-- Wait up to 30 seconds for `<div id="changedElement" ... >...</div>` to become visible on the page before continuing. -->
23782377
<waitForElementVisible selector="#changedElement" stepKey="waitForElementVisible"/>
23792378
```
23802379

2380+
### waitForElementClickable
2381+
2382+
See [waitForElementClickable docs on codeception.com](http://codeception.com/docs/modules/WebDriver#waitForElementClickable).
2383+
2384+
Attribute|Type|Use|Description
2385+
---|---|---|---
2386+
`selector`|string|optional| The selector identifying the corresponding HTML element.
2387+
`time`|string|optional| The number of seconds to wait for the element to appear.
2388+
`stepKey`|string|required| A unique identifier of the action.
2389+
`before`|string|optional| `stepKey` of action that must be executed next.
2390+
`after`|string|optional| `stepKey` of preceding action.
2391+
2392+
#### Example
2393+
2394+
```xml
2395+
<!-- Waits up to $timeout seconds for the given element to be clickable. If element doesn’t become clickable, a timeout exception is thrown. -->
2396+
<waitForElementClickable selector="#changedElement" stepKey="waitForElementClickable"/>
2397+
```
2398+
23812399
### waitForJS
23822400

23832401
See [waitForJS docs on codeception.com](http://codeception.com/docs/modules/WebDriver#waitForJS).

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ class MagentoWebDriver extends WebDriver
7272
'//div[contains(@class, "admin__data-grid-loading-mask")]',
7373
'//div[contains(@class, "admin__form-loading-mask")]',
7474
'//div[@data-role="spinner"]',
75+
'//div[contains(@class,"file-uploader-spinner")]',
76+
'//div[contains(@class,"image-uploader-spinner")]',
77+
'//div[contains(@class,"uploader")]//div[@class="file-row"]',
7578
];
7679

7780
/**

src/Magento/FunctionalTestingFramework/Test/etc/Actions/waitActions.xsd

+17
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<xs:element type="waitForPwaElementNotVisibleType" name="waitForPwaElementNotVisible" minOccurs="0" maxOccurs="unbounded"/>
2424
<xs:element type="waitForPwaElementVisibleType" name="waitForPwaElementVisible" minOccurs="0" maxOccurs="unbounded"/>
2525
<xs:element type="waitForTextType" name="waitForText" minOccurs="0" maxOccurs="unbounded"/>
26+
<xs:element type="waitForElementClickableType" name="waitForElementClickable" minOccurs="0" maxOccurs="unbounded"/>
27+
2628
</xs:choice>
2729
</xs:group>
2830

@@ -224,4 +226,19 @@
224226
</xs:extension>
225227
</xs:simpleContent>
226228
</xs:complexType>
229+
<xs:complexType name="waitForElementClickableType">
230+
<xs:annotation>
231+
<xs:documentation>
232+
Waits up to $timeout seconds for the given element to be clickable.
233+
If element doesn’t become clickable, a timeout exception is thrown.
234+
</xs:documentation>
235+
</xs:annotation>
236+
<xs:simpleContent>
237+
<xs:extension base="xs:string">
238+
<xs:attribute ref="selector" use="required"/>
239+
<xs:attribute ref="time"/>
240+
<xs:attributeGroup ref="commonActionAttributes"/>
241+
</xs:extension>
242+
</xs:simpleContent>
243+
</xs:complexType>
227244
</xs:schema>

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

+18-17
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,12 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
898898
$stepKey,
899899
$customActionAttributes['class'] . '::' . $customActionAttributes['method']
900900
);
901-
$testSteps .= $this->wrapFunctionCall($actor, $actionObject, $arguments);
901+
$testSteps .= $this->wrapFunctionCallWithReturnValue(
902+
$stepKey,
903+
$actor,
904+
$actionObject,
905+
$arguments
906+
);
902907
break;
903908
case "createData":
904909
$entity = $customActionAttributes['entity'];
@@ -2016,16 +2021,7 @@ private function addDollarSign($input)
20162021
*/
20172022
private function wrapFunctionCall($actor, $action, ...$args)
20182023
{
2019-
$isFirst = true;
2020-
$isActionHelper = $action->getType() === 'helper';
2021-
$actionType = $action->getType();
2022-
if ($isActionHelper) {
2023-
$actor = "this->helperContainer->get('" . $action->getCustomActionAttributes()['class'] . "')";
2024-
$args = $args[0];
2025-
$actionType = $action->getCustomActionAttributes()['method'];
2026-
}
2027-
2028-
$output = sprintf("\t\t$%s->%s(", $actor, $actionType);
2024+
$output = sprintf("\t\t$%s->%s(", $actor, $action->getType());
20292025
for ($i = 0; $i < count($args); $i++) {
20302026
if (null === $args[$i]) {
20312027
continue;
@@ -2046,17 +2042,22 @@ private function wrapFunctionCall($actor, $action, ...$args)
20462042
/**
20472043
* Wrap parameters into a function call with a return value.
20482044
*
2049-
* @param string $returnVariable
2050-
* @param string $actor
2051-
* @param string $action
2052-
* @param array ...$args
2045+
* @param string $returnVariable
2046+
* @param string $actor
2047+
* @param actionObject $action
2048+
* @param array ...$args
20532049
* @return string
20542050
* @throws \Exception
20552051
*/
20562052
private function wrapFunctionCallWithReturnValue($returnVariable, $actor, $action, ...$args)
20572053
{
2058-
$isFirst = true;
2059-
$output = sprintf("\t\t$%s = $%s->%s(", $returnVariable, $actor, $action->getType());
2054+
$actionType = $action->getType();
2055+
if ($actionType === 'helper') {
2056+
$actor = "this->helperContainer->get('" . $action->getCustomActionAttributes()['class'] . "')";
2057+
$args = $args[0];
2058+
$actionType = $action->getCustomActionAttributes()['method'];
2059+
}
2060+
$output = sprintf("\t\t$%s = $%s->%s(", $returnVariable, $actor, $actionType);
20602061
for ($i = 0; $i < count($args); $i++) {
20612062
if (null === $args[$i]) {
20622063
continue;

0 commit comments

Comments
 (0)