Skip to content

MQE-1886: Ability to use grab data between ActionGroups #755

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 5 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 75 additions & 0 deletions dev/tests/verification/Resources/ActionGroupReturningValueTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @group functional
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupFunctionalTest/ActionGroupReturningValueTest.xml<br>")
*/
class ActionGroupReturningValueTestCest
{
/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _before(AcceptanceTester $I)
{
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _after(AcceptanceTester $I)
{
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _failed(AcceptanceTester $I)
{
$I->saveScreenshot(); // stepKey: saveScreenshot
}

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ActionGroupReturningValueTest(AcceptanceTester $I)
{
$I->amOnPage("/someUrl"); // stepKey: step1
$I->comment("Entering Action Group [actionGroupWithReturnValue1] FunctionalActionGroupWithReturnValueActionGroup");
$grabTextFrom1ActionGroupWithReturnValue1 = $I->grabTextFrom("#foo"); // stepKey: grabTextFrom1ActionGroupWithReturnValue1
$actionGroupWithReturnValue1 = $I->return($grabTextFrom1ActionGroupWithReturnValue1); // stepKey: returnActionGroupWithReturnValue1
$I->comment("Exiting Action Group [actionGroupWithReturnValue1] FunctionalActionGroupWithReturnValueActionGroup");
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
$I->see($actionGroupWithReturnValue1, "#element .{$actionGroupWithReturnValue1}"); // stepKey: see1ActionGroupWithStringUsage1
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @Title("[NO TESTCASEID]: Extended ActionGroup Returning Value Test")
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupTest/ExtendedActionGroupReturningValueTest.xml<br>")
*/
class ExtendedActionGroupReturningValueTestCest
{
/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ExtendedActionGroupReturningValueTest(AcceptanceTester $I)
{
$I->comment("Entering Action Group [actionGroupReturningValue] ActionGroupReturningValueActionGroup");
$grabProducts1ActionGroupReturningValue = $I->grabMultiple("selector"); // stepKey: grabProducts1ActionGroupReturningValue
$I->assertCount(99, $grabProducts1ActionGroupReturningValue); // stepKey: assertCountActionGroupReturningValue
$actionGroupReturningValue = $I->return($grabProducts1ActionGroupReturningValue); // stepKey: returnProducts1ActionGroupReturningValue
$I->comment("Exiting Action Group [actionGroupReturningValue] ActionGroupReturningValueActionGroup");
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
$I->see($actionGroupReturningValue, "#element .{$actionGroupReturningValue}"); // stepKey: see1ActionGroupWithStringUsage1
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @Title("[NO TESTCASEID]: Extended Child ActionGroup Returning Value Test")
* @Description("<h3>Test files</h3>verification/TestModule/Test/ActionGroupTest/ExtendedChildActionGroupReturningValueTest.xml<br>")
*/
class ExtendedChildActionGroupReturningValueTestCest
{
/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function ExtendedChildActionGroupReturningValueTest(AcceptanceTester $I)
{
$I->comment("Entering Action Group [extendedActionGroupReturningValue] ExtendedActionGroupReturningValueActionGroup");
$grabProducts1ExtendedActionGroupReturningValue = $I->grabMultiple("selector"); // stepKey: grabProducts1ExtendedActionGroupReturningValue
$I->assertCount(99, $grabProducts1ExtendedActionGroupReturningValue); // stepKey: assertCountExtendedActionGroupReturningValue
$extendedActionGroupReturningValue = $I->return($grabProducts1ExtendedActionGroupReturningValue); // stepKey: returnProducts1ExtendedActionGroupReturningValue
$grabProducts2ExtendedActionGroupReturningValue = $I->grabMultiple("otherSelector"); // stepKey: grabProducts2ExtendedActionGroupReturningValue
$I->assertCount(8000, $grabProducts2ExtendedActionGroupReturningValue); // stepKey: assertSecondCountExtendedActionGroupReturningValue
$extendedActionGroupReturningValue = $I->return($grabProducts2ExtendedActionGroupReturningValue); // stepKey: returnProducts2ExtendedActionGroupReturningValue
$I->comment("Exiting Action Group [extendedActionGroupReturningValue] ExtendedActionGroupReturningValueActionGroup");
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
$I->see($extendedActionGroupReturningValue, "#element .{$extendedActionGroupReturningValue}"); // stepKey: see1ActionGroupWithStringUsage1
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
namespace Magento\AcceptanceTest\_default\Backend;

use Magento\FunctionalTestingFramework\AcceptanceTester;
use \Codeception\Util\Locator;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @group functional
* @Description("<h3>Test files</h3>verification/TestModule/Test/MergeFunctionalTest/MergedActionGroupReturningValueTest.xml<br>")
*/
class MergedActionGroupReturningValueTestCest
{
/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _before(AcceptanceTester $I)
{
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _after(AcceptanceTester $I)
{
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
}

/**
* @param AcceptanceTester $I
* @throws \Exception
*/
public function _failed(AcceptanceTester $I)
{
$I->saveScreenshot(); // stepKey: saveScreenshot
}

/**
* @Severity(level = SeverityLevel::CRITICAL)
* @Features({"TestModule"})
* @Stories({"MQE-433"})
* @Parameter(name = "AcceptanceTester", value="$I")
* @param AcceptanceTester $I
* @return void
* @throws \Exception
*/
public function MergedActionGroupReturningValueTest(AcceptanceTester $I)
{
$I->amOnPage("/someUrl"); // stepKey: step1
$I->comment("Entering Action Group [actionGroupWithReturnValue1] MergeActionGroupReturningValueActionGroup");
$I->amOnPage("/Jane/Dane.html"); // stepKey: amOnPage1ActionGroupWithReturnValue1
$I->click(".merge .Jane"); // stepKey: myMergedClickActionGroupWithReturnValue1
$grabMultiple1ActionGroupWithReturnValue1 = $I->grabMultiple("#foo"); // stepKey: grabMultiple1ActionGroupWithReturnValue1
$actionGroupWithReturnValue1 = $I->return($grabMultiple1ActionGroupWithReturnValue1); // stepKey: returnValueActionGroupWithReturnValue1
$I->comment("Exiting Action Group [actionGroupWithReturnValue1] MergeActionGroupReturningValueActionGroup");
$I->comment("Entering Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
$I->see($actionGroupWithReturnValue1, "#element .{$actionGroupWithReturnValue1}"); // stepKey: see1ActionGroupWithStringUsage1
$I->comment("Exiting Action Group [actionGroupWithStringUsage1] actionGroupWithStringUsage");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="ActionGroupReturningValueActionGroup">
<arguments>
<argument name="count" type="string"/>
</arguments>
<grabMultiple selector="selector" stepKey="grabProducts1"/>
<assertCount stepKey="assertCount">
<expectedResult type="int">{{count}}</expectedResult>
<actualResult type="variable">grabProducts1</actualResult>
</assertCount>
<return value="{$grabProducts1}" stepKey="returnProducts1"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="ExtendedActionGroupReturningValueActionGroup" extends="ActionGroupReturningValueActionGroup">
<arguments>
<argument name="otherCount" type="string"/>
</arguments>
<grabMultiple selector="otherSelector" stepKey="grabProducts2"/>
<assertCount stepKey="assertSecondCount">
<expectedResult type="int">{{otherCount}}</expectedResult>
<actualResult type="variable">grabProducts2</actualResult>
</assertCount>
<return value="{$grabProducts2}" stepKey="returnProducts2"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="FunctionalActionGroupWithReturnValueActionGroup">
<grabTextFrom selector="#foo" stepKey="grabTextFrom1"/>
<return value="{$grabTextFrom1}" stepKey="return"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="MergeActionGroupReturningValueActionGroup">
<arguments>
<argument name="myArg"/>
</arguments>
<fillField userInput="Please delete me" selector="#delete" stepKey="deleteMe"/>
<amOnPage url="{{SamplePage.url(myArg.firstname,myArg.lastname)}}" stepKey="amOnPage1"/>
<grabMultiple selector="#foo" stepKey="grabMultiple1"/>
<return value="{$grabMultiple1}" stepKey="returnValue"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="MergeActionGroupReturningValueActionGroup">
<click stepKey="myMergedClick" selector=".merge .{{myArg.firstname}}" after="amOnPage1"/>
<remove keyForRemoval="deleteMe"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="ActionGroupReturningValueTest">
<annotations>
<severity value="CRITICAL"/>
<group value="functional"/>
<features value="Action Group Functional Cest"/>
<stories value="MQE-433"/>
</annotations>
<before>
<createData entity="ReplacementPerson" stepKey="createPersonParam"/>
<actionGroup ref="FunctionalActionGroup" stepKey="beforeGroup"/>
</before>
<amOnPage url="/someUrl" stepKey="step1"/>
<actionGroup ref="FunctionalActionGroupWithReturnValueActionGroup" stepKey="actionGroupWithReturnValue1"/>
<actionGroup ref="actionGroupWithStringUsage" stepKey="actionGroupWithStringUsage1">
<argument name="someArgument" value="{$actionGroupWithReturnValue1}"/>
</actionGroup>
<after>
<actionGroup ref="FunctionalActionGroup" stepKey="afterGroup"/>
</after>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="ExtendedActionGroupReturningValueTest">
<annotations>
<severity value="CRITICAL"/>
<title value="Extended ActionGroup Returning Value Test"/>
</annotations>
<actionGroup ref="ActionGroupReturningValueActionGroup" stepKey="actionGroupReturningValue">
<argument name="count" value="99"/>
</actionGroup>
<actionGroup ref="actionGroupWithStringUsage" stepKey="actionGroupWithStringUsage1">
<argument name="someArgument" value="{$actionGroupReturningValue}"/>
</actionGroup>
</test>
</tests>
Loading