Skip to content

MQE-899: Excessive double quotes are being generated in WaitForElementChange method arguments #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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