Skip to content

Commit fda0f65

Browse files
authoredJan 11, 2018
MQE-587: Use element selectors in custom JS
- Added 'function' to selector enabled attributes list. - TestGenerator Fixes, unnecessary double quote wrapping and uniqueness addition.
1 parent e2b8dde commit fda0f65

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class ActionObject
2121
{
2222
const DATA_ENABLED_ATTRIBUTES = ["userInput", "parameterArray"];
23-
const SELECTOR_ENABLED_ATTRIBUTES = ['selector', 'dependentSelector', "selector1", "selector2"];
23+
const SELECTOR_ENABLED_ATTRIBUTES = ['selector', 'dependentSelector', "selector1", "selector2", "function"];
2424
const MERGE_ACTION_ORDER_AFTER = 'after';
2525
const MERGE_ACTION_ORDER_BEFORE = 'before';
2626
const ACTION_ATTRIBUTE_URL = 'url';
@@ -368,7 +368,7 @@ private function findAndReplaceReferences($objectHandler, $inputString)
368368
*/
369369
private function resolveRegexPatternForReference($inputString)
370370
{
371-
if (preg_match(ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PARAMETER, $inputString) === 1) {
371+
if (preg_match(ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN_WITH_PARAMS, $inputString) === 1) {
372372
return ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN_WITH_PARAMS;
373373
} else {
374374
return ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN;

‎src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
503503
}
504504

505505
if (isset($customActionAttributes['function'])) {
506-
$function = $customActionAttributes['function'];
506+
$function = $this->addUniquenessFunctionCall($customActionAttributes['function']);
507507
}
508508

509509
if (isset($customActionAttributes['html'])) {
@@ -864,7 +864,7 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
864864
$testSteps .= $this->wrapFunctionCall($actor, $actionName, $function);
865865
break;
866866
case "executeJS":
867-
$testSteps .= $this->wrapFunctionCall($actor, $actionName, $this->wrapWithDoubleQuotes($function));
867+
$testSteps .= $this->wrapFunctionCall($actor, $actionName, $function);
868868
break;
869869
case "performOn":
870870
case "waitForElementChange":
@@ -874,7 +874,7 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
874874
$testSteps .= $this->wrapFunctionCall(
875875
$actor,
876876
$actionName,
877-
$this->wrapWithDoubleQuotes($function),
877+
$function,
878878
$time
879879
);
880880
break;

0 commit comments

Comments
 (0)
Please sign in to comment.