Skip to content

MQE-1234 & MQE-659: StepKey in test result output and native XML comments #362

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 18 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c5b651b
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 5, 2019
eb87ccf
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 5, 2019
8aee6af
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 6, 2019
17b8b9d
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 6, 2019
9c7bf5f
MQE-1234: Allow XML Parser to read XML comment into comment action
okolesnyk Jun 7, 2019
4074560
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 7, 2019
5a52151
Merge branch 'MQE-659-alex-edition' of github.com:magento/magento2-fu…
okolesnyk Jun 7, 2019
9e19969
MQE-659: [ALLURE] Include the test "stepKey" in the MFTF Allure Report
okolesnyk Jun 7, 2019
45ceeda
Merge branch 'MQE-659-alex-edition' of github.com:magento/magento2-fu…
okolesnyk Jun 7, 2019
b8f7667
MQE-1234: Allow XML Parser to read XML comment into comment action
okolesnyk Jun 7, 2019
839c742
Merge branch 'develop' into MQE-1234-alex-edition
okolesnyk Jun 7, 2019
9e44d05
MQE-1234: Allow XML Parser to read XML comment into comment action
okolesnyk Jun 10, 2019
20ae1d7
Merge branch 'MQE-1234-alex-edition' of github.com:magento/magento2-f…
okolesnyk Jun 10, 2019
f6eb3ab
MQE-1234: Allow XML Parser to read XML comment into comment action
KevinBKozan Jun 11, 2019
daf51e0
MQE-1234: Allow XML Parser to read XML comment into comment action
okolesnyk Jun 12, 2019
c116bdb
Merge branch 'develop' into MQE-1234-alex-edition
KevinBKozan Jun 13, 2019
ced1533
Merge branch 'develop' into MQE-1234-alex-edition
KevinBKozan Jun 14, 2019
bafc0c9
Merge branch 'develop' into MQE-1234-alex-edition
KevinBKozan Jun 17, 2019
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
3 changes: 1 addition & 2 deletions dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xsi:noNamespaceSchemaLocation="../../../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="DevDocsTest">
<annotations>
<!-- Hwello -->
<!-- Comment in Annotations for DevDocs Test are not affecting test generation -->
<features value="DevDocs available"/>
<stories value="MFTF DevDocs available"/>
<title value="Magento Functional Testing Framework Documentation is available."/>
Expand All @@ -21,7 +21,6 @@

<!-- Open MFTF DevDocs Page -->
<amOnPage stepKey="openMFTFDevDocPage" url="{{MFTFDocPage.url}}" />
<!--< > & $abc " abc ' <click stepKey="click" userInput="$$createDataHook.firstname$$" selector="#id">/-->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="asdf" />
<see stepKey="verifyPageIntroText" selector="{{contentSection.pageIntro}}" userInput="Introduction to the Magento Functional Testing Framework" />
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ActionGroupWithDefaultArgumentAndStringSelectorParamCest
public function ActionGroupWithDefaultArgumentAndStringSelectorParam(AcceptanceTester $I)
{
$I->comment("Entering Action Group [actionGroup] actionGroupWithDefaultArgumentAndStringSelectorParam");
$I->comment("< > & \$abc \" abc ' <click stepKey=\"click\" userInput=\"\$\$createDataHook.firstname\$\$\" selector=\"#id\">/");
$I->see("John", "#element .test1"); // stepKey: seeFirstNameActionGroup
$I->comment("Exiting Action Group [actionGroup] actionGroupWithDefaultArgumentAndStringSelectorParam");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ActionGroupWithPassedArgumentAndStringSelectorParamCest
public function ActionGroupWithPassedArgumentAndStringSelectorParam(AcceptanceTester $I)
{
$I->comment("Entering Action Group [actionGroup] actionGroupWithDefaultArgumentAndStringSelectorParam");
$I->comment("< > & \$abc \" abc ' <click stepKey=\"click\" userInput=\"\$\$createDataHook.firstname\$\$\" selector=\"#id\">/");
$I->see("John" . msq("UniquePerson"), "#element .test1"); // stepKey: seeFirstNameActionGroup
$I->comment("Exiting Action Group [actionGroup] actionGroupWithDefaultArgumentAndStringSelectorParam");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

<actionGroup name="actionGroupWithDefaultArgumentAndStringSelectorParam">
<arguments>
<!-- Comments in arguments are not affecting test generation -->
<!-- <argument name="someArgument" defaultValue="ReplacementPerson" /> -->
<argument name="someArgument" defaultValue="ReplacementPerson" />
</arguments>

<!--< > & $abc " abc ' <click stepKey="click" userInput="$$createDataHook.firstname$$" selector="#id">/-->
<see selector="{{SampleSection.oneParamElement('test1')}}" userInput="{{someArgument.firstname}}" stepKey="seeFirstName" />
</actionGroup>

Expand Down
3 changes: 3 additions & 0 deletions dev/tests/verification/TestModule/Test/ActionGroupTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
<actionGroup ref="actionGroupWithoutArguments" stepKey="actionGroup"/>
</test>

<!--< > & $abc " abc ' <click stepKey="click" userInput="$$createDataHook.firstname$$" selector="#id">/-->
<test name="ActionGroupWithDefaultArgumentAndStringSelectorParam">
<annotations>
<!-- Comments in Test annotations are not affecting test generation -->
<!-- <severity value="BLOCKER"/> -->
<severity value="BLOCKER"/>
<title value="Action Group With Default Argument Value and Hardcoded Value in Param"/>
</annotations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function convertXml(\DOMNode $source, $basePath = '')
$value = $node->nodeValue;
break;
} elseif ($node->nodeType == XML_COMMENT_NODE) {
$uniqid = uniqid(str_replace("#", "", $node->nodeName));
$uniqid = uniqid($node->nodeName);
$value[$uniqid] = [
'value' => trim($node->nodeValue),
'nodeName' => $node->nodeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Magento\FunctionalTestingFramework\Data\Argument\Interpreter\Argument;
use Magento\FunctionalTestingFramework\Exceptions\XmlException;
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
use Magento\FunctionalTestingFramework\Test\Objects\ArgumentObject;

/**
Expand Down Expand Up @@ -117,6 +118,10 @@ private function extractArguments($arguments)
self::NODE_NAME
);

$argData = array_filter($argData, function ($key) {
return strpos($key, ActionObject::COMMENT_ACTION) === false;
}, ARRAY_FILTER_USE_KEY);

foreach ($argData as $argName => $argValue) {
$parsedArguments[] = new ArgumentObject(
$argValue[ArgumentObject::ARGUMENT_NAME],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ public function extractActions($testActions, $testName = null)
$stepKeyRefs = [];

foreach ($testActions as $actionName => $actionData) {
// Removing # from nodeName to match stepKey requirements
$stepKey = strpos($actionData[self::NODE_NAME], ActionObject::COMMENT_ACTION) === false
? $actionData[self::TEST_STEP_MERGE_KEY]
: $actionName;
: str_replace("#", "", $actionName);
$actionType = $actionData[self::NODE_NAME];

if (empty($stepKey)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
$testSteps .= $this->wrapFunctionCall($actor, $actionObject, $customActionAttributes['state']);
break;
case "comment":
// Combining userInput from native XML comment and <comment /> action and fall-through 'default' case.
$input = $input === null ? strtr($value, ['$' => '\$', '{' => '\{', '}' => '\}']) : $input;
default:
$testSteps .= $this->wrapFunctionCall(
Expand Down