Skip to content

MFTF 2.3.7 - Merge to Master #241

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 23 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8a1525c
MQE-1065: Persisted data are not resolved correctly when using with P…
jilu1 Sep 10, 2018
10c74aa
MQE-1065: Persisted data are not resolved correctly when using with P…
jilu1 Sep 13, 2018
f267432
MQE-1142: Use timeout value when waitForLoadingMaskToDisappear
jilu1 Sep 13, 2018
ded92ff
MQE-1065: Persisted data are not resolved correctly when using with P…
jilu1 Sep 14, 2018
b4a27e5
MQE-1248: Expose MFTF DEFAULT_TIMEZONE configuration in .env
KevinBKozan Sep 18, 2018
c4d3307
Merge pull request #225 from magento/MQE-1142
jilu1 Sep 18, 2018
d02fe0c
Merge pull request #222 from magento/MQE-1065
jilu1 Sep 18, 2018
66b6ecd
MQE-1040: MFTF standalone commands do not pass down constants correct…
aljcalandra Sep 18, 2018
214abd7
MQE-1142: Use timeout value when waitForLoadingMaskToDisappear
KevinBKozan Sep 20, 2018
67af7e0
MQE-1254: MFTF with Firefox fails due to getLog call (#229)
aljcalandra Sep 20, 2018
10a269e
MQE-1040: MFTF standalone commands do not pass down constants correct…
aljcalandra Sep 20, 2018
56440ef
MQE-1150: Test generation fails for arguments containing hyphen chara…
KevinBKozan Sep 25, 2018
1de0283
MQE-1148: Include Parent In Output Of Duplicate StepKey or Section El…
KevinBKozan Sep 25, 2018
54a61f8
MQE-1124: [Github Issue] Allow running tests for modules installed in…
aljcalandra Sep 25, 2018
95bcb1d
MQE-1173: [Dev experience] Error on test generation without reference…
aljcalandra Sep 25, 2018
de1ab89
MQE-1222: Selector Fails To Resolve Correctly in Action Group
KevinBKozan Sep 25, 2018
94afc74
MQE-1256: "Merge" works different for tests and action groups
KevinBKozan Sep 27, 2018
26487bc
MQE-1117: dontSeeJsError does not catch JS errors (#223)
jilu1 Sep 28, 2018
1d022b9
MQE-1117: dontSeeJsError does not catch JS errors
KevinBKozan Sep 28, 2018
a4e0a9b
MFTF 2.3.7 - CHANGELOG.md and Version Bump
KevinBKozan Oct 2, 2018
68c8d68
MQE-1117: dontSeeJsError does not catch JS errors (#242)
aljcalandra Oct 3, 2018
71880ae
MAGEDOC-3174: Update README
dshevtsov Oct 3, 2018
0a3ef3a
MAGEDOC-3161: Create CONTRIBUTING.md
dshevtsov Oct 3, 2018
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
6 changes: 3 additions & 3 deletions dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class BasicFunctionalTestCest
$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');
$I->pressKey("#page", ['ctrl', 'a'],\Facebook\WebDriver\WebDriverKeys::DELETE);
$I->pressKey("#page", ['ctrl', 'a'],'new');
$I->pressKey("#page", ['shift', '111'],'1','x');
$I->pressKey("#page", ['ctrl', 'a'],\Facebook\WebDriver\WebDriverKeys::DELETE);
$I->reloadPage();
$I->resetCookie("cookieInput");
$I->resizeWindow(0, 0);
Expand Down
6 changes: 6 additions & 0 deletions dev/tests/verification/Resources/ParameterArrayTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ class ParameterArrayTestCest
$I->unselectOption("#selector", ["postname" . msq("simpleParamData")]);
$I->unselectOption("#selector", [PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test')]);
$I->unselectOption("#selector", ["name", PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test')]);
$I->pressKey("#selector", PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'), ['ctrl', 'a'],\Facebook\WebDriver\WebDriverKeys::DELETE,PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'));
$I->pressKey("#selector", ['ctrl', 'a'], 10, 20,\Facebook\WebDriver\WebDriverKeys::DELETE,PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'));
$I->pressKey("#selector", ['ctrl', 'a'],'new', 10, 20,\Facebook\WebDriver\WebDriverKeys::DELETE,PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'));
$I->pressKey("#selector", ['ctrl', 'a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], [PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'), 'a', "name"]);
$I->pressKey("#selector", ['ctrl', 'a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], 0, [PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test'), PersistedObjectHandler::getInstance()->retrieveEntityField('simpleDataKey', 'name', 'test')]);
$I->pressKey("#selector", ['ctrl', 'a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], [msq("simpleParamData") . "prename", "postname" . msq("simpleParamData")]);
}
}
7 changes: 7 additions & 0 deletions dev/tests/verification/TestModule/Test/ParameterArrayTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@
<unselectOption selector="#selector" parameterArray="[{{simpleParamData.uniqueNamePost}}]" stepKey="004"/>
<unselectOption selector="#selector" parameterArray="[$simpleDataKey.name$]" stepKey="005"/>
<unselectOption selector="#selector" parameterArray="[{{simpleParamData.name}}, $simpleDataKey.name$]" stepKey="006"/>

<pressKey selector="#selector" parameterArray="[$simpleDataKey.name$, ['ctrl', 'a'], \Facebook\WebDriver\WebDriverKeys::DELETE, $simpleDataKey.name$]" stepKey="pressKey001"/>
<pressKey selector="#selector" parameterArray="[['ctrl', 'a'], 10, 20, \Facebook\WebDriver\WebDriverKeys::DELETE, $simpleDataKey.name$]" stepKey="pressKey002"/>
<pressKey selector="#selector" parameterArray="[['ctrl', 'a'], 'new', 10, 20, \Facebook\WebDriver\WebDriverKeys::DELETE, $simpleDataKey.name$]" stepKey="pressKey003"/>
<pressKey selector="#selector" parameterArray="[['ctrl','a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], [$simpleDataKey.name$, 'a', {{simpleParamData.name}}]]" stepKey="pressKey004"/>
<pressKey selector="#selector" parameterArray="[['ctrl','a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], 0, [$simpleDataKey.name$, $simpleDataKey.name$]]" stepKey="pressKey005"/>
<pressKey selector="#selector" parameterArray="[['ctrl','a'],'new', 1, ['ctrl'], ['shift', 'ctrl', 'del'], [{{simpleParamData.uniqueNamePre}}, {{simpleParamData.uniqueNamePost}}]]" stepKey="pressKey006"/>
</test>
</tests>
84 changes: 66 additions & 18 deletions src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TestGenerator
const TEST_SCOPE = 'test';
const HOOK_SCOPE = 'hook';
const SUITE_SCOPE = 'suite';
const PRESSKEY_ARRAY_ANCHOR_KEY = '987654321098765432109876543210';

/**
* Path to the export dir.
Expand Down Expand Up @@ -960,24 +961,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
case "pressKey":
$parameterArray = $customActionAttributes['parameterArray'] ?? null;
if ($parameterArray) {
// validate the param array is in the correct format
$this->validateParameterArray($parameterArray);

// trim off the outer braces and add commas for the regex match
$params = "," . substr($parameterArray, 1, strlen($parameterArray) - 2) . ",";

// we are matching any nested arrays for a simultaneous press, any string literals, and any
// explicit function calls from a class.
preg_match_all('/(\[.*?\])|(\'.*?\')|(\\\\.*?\,)/', $params, $paramInput);

//clean up the input by trimming any extra commas
$tmpParameterArray = [];
foreach ($paramInput[0] as $params) {
$tmpParameterArray[] = trim($params, ",");
}

// put the array together as a string to be passed as args
$parameterArray = implode(",", $tmpParameterArray);
$parameterArray = $this->processPressKey($parameterArray);
}
$testSteps .= $this->wrapFunctionCall(
$actor,
Expand Down Expand Up @@ -1642,6 +1626,70 @@ private function addUniquenessToParamArray($input)
return implode(", ", $result);
}

/**
* Process pressKey parameterArray attribute for uniqueness function call and necessary data resolutions
*
* @param string $input
* @return string
*/
private function processPressKey($input)
{
// validate the param array is in the correct format
$input = trim($input);
$this->validateParameterArray($input);
// trim off the outer braces
$input = substr($input, 1, strlen($input) - 2);

$result = [];
$arrayResult = [];
$count = 0;

// matches all arrays and replaces them with placeholder to prevent later param manipulation
preg_match_all('/[\[][^\]]*?[\]]/', $input, $paramInput);
if (!empty($paramInput)) {
foreach ($paramInput[0] as $param) {
$arrayResult[self::PRESSKEY_ARRAY_ANCHOR_KEY . $count] =
'[' . trim($this->addUniquenessToParamArray($param)) . ']';
$input = str_replace($param, self::PRESSKEY_ARRAY_ANCHOR_KEY . $count, $input);
$count++;
}
}

$paramArray = explode(",", $input);
foreach ($paramArray as $param) {
// matches strings wrapped in ', we assume these are string literals
if (preg_match('/^[\s]*(\'.*?\')[\s]*$/', $param)) {
$result[] = trim($param);
continue;
}

// matches \ for Facebook WebDriverKeys classes
if (substr(trim($param), 0, 1) === '\\') {
$result[] = trim($param);
continue;
}

// matches numbers
if (preg_match('/^[\s]*(\d+?)[\s]*$/', $param)) {
$result[] = $param;
continue;
}

$replacement = $this->addUniquenessFunctionCall(trim($param));

$result[] = $replacement;
}

$result = implode(',', $result);
// reinsert arrays into result
if (!empty($arrayResult)) {
foreach ($arrayResult as $key => $value) {
$result = str_replace($key, $value, $result);
}
}
return $result;
}

/**
* Add uniqueness function call to input string based on regex pattern.
*
Expand Down