Skip to content

Commit f81ab93

Browse files
committed
MQE-899: Excessive double quotes are being generated in WaitForElementChange method arguments
- Fixed quote issue in waitForElementChanged. Also included fix for performOn, as it's the only other codeception function that takes a closure as an argument.
1 parent 320dc63 commit f81ab93

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class BasicFunctionalTestCest
112112
$I->moveMouseOver(".functionalTestSelector");
113113
$I->openNewTab();
114114
$I->pauseExecution();
115+
$I->performOn("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();});
115116
$I->pressKey("#page", "a");
116117
$I->pressKey("#page", ['ctrl','a'],'new');
117118
$I->pressKey("#page", ['shift','111'],'1','x');
@@ -150,6 +151,7 @@ class BasicFunctionalTestCest
150151
$I->waitForElement(".functionalTestSelector", 30);
151152
$I->waitForElementNotVisible(".functionalTestSelector", 30);
152153
$I->waitForElementVisible(".functionalTestSelector", 30);
154+
$I->waitForElementChange("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();});
153155
$I->waitForJS("someJsFunction", 30);
154156
$I->waitForText("someInput", 30, ".functionalTestSelector");
155157
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<moveMouseOver selector=".functionalTestSelector" stepKey="moveMouseOverKey1"/>
7474
<openNewTab stepKey="openNewTabKey1"/>
7575
<pauseExecution stepKey="pauseExecutionKey1"/>
76+
<performOn selector="#selector" function="function(\WebDriverElement $el) {return $el->isDisplayed();}" stepKey="performOnKey1"/>
7677
<pressKey selector="#page" userInput="a" stepKey="pressKey1"/>
7778
<pressKey selector="#page" parameterArray="[['ctrl','a'],'new']" stepKey="pressKey2"/>
7879
<pressKey selector="#page" parameterArray="[['shift','111'],'1','x']" stepKey="pressKey3"/>
@@ -113,6 +114,7 @@
113114
<waitForElement time="30" selector=".functionalTestSelector" stepKey="waitForElementKey1" />
114115
<waitForElementNotVisible selector=".functionalTestSelector" time="30" stepKey="waitForElementNotVisibleKey1" />
115116
<waitForElementVisible selector=".functionalTestSelector" time="30" stepKey="waitForElementVisibleKey1" />
117+
<waitForElementChange selector="#selector" function="function(\WebDriverElement $el) {return $el->isDisplayed();}" stepKey="waitForElementChangeKey1"/>
116118
<waitForJS function="someJsFunction" time="30" stepKey="waitForJSKey1" />
117119
<waitForText selector=".functionalTestSelector" userInput="someInput" time="30" stepKey="waitForText1"/>
118120
</test>

src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ActionObject
3737
const ASSERTION_VALUE_ATTRIBUTE = "value";
3838
const DELETE_DATA_MUTUAL_EXCLUSIVE_ATTRIBUTES = ["url", "createDataKey"];
3939
const EXTERNAL_URL_AREA_INVALID_ACTIONS = ['amOnPage'];
40+
const FUNCTION_CLOSURE_ACTIONS = ['waitForElementChange', 'performOn'];
4041
const MERGE_ACTION_ORDER_AFTER = 'after';
4142
const MERGE_ACTION_ORDER_BEFORE = 'before';
4243
const ACTION_ATTRIBUTE_URL = 'url';

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,10 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
590590

591591
if (isset($customActionAttributes['function'])) {
592592
$function = $this->addUniquenessFunctionCall($customActionAttributes['function']);
593+
if (in_array($actionObject->getType(), ActionObject::FUNCTION_CLOSURE_ACTIONS)) {
594+
// Argument must be a closure function, not a string.
595+
$function = trim($function, '"');
596+
}
593597
}
594598

595599
if (isset($customActionAttributes['html'])) {

0 commit comments

Comments
 (0)