From a7597c94f1937aa5e8bddca8f630ea06020dadc5 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Mon, 6 May 2019 16:23:47 +0300 Subject: [PATCH 1/3] executeInSelenium generation fix #2 --- .../Resources/ExecuteInSeleniumTest.txt | 2 +- .../TestModule/Test/ExecuteInSeleniumTest.xml | 2 +- .../Util/TestGenerator.php | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt b/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt index 323b2ffb9..8de68cdf0 100644 --- a/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt +++ b/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt @@ -27,6 +27,6 @@ class ExecuteInSeleniumTestCest */ public function ExecuteInSeleniumTest(AcceptanceTester $I) { - $I->executeInSelenium(function ($webdriver) { return 'Hello, World!'}); + $I->executeInSelenium(function ($webdriver) { return "Hello, World!"}); } } diff --git a/dev/tests/verification/TestModule/Test/ExecuteInSeleniumTest.xml b/dev/tests/verification/TestModule/Test/ExecuteInSeleniumTest.xml index 0a72189b4..c25164220 100644 --- a/dev/tests/verification/TestModule/Test/ExecuteInSeleniumTest.xml +++ b/dev/tests/verification/TestModule/Test/ExecuteInSeleniumTest.xml @@ -9,6 +9,6 @@ - + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 07cb96b3a..63d70f419 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -639,7 +639,10 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato } if (isset($customActionAttributes['function'])) { - $function = $this->addUniquenessFunctionCall($customActionAttributes['function']); + $function = $this->addUniquenessFunctionCall( + $customActionAttributes['function'], + $actionObject->getType() !== "executeInSelenium" + ); if (in_array($actionObject->getType(), ActionObject::FUNCTION_CLOSURE_ACTIONS)) { // Argument must be a closure function, not a string. $function = trim($function, '"'); @@ -1698,11 +1701,16 @@ private function processPressKey($input) * Add uniqueness function call to input string based on regex pattern. * * @param string $input + * @param bool $wrapWithDoubleQuotes * @return string */ - private function addUniquenessFunctionCall($input) + private function addUniquenessFunctionCall($input, $wrapWithDoubleQuotes = true) { - $output = $this->wrapWithDoubleQuotes($input); + if ($wrapWithDoubleQuotes) { + $output = $this->wrapWithDoubleQuotes($input); + } else { + $output = $input; + } //Match on msq(\"entityName\") preg_match_all('/' . EntityDataObject::CEST_UNIQUE_FUNCTION . '\(\\\\"[\w]+\\\\"\)/', $output, $matches); From 3760dc83dbe08e87abf35014b14294292fdb3e62 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Mon, 6 May 2019 17:31:59 +0300 Subject: [PATCH 2/3] executeInSelenium generation fix #2 --- src/Magento/FunctionalTestingFramework/Util/TestGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 63d70f419..e8bc07432 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1701,7 +1701,7 @@ private function processPressKey($input) * Add uniqueness function call to input string based on regex pattern. * * @param string $input - * @param bool $wrapWithDoubleQuotes + * @param boolean $wrapWithDoubleQuotes * @return string */ private function addUniquenessFunctionCall($input, $wrapWithDoubleQuotes = true) From da4ec73fec326f57f8c27e5cdf61e3f9ccdd5aa7 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra Date: Tue, 7 May 2019 00:09:33 +0300 Subject: [PATCH 3/3] executeInSelenium generation fix #2 --- src/Magento/FunctionalTestingFramework/Util/TestGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index e8bc07432..86b8d8885 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1700,7 +1700,7 @@ private function processPressKey($input) /** * Add uniqueness function call to input string based on regex pattern. * - * @param string $input + * @param string $input * @param boolean $wrapWithDoubleQuotes * @return string */