Skip to content

Commit ef5be1d

Browse files
authored
MQE-1886: Ability to use grab data between ActionGroups (#755)
* MQE-1886: Ability to use grab data between ActionGroups * MQE-1886: Ability to use grab data between ActionGroups verification tests + other fixes * MQE-1886: Ability to use grab data between ActionGroups added functional test. * MQE-1886: Ability to use grab data between ActionGroups added functional test. Removed functional test for return.
1 parent b889251 commit ef5be1d

23 files changed

+623
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use \Codeception\Util\Locator;
6+
use Yandex\Allure\Adapter\Annotation\Features;
7+
use Yandex\Allure\Adapter\Annotation\Stories;
8+
use Yandex\Allure\Adapter\Annotation\Title;
9+
use Yandex\Allure\Adapter\Annotation\Description;
10+
use Yandex\Allure\Adapter\Annotation\Parameter;
11+
use Yandex\Allure\Adapter\Annotation\Severity;
12+
use Yandex\Allure\Adapter\Model\SeverityLevel;
13+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
14+
15+
/**
16+
* @group functional
17+
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupFunctionalTest/ActionGroupReturningValueTest.xml<br>")
18+
*/
19+
class ActionGroupReturningValueTestCest
20+
{
21+
/**
22+
* @param AcceptanceTester $I
23+
* @throws \Exception
24+
*/
25+
public function _before(AcceptanceTester $I)
26+
{
27+
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
28+
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
29+
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
30+
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
31+
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
32+
}
33+
34+
/**
35+
* @param AcceptanceTester $I
36+
* @throws \Exception
37+
*/
38+
public function _after(AcceptanceTester $I)
39+
{
40+
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
41+
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
42+
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
43+
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
44+
}
45+
46+
/**
47+
* @param AcceptanceTester $I
48+
* @throws \Exception
49+
*/
50+
public function _failed(AcceptanceTester $I)
51+
{
52+
$I->saveScreenshot(); // stepKey: saveScreenshot
53+
}
54+
55+
/**
56+
* @Severity(level = SeverityLevel::CRITICAL)
57+
* @Features({"TestModule"})
58+
* @Stories({"MQE-433"})
59+
* @Parameter(name = "AcceptanceTester", value="$I")
60+
* @param AcceptanceTester $I
61+
* @return void
62+
* @throws \Exception
63+
*/
64+
public function ActionGroupReturningValueTest(AcceptanceTester $I)
65+
{
66+
$I->amOnPage("/someUrl"); // stepKey: step1
67+
$I->comment("Entering Action Group [actionGroupWithReturnValue1] FunctionalActionGroupWithReturnValueActionGroup");
68+
$grabTextFrom1ActionGroupWithReturnValue1 = $I->grabTextFrom("#foo"); // stepKey: grabTextFrom1ActionGroupWithReturnValue1
69+
$actionGroupWithReturnValue1 = $I->return($grabTextFrom1ActionGroupWithReturnValue1); // stepKey: returnActionGroupWithReturnValue1
70+
$I->comment("Exiting Action Group [actionGroupWithReturnValue1] FunctionalActionGroupWithReturnValueActionGroup");
71+
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
72+
$I->see($actionGroupWithReturnValue1, "#element .{$actionGroupWithReturnValue1}"); // stepKey: see1ActionGroupWithStringUsage1
73+
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
74+
}
75+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use \Codeception\Util\Locator;
6+
use Yandex\Allure\Adapter\Annotation\Features;
7+
use Yandex\Allure\Adapter\Annotation\Stories;
8+
use Yandex\Allure\Adapter\Annotation\Title;
9+
use Yandex\Allure\Adapter\Annotation\Description;
10+
use Yandex\Allure\Adapter\Annotation\Parameter;
11+
use Yandex\Allure\Adapter\Annotation\Severity;
12+
use Yandex\Allure\Adapter\Model\SeverityLevel;
13+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
14+
15+
/**
16+
* @Title("[NO TESTCASEID]: Extended ActionGroup Returning Value Test")
17+
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupTest/ExtendedActionGroupReturningValueTest.xml<br>")
18+
*/
19+
class ExtendedActionGroupReturningValueTestCest
20+
{
21+
/**
22+
* @Severity(level = SeverityLevel::CRITICAL)
23+
* @Features({"TestModule"})
24+
* @Parameter(name = "AcceptanceTester", value="$I")
25+
* @param AcceptanceTester $I
26+
* @return void
27+
* @throws \Exception
28+
*/
29+
public function ExtendedActionGroupReturningValueTest(AcceptanceTester $I)
30+
{
31+
$I->comment("Entering Action Group [actionGroupReturningValue] ActionGroupReturningValueActionGroup");
32+
$grabProducts1ActionGroupReturningValue = $I->grabMultiple("selector"); // stepKey: grabProducts1ActionGroupReturningValue
33+
$I->assertCount(99, $grabProducts1ActionGroupReturningValue); // stepKey: assertCountActionGroupReturningValue
34+
$actionGroupReturningValue = $I->return($grabProducts1ActionGroupReturningValue); // stepKey: returnProducts1ActionGroupReturningValue
35+
$I->comment("Exiting Action Group [actionGroupReturningValue] ActionGroupReturningValueActionGroup");
36+
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
37+
$I->see($actionGroupReturningValue, "#element .{$actionGroupReturningValue}"); // stepKey: see1ActionGroupWithStringUsage1
38+
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use \Codeception\Util\Locator;
6+
use Yandex\Allure\Adapter\Annotation\Features;
7+
use Yandex\Allure\Adapter\Annotation\Stories;
8+
use Yandex\Allure\Adapter\Annotation\Title;
9+
use Yandex\Allure\Adapter\Annotation\Description;
10+
use Yandex\Allure\Adapter\Annotation\Parameter;
11+
use Yandex\Allure\Adapter\Annotation\Severity;
12+
use Yandex\Allure\Adapter\Model\SeverityLevel;
13+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
14+
15+
/**
16+
* @Title("[NO TESTCASEID]: Extended Child ActionGroup Returning Value Test")
17+
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupTest/ExtendedChildActionGroupReturningValueTest.xml<br>")
18+
*/
19+
class ExtendedChildActionGroupReturningValueTestCest
20+
{
21+
/**
22+
* @Severity(level = SeverityLevel::CRITICAL)
23+
* @Features({"TestModule"})
24+
* @Parameter(name = "AcceptanceTester", value="$I")
25+
* @param AcceptanceTester $I
26+
* @return void
27+
* @throws \Exception
28+
*/
29+
public function ExtendedChildActionGroupReturningValueTest(AcceptanceTester $I)
30+
{
31+
$I->comment("Entering Action Group [extendedActionGroupReturningValue] ExtendedActionGroupReturningValueActionGroup");
32+
$grabProducts1ExtendedActionGroupReturningValue = $I->grabMultiple("selector"); // stepKey: grabProducts1ExtendedActionGroupReturningValue
33+
$I->assertCount(99, $grabProducts1ExtendedActionGroupReturningValue); // stepKey: assertCountExtendedActionGroupReturningValue
34+
$extendedActionGroupReturningValue = $I->return($grabProducts1ExtendedActionGroupReturningValue); // stepKey: returnProducts1ExtendedActionGroupReturningValue
35+
$grabProducts2ExtendedActionGroupReturningValue = $I->grabMultiple("otherSelector"); // stepKey: grabProducts2ExtendedActionGroupReturningValue
36+
$I->assertCount(8000, $grabProducts2ExtendedActionGroupReturningValue); // stepKey: assertSecondCountExtendedActionGroupReturningValue
37+
$extendedActionGroupReturningValue = $I->return($grabProducts2ExtendedActionGroupReturningValue); // stepKey: returnProducts2ExtendedActionGroupReturningValue
38+
$I->comment("Exiting Action Group [extendedActionGroupReturningValue] ExtendedActionGroupReturningValueActionGroup");
39+
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
40+
$I->see($extendedActionGroupReturningValue, "#element .{$extendedActionGroupReturningValue}"); // stepKey: see1ActionGroupWithStringUsage1
41+
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use \Codeception\Util\Locator;
6+
use Yandex\Allure\Adapter\Annotation\Features;
7+
use Yandex\Allure\Adapter\Annotation\Stories;
8+
use Yandex\Allure\Adapter\Annotation\Title;
9+
use Yandex\Allure\Adapter\Annotation\Description;
10+
use Yandex\Allure\Adapter\Annotation\Parameter;
11+
use Yandex\Allure\Adapter\Annotation\Severity;
12+
use Yandex\Allure\Adapter\Model\SeverityLevel;
13+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
14+
15+
/**
16+
* @group functional
17+
* @Description("<h3>Test files</h3>verification/TestModule/Test/MergeFunctionalTest/MergedActionGroupReturningValueTest.xml<br>")
18+
*/
19+
class MergedActionGroupReturningValueTestCest
20+
{
21+
/**
22+
* @param AcceptanceTester $I
23+
* @throws \Exception
24+
*/
25+
public function _before(AcceptanceTester $I)
26+
{
27+
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
28+
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
29+
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
30+
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
31+
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
32+
}
33+
34+
/**
35+
* @param AcceptanceTester $I
36+
* @throws \Exception
37+
*/
38+
public function _after(AcceptanceTester $I)
39+
{
40+
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
41+
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
42+
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
43+
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
44+
}
45+
46+
/**
47+
* @param AcceptanceTester $I
48+
* @throws \Exception
49+
*/
50+
public function _failed(AcceptanceTester $I)
51+
{
52+
$I->saveScreenshot(); // stepKey: saveScreenshot
53+
}
54+
55+
/**
56+
* @Severity(level = SeverityLevel::CRITICAL)
57+
* @Features({"TestModule"})
58+
* @Stories({"MQE-433"})
59+
* @Parameter(name = "AcceptanceTester", value="$I")
60+
* @param AcceptanceTester $I
61+
* @return void
62+
* @throws \Exception
63+
*/
64+
public function MergedActionGroupReturningValueTest(AcceptanceTester $I)
65+
{
66+
$I->amOnPage("/someUrl"); // stepKey: step1
67+
$I->comment("Entering Action Group [actionGroupWithReturnValue1] MergeActionGroupReturningValueActionGroup");
68+
$I->amOnPage("/Jane/Dane.html"); // stepKey: amOnPage1ActionGroupWithReturnValue1
69+
$I->click(".merge .Jane"); // stepKey: myMergedClickActionGroupWithReturnValue1
70+
$grabMultiple1ActionGroupWithReturnValue1 = $I->grabMultiple("#foo"); // stepKey: grabMultiple1ActionGroupWithReturnValue1
71+
$actionGroupWithReturnValue1 = $I->return($grabMultiple1ActionGroupWithReturnValue1); // stepKey: returnValueActionGroupWithReturnValue1
72+
$I->comment("Exiting Action Group [actionGroupWithReturnValue1] MergeActionGroupReturningValueActionGroup");
73+
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
74+
$I->see($actionGroupWithReturnValue1, "#element .{$actionGroupWithReturnValue1}"); // stepKey: see1ActionGroupWithStringUsage1
75+
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
76+
}
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="ActionGroupReturningValueActionGroup">
11+
<arguments>
12+
<argument name="count" type="string"/>
13+
</arguments>
14+
<grabMultiple selector="selector" stepKey="grabProducts1"/>
15+
<assertCount stepKey="assertCount">
16+
<expectedResult type="int">{{count}}</expectedResult>
17+
<actualResult type="variable">grabProducts1</actualResult>
18+
</assertCount>
19+
<return value="{$grabProducts1}" stepKey="returnProducts1"/>
20+
</actionGroup>
21+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="ExtendedActionGroupReturningValueActionGroup" extends="ActionGroupReturningValueActionGroup">
11+
<arguments>
12+
<argument name="otherCount" type="string"/>
13+
</arguments>
14+
<grabMultiple selector="otherSelector" stepKey="grabProducts2"/>
15+
<assertCount stepKey="assertSecondCount">
16+
<expectedResult type="int">{{otherCount}}</expectedResult>
17+
<actualResult type="variable">grabProducts2</actualResult>
18+
</assertCount>
19+
<return value="{$grabProducts2}" stepKey="returnProducts2"/>
20+
</actionGroup>
21+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="FunctionalActionGroupWithReturnValueActionGroup">
11+
<grabTextFrom selector="#foo" stepKey="grabTextFrom1"/>
12+
<return value="{$grabTextFrom1}" stepKey="return"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="MergeActionGroupReturningValueActionGroup">
11+
<arguments>
12+
<argument name="myArg"/>
13+
</arguments>
14+
<fillField userInput="Please delete me" selector="#delete" stepKey="deleteMe"/>
15+
<amOnPage url="{{SamplePage.url(myArg.firstname,myArg.lastname)}}" stepKey="amOnPage1"/>
16+
<grabMultiple selector="#foo" stepKey="grabMultiple1"/>
17+
<return value="{$grabMultiple1}" stepKey="returnValue"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="MergeActionGroupReturningValueActionGroup">
11+
<click stepKey="myMergedClick" selector=".merge .{{myArg.firstname}}" after="amOnPage1"/>
12+
<remove keyForRemoval="deleteMe"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="ActionGroupReturningValueTest">
11+
<annotations>
12+
<severity value="CRITICAL"/>
13+
<group value="functional"/>
14+
<features value="Action Group Functional Cest"/>
15+
<stories value="MQE-433"/>
16+
</annotations>
17+
<before>
18+
<createData entity="ReplacementPerson" stepKey="createPersonParam"/>
19+
<actionGroup ref="FunctionalActionGroup" stepKey="beforeGroup"/>
20+
</before>
21+
<amOnPage url="/someUrl" stepKey="step1"/>
22+
<actionGroup ref="FunctionalActionGroupWithReturnValueActionGroup" stepKey="actionGroupWithReturnValue1"/>
23+
<actionGroup ref="actionGroupWithStringUsage" stepKey="actionGroupWithStringUsage1">
24+
<argument name="someArgument" value="{$actionGroupWithReturnValue1}"/>
25+
</actionGroup>
26+
<after>
27+
<actionGroup ref="FunctionalActionGroup" stepKey="afterGroup"/>
28+
</after>
29+
</test>
30+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="ExtendedActionGroupReturningValueTest">
11+
<annotations>
12+
<severity value="CRITICAL"/>
13+
<title value="Extended ActionGroup Returning Value Test"/>
14+
</annotations>
15+
<actionGroup ref="ActionGroupReturningValueActionGroup" stepKey="actionGroupReturningValue">
16+
<argument name="count" value="99"/>
17+
</actionGroup>
18+
<actionGroup ref="actionGroupWithStringUsage" stepKey="actionGroupWithStringUsage1">
19+
<argument name="someArgument" value="{$actionGroupReturningValue}"/>
20+
</actionGroup>
21+
</test>
22+
</tests>

0 commit comments

Comments
 (0)