Skip to content
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: 1 addition & 1 deletion dev/tests/verification/Resources/ExecuteInSeleniumTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class ExecuteInSeleniumTestCest
*/
public function ExecuteInSeleniumTest(AcceptanceTester $I)
{
$I->executeInSelenium(function ($webdriver) { return 'Hello, World!'}); // stepKey: executeInSeleniumStep
$I->executeInSelenium(function ($webdriver) { return "Hello, World!"}); // stepKey: executeInSeleniumStep
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="ExecuteInSeleniumTest">
<executeInSelenium function="function ($webdriver) { return 'Hello, World!'}" stepKey="executeInSeleniumStep"/>
<executeInSelenium function="function ($webdriver) { return &quot;Hello, World!&quot;}" stepKey="executeInSeleniumStep"/>
</test>
</tests>
16 changes: 12 additions & 4 deletions src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,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, '"');
Expand Down Expand Up @@ -1736,12 +1739,17 @@ 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
*/
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);
Expand Down