From df4db87c4b21476895614816e6d92e8b08405789 Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Thu, 19 Apr 2018 22:53:14 +0300 Subject: [PATCH] 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. --- dev/tests/verification/Resources/BasicFunctionalTest.txt | 2 ++ .../verification/TestModule/Test/BasicFunctionalTest.xml | 2 ++ .../FunctionalTestingFramework/Test/Objects/ActionObject.php | 1 + src/Magento/FunctionalTestingFramework/Util/TestGenerator.php | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt index 3452b8883..cebccc5d1 100644 --- a/dev/tests/verification/Resources/BasicFunctionalTest.txt +++ b/dev/tests/verification/Resources/BasicFunctionalTest.txt @@ -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'); @@ -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"); } diff --git a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml index 70ba6299f..9af9187a8 100644 --- a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml +++ b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml @@ -73,6 +73,7 @@ + @@ -113,6 +114,7 @@ + diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index 8a57013b1..a0436bc19 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -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'; diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 81e055fe6..ac1402c47 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -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'])) {