Skip to content

Commit daf1e4c

Browse files
committed
MQE-2158: support using actions from multiple modules in Suites
1 parent 7b53949 commit daf1e4c

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

dev/tests/verification/Resources/functionalSuiteUsingSecretData.txt renamed to dev/tests/verification/Resources/ActionsInDifferentModulesSuite.txt

+17-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ use Codeception\Module;
2121
*
2222
* To use this group extension, include it to "extensions" option of global Codeception config.
2323
*/
24-
class functionalSuiteUsingSecretData extends \Codeception\GroupObject
24+
class ActionsInDifferentModulesSuite extends \Codeception\GroupObject
2525
{
26-
public static $group = 'functionalSuiteUsingSecretData';
26+
public static $group = 'ActionsInDifferentModulesSuite';
2727
private $testCount = 1;
2828
private $preconditionFailure = null;
2929
private $currentTestRun = 0;
30-
private static $HOOK_EXECUTION_INIT = "\n/******** Beginning execution of functionalSuiteUsingSecretData suite %s block ********/\n";
31-
private static $HOOK_EXECUTION_END = "\n/******** Execution of functionalSuiteUsingSecretData suite %s block complete ********/\n";
30+
private static $HOOK_EXECUTION_INIT = "\n/******** Beginning execution of ActionsInDifferentModulesSuite suite %s block ********/\n";
31+
private static $HOOK_EXECUTION_END = "\n/******** Execution of ActionsInDifferentModulesSuite suite %s block complete ********/\n";
3232
/** @var MagentoWebDriver */
3333
private $webDriver;
3434
/** @var ModuleContainer */
@@ -83,6 +83,11 @@ class functionalSuiteUsingSecretData extends \Codeception\GroupObject
8383
);
8484
$this->getModuleForAction("fillSecretField")->fillSecretField("#fill", $this->getModuleForAction("getSecret")->getSecret("magento/some/secret") . "+" . $this->getModuleForAction("getSecret")->getSecret("magento/some/secret")); // stepKey: fillBefore
8585
$this->getModuleForAction("click")->click(PersistedObjectHandler::getInstance()->retrieveEntityField('create2', 'key2', 'suite')); // stepKey: click
86+
print("Entering Action Group [return1] ActionGroupReturningValueActionGroup");
87+
$grabProducts1Return1 = $this->getModuleForAction("grabMultiple")->grabMultiple("selector"); // stepKey: grabProducts1Return1
88+
$this->getModuleForAction("assertCount")->assertCount(1, $grabProducts1Return1); // stepKey: assertCountReturn1
89+
$return1 = $this->getModuleForAction("return")->return($grabProducts1Return1); // stepKey: returnProducts1Return1
90+
print("Exiting Action Group [return1] ActionGroupReturningValueActionGroup");
8691
} catch (\Exception $exception) {
8792
$this->preconditionFailure = $exception->getMessage();
8893
}
@@ -133,6 +138,14 @@ class functionalSuiteUsingSecretData extends \Codeception\GroupObject
133138
} else {
134139
$this->webDriver->_initializeSession();
135140
}
141+
print("Entering Action Group [return2] ExtendedActionGroupReturningValueActionGroup");
142+
$grabProducts1Return2 = $this->getModuleForAction("grabMultiple")->grabMultiple("selector"); // stepKey: grabProducts1Return2
143+
$this->getModuleForAction("assertCount")->assertCount(1, $grabProducts1Return2); // stepKey: assertCountReturn2
144+
$return2 = $this->getModuleForAction("return")->return($grabProducts1Return2); // stepKey: returnProducts1Return2
145+
$grabProducts2Return2 = $this->getModuleForAction("grabMultiple")->grabMultiple("otherSelector"); // stepKey: grabProducts2Return2
146+
$this->getModuleForAction("assertCount")->assertCount(2, $grabProducts2Return2); // stepKey: assertSecondCountReturn2
147+
$return2 = $this->getModuleForAction("return")->return($grabProducts2Return2); // stepKey: returnProducts2Return2
148+
print("Exiting Action Group [return2] ExtendedActionGroupReturningValueActionGroup");
136149
PersistedObjectHandler::getInstance()->deleteEntity(
137150
"create1",
138151
"suite"

dev/tests/verification/TestModule/Suite/functionalSuiteUsingSecretData.xml renamed to dev/tests/verification/TestModule/Suite/ActionsInDifferentModulesSuite.xml

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
-->
88

99
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
10-
<suite name="functionalSuiteUsingSecretData">
10+
<suite name="ActionsInDifferentModulesSuite">
1111
<include>
12-
<test name="IncludeUsingSecretDataTest"/>
12+
<test name="IncludeActionsInDifferentModulesTest"/>
1313
</include>
1414
<before>
1515
<magentoCLI command="{{SecretData.key2}}" stepKey="cli"/>
@@ -23,8 +23,15 @@
2323
</createData>
2424
<fillField selector="#fill" userInput="{{SecretData.key2}}+{{SecretData.key2}}" stepKey="fillBefore"/>
2525
<click userInput="$create2.key2$" stepKey="click"/>
26+
<actionGroup ref="ActionGroupReturningValueActionGroup" stepKey="return1">
27+
<argument name="count" value="1"/>
28+
</actionGroup>
2629
</before>
2730
<after>
31+
<actionGroup ref="ExtendedActionGroupReturningValueActionGroup" stepKey="return2">
32+
<argument name="count" value="1"/>
33+
<argument name="otherCount" value="2"/>
34+
</actionGroup>
2835
<deleteData createDataKey="create1" stepKey="delete1"/>
2936
<deleteData createDataKey="create2" stepKey="delete2"/>
3037
<deleteData createDataKey="create3" stepKey="delete3"/>

dev/tests/verification/TestModule/Test/SampleSuiteTest/IncludeUsingSecretDataTest.xml renamed to dev/tests/verification/TestModule/Test/SampleSuiteTest/IncludeActionsInDifferentModulesTest.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="IncludeUsingSecretDataTest">
10+
<test name="IncludeActionsInDifferentModulesTest">
1111
<createData entity="SecretData" stepKey="create">
1212
<field key="someKey">dataHere</field>
1313
</createData>
1414
<fillField selector="#fill" userInput="{{SecretData.key2}}+$create.key2$" stepKey="fill"/>
1515
<magentoCLI command="create.key2$" stepKey="cli"/>
16+
<actionGroup ref="ActionGroupReturningValueActionGroup" stepKey="return">
17+
<argument name="count" value="3"/>
18+
</actionGroup>
1619
</test>
1720
</tests>

dev/tests/verification/Tests/SuiteGenerationTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,14 @@ public function testSuiteCommentsGeneration()
389389
}
390390

391391
/**
392-
* Test hook groups generated during suite generation
392+
* Test suite generation with actions from different modules
393393
*/
394-
public function testSuiteGenerationCreds()
394+
public function testSuiteGenerationActionsInDifferentModules()
395395
{
396-
$groupName = 'functionalSuiteUsingSecretData';
396+
$groupName = 'ActionsInDifferentModulesSuite';
397397

398398
$expectedContents = [
399-
'IncludeUsingSecretDataTestCest.php'
399+
'IncludeActionsInDifferentModulesTestCest.php'
400400
];
401401

402402
// Generate the Suite

0 commit comments

Comments
 (0)