Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<?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="CartPriceRuleForBundleProductTest">
<annotations>
<features value="SalesRule"/>
<stories value="MAGETWO-28921 - Cart Price Rule for bundle products"/>
<title value="Checking Cart Price Rule for bundle products"/>
<description value="Checking Cart Price Rule for bundle products"/>
<severity value="BLOCKER"/>
<testCaseId value="MAGETWO-28921"/>
<group value="SalesRule"/>
</annotations>

<before>
<!--Create 4 simple products-->
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
<field key="price">5.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="simpleProduct2">
<field key="price">3.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="simpleProduct3">
<field key="price">7.00</field>
</createData>
<createData entity="SimpleProduct2" stepKey="simpleProduct4">
<field key="price">18.00</field>
</createData>

<!-- Create the bundle product based -->
<createData entity="ApiBundleProduct" stepKey="createBundleProduct" />
<createData entity="CheckboxOption" stepKey="createBundleOption1_1">
<requiredEntity createDataKey="createBundleProduct"/>
</createData>
<createData entity="CheckboxOption" stepKey="createBundleOption1_2">
<requiredEntity createDataKey="createBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_1"/>
<requiredEntity createDataKey="simpleProduct1"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_1"/>
<requiredEntity createDataKey="simpleProduct2"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct3">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_2"/>
<requiredEntity createDataKey="simpleProduct3"/>
</createData>
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct4">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="createBundleOption1_2"/>
<requiredEntity createDataKey="simpleProduct4"/>
</createData>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Make Attribute 'sku' accessible for Promo Rule Conditions -->
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="editSkuAttribute">
<argument name="ProductAttribute" value="sku" />
</actionGroup>
<actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeAttributePromoRule">
<argument name="option" value="1" />
</actionGroup>

<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<magentoCron groups="index" stepKey="reindexInvalidatedIndices" />
</before>

<after>
<!-- Delete created SalesRule -->
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="DeleteCartPriceRuleByName">
<argument name="ruleName" value="{{SimpleSalesRule.name}}"/>
</actionGroup>

<!-- Delete Bundle product and it's children -->
<deleteData createDataKey="createBundleProduct" stepKey="createBundleProduct" />
<deleteData createDataKey="simpleProduct1" stepKey="simpleProduct1" />
<deleteData createDataKey="simpleProduct2" stepKey="simpleProduct2" />
<deleteData createDataKey="simpleProduct3" stepKey="simpleProduct3" />
<deleteData createDataKey="simpleProduct4" stepKey="simpleProduct4" />

<!-- Revert Attribute 'sku' to it's default value (not accessible for Promo Rule Conditions) -->
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="editSkuAttribute">
<argument name="ProductAttribute" value="sku" />
</actionGroup>
<actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeAttributePromoRule">
<argument name="option" value="0" />
</actionGroup>

<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>

<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<magentoCron groups="index" stepKey="reindexInvalidatedIndices2" />
</after>

<!-- Create the rule -->
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
<waitForPageLoad stepKey="waitForRulesPage"/>
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/>
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="ScrollToApplyRuleForConditions"/>
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="ApplyRuleForConditions"/>
<waitForPageLoad stepKey="waitForDropDownOpened"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="SKU" stepKey="selectAttribute"/>
<waitForPageLoad stepKey="waitForOperatorOpened"/>
<click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseCondition"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.operator}}" userInput="is one of" stepKey="selectOperator"/>
<waitForPageLoad stepKey="waitForOperatorOpened1"/>
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption"/>
<waitForPageLoad stepKey="waitForConditionOpened2"/>
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="$$simpleProduct1.sku$$" stepKey="fillSkuToFilters"/>
<waitForPageLoad stepKey="waitForPageLoaded"/>
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>

<!-- Add the first product to the cart -->
<amOnPage url="$$createBundleProduct.sku$$.html" stepKey="goToProductPage1"/>
<waitForPageLoad stepKey="waitForProductPageLoad1"/>

<!--Click "Customize and Add to Cart" button-->
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/>

<!-- Select two products -->
<click stepKey="selectProduct1" selector="{{StorefrontBundledSection.productCheckbox('1','1')}}"/>
<click stepKey="selectProduct2" selector="{{StorefrontBundledSection.productCheckbox('2','1')}}"/>

<!--Click "Add to Cart" button-->
<click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddBundleProductToCart"/>
<waitForPageLoad time="30" stepKey="waitForAddBundleProductPageLoad"/>

<!--Click "mini cart" icon-->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
<waitForPageLoad stepKey="waitForDetailsOpen"/>

<!--Check all products and Cart Subtotal -->
<actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert" after="waitForDetailsOpen">
<argument name="subtotal" value="12.00"/>
<argument name="shipping" value="5.00"/>
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
<argument name="total" value="16.50"/>
</actionGroup>
</test>
</tests>