Skip to content

Commit

Permalink
MQE-899: Excessive double quotes are being generated in WaitForElemen…
Browse files Browse the repository at this point in the history
…tChange 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.
  • Loading branch information
KevinBKozan authored Apr 19, 2018
1 parent 298bbca commit df4db87
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class BasicFunctionalTestCest
$I->moveMouseOver(".functionalTestSelector");
$I->openNewTab();
$I->pauseExecution();
$I->performOn("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();});
$I->pressKey("#page", "a");
$I->pressKey("#page", ['ctrl','a'],'new');
$I->pressKey("#page", ['shift','111'],'1','x');
Expand Down Expand Up @@ -150,6 +151,7 @@ class BasicFunctionalTestCest
$I->waitForElement(".functionalTestSelector", 30);
$I->waitForElementNotVisible(".functionalTestSelector", 30);
$I->waitForElementVisible(".functionalTestSelector", 30);
$I->waitForElementChange("#selector", function(\WebDriverElement $el) {return $el->isDisplayed();});
$I->waitForJS("someJsFunction", 30);
$I->waitForText("someInput", 30, ".functionalTestSelector");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<moveMouseOver selector=".functionalTestSelector" stepKey="moveMouseOverKey1"/>
<openNewTab stepKey="openNewTabKey1"/>
<pauseExecution stepKey="pauseExecutionKey1"/>
<performOn selector="#selector" function="function(\WebDriverElement $el) {return $el->isDisplayed();}" stepKey="performOnKey1"/>
<pressKey selector="#page" userInput="a" stepKey="pressKey1"/>
<pressKey selector="#page" parameterArray="[['ctrl','a'],'new']" stepKey="pressKey2"/>
<pressKey selector="#page" parameterArray="[['shift','111'],'1','x']" stepKey="pressKey3"/>
Expand Down Expand Up @@ -113,6 +114,7 @@
<waitForElement time="30" selector=".functionalTestSelector" stepKey="waitForElementKey1" />
<waitForElementNotVisible selector=".functionalTestSelector" time="30" stepKey="waitForElementNotVisibleKey1" />
<waitForElementVisible selector=".functionalTestSelector" time="30" stepKey="waitForElementVisibleKey1" />
<waitForElementChange selector="#selector" function="function(\WebDriverElement $el) {return $el->isDisplayed();}" stepKey="waitForElementChangeKey1"/>
<waitForJS function="someJsFunction" time="30" stepKey="waitForJSKey1" />
<waitForText selector=".functionalTestSelector" userInput="someInput" time="30" stepKey="waitForText1"/>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ActionObject
const ASSERTION_VALUE_ATTRIBUTE = "value";
const DELETE_DATA_MUTUAL_EXCLUSIVE_ATTRIBUTES = ["url", "createDataKey"];
const EXTERNAL_URL_AREA_INVALID_ACTIONS = ['amOnPage'];
const FUNCTION_CLOSURE_ACTIONS = ['waitForElementChange', 'performOn'];
const MERGE_ACTION_ORDER_AFTER = 'after';
const MERGE_ACTION_ORDER_BEFORE = 'before';
const ACTION_ATTRIBUTE_URL = 'url';
Expand Down
4 changes: 4 additions & 0 deletions src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "

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

if (isset($customActionAttributes['html'])) {
Expand Down

0 comments on commit df4db87

Please sign in to comment.