|
| 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="CartPriceRuleForBundleProductTest"> |
| 11 | + <annotations> |
| 12 | + <features value="SalesRule"/> |
| 13 | + <stories value="MAGETWO-28921 - Cart Price Rule for bundle products"/> |
| 14 | + <title value="Checking Cart Price Rule for bundle products"/> |
| 15 | + <description value="Checking Cart Price Rule for bundle products"/> |
| 16 | + <severity value="BLOCKER"/> |
| 17 | + <testCaseId value="MAGETWO-28921"/> |
| 18 | + <group value="SalesRule"/> |
| 19 | + </annotations> |
| 20 | + |
| 21 | + <before> |
| 22 | + <!--Create 4 simple products--> |
| 23 | + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> |
| 24 | + <field key="price">5.00</field> |
| 25 | + </createData> |
| 26 | + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> |
| 27 | + <field key="price">3.00</field> |
| 28 | + </createData> |
| 29 | + <createData entity="SimpleProduct2" stepKey="simpleProduct3"> |
| 30 | + <field key="price">7.00</field> |
| 31 | + </createData> |
| 32 | + <createData entity="SimpleProduct2" stepKey="simpleProduct4"> |
| 33 | + <field key="price">18.00</field> |
| 34 | + </createData> |
| 35 | + |
| 36 | + <!-- Create the bundle product based --> |
| 37 | + <createData entity="ApiBundleProduct" stepKey="createBundleProduct" /> |
| 38 | + <createData entity="CheckboxOption" stepKey="createBundleOption1_1"> |
| 39 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 40 | + </createData> |
| 41 | + <createData entity="CheckboxOption" stepKey="createBundleOption1_2"> |
| 42 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 43 | + </createData> |
| 44 | + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct"> |
| 45 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 46 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 47 | + <requiredEntity createDataKey="simpleProduct1"/> |
| 48 | + </createData> |
| 49 | + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct2"> |
| 50 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 51 | + <requiredEntity createDataKey="createBundleOption1_1"/> |
| 52 | + <requiredEntity createDataKey="simpleProduct2"/> |
| 53 | + </createData> |
| 54 | + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct3"> |
| 55 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 56 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 57 | + <requiredEntity createDataKey="simpleProduct3"/> |
| 58 | + </createData> |
| 59 | + <createData entity="ApiBundleLink" stepKey="linkOptionToProduct4"> |
| 60 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 61 | + <requiredEntity createDataKey="createBundleOption1_2"/> |
| 62 | + <requiredEntity createDataKey="simpleProduct4"/> |
| 63 | + </createData> |
| 64 | + |
| 65 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 66 | + |
| 67 | + <!-- Make Attribute 'sku' accessible for Promo Rule Conditions --> |
| 68 | + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="editSkuAttribute"> |
| 69 | + <argument name="ProductAttribute" value="sku" /> |
| 70 | + </actionGroup> |
| 71 | + <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeAttributePromoRule"> |
| 72 | + <argument name="option" value="1" /> |
| 73 | + </actionGroup> |
| 74 | + |
| 75 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 76 | + <magentoCron groups="index" stepKey="reindexInvalidatedIndices" /> |
| 77 | + </before> |
| 78 | + |
| 79 | + <after> |
| 80 | + <!-- Delete created SalesRule --> |
| 81 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="DeleteCartPriceRuleByName"> |
| 82 | + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> |
| 83 | + </actionGroup> |
| 84 | + |
| 85 | + <!-- Delete Bundle product and it's children --> |
| 86 | + <deleteData createDataKey="createBundleProduct" stepKey="createBundleProduct" /> |
| 87 | + <deleteData createDataKey="simpleProduct1" stepKey="simpleProduct1" /> |
| 88 | + <deleteData createDataKey="simpleProduct2" stepKey="simpleProduct2" /> |
| 89 | + <deleteData createDataKey="simpleProduct3" stepKey="simpleProduct3" /> |
| 90 | + <deleteData createDataKey="simpleProduct4" stepKey="simpleProduct4" /> |
| 91 | + |
| 92 | + <!-- Revert Attribute 'sku' to it's default value (not accessible for Promo Rule Conditions) --> |
| 93 | + <actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="editSkuAttribute"> |
| 94 | + <argument name="ProductAttribute" value="sku" /> |
| 95 | + </actionGroup> |
| 96 | + <actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeAttributePromoRule"> |
| 97 | + <argument name="option" value="0" /> |
| 98 | + </actionGroup> |
| 99 | + |
| 100 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 101 | + |
| 102 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 103 | + <magentoCron groups="index" stepKey="reindexInvalidatedIndices2" /> |
| 104 | + </after> |
| 105 | + |
| 106 | + <!-- Create the rule --> |
| 107 | + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> |
| 108 | + <waitForPageLoad stepKey="waitForRulesPage"/> |
| 109 | + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> |
| 110 | + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> |
| 111 | + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> |
| 112 | + <actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/> |
| 113 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> |
| 114 | + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/> |
| 115 | + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="ScrollToApplyRuleForConditions"/> |
| 116 | + <click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="ApplyRuleForConditions"/> |
| 117 | + <waitForPageLoad stepKey="waitForDropDownOpened"/> |
| 118 | + <selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="SKU" stepKey="selectAttribute"/> |
| 119 | + <waitForPageLoad stepKey="waitForOperatorOpened"/> |
| 120 | + <click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseCondition"/> |
| 121 | + <selectOption selector="{{AdminCartPriceRulesFormSection.operator}}" userInput="is one of" stepKey="selectOperator"/> |
| 122 | + <waitForPageLoad stepKey="waitForOperatorOpened1"/> |
| 123 | + <click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption"/> |
| 124 | + <waitForPageLoad stepKey="waitForConditionOpened2"/> |
| 125 | + <fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="$$simpleProduct1.sku$$" stepKey="fillSkuToFilters"/> |
| 126 | + <waitForPageLoad stepKey="waitForPageLoaded"/> |
| 127 | + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> |
| 128 | + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> |
| 129 | + |
| 130 | + <!-- Add the first product to the cart --> |
| 131 | + <amOnPage url="$$createBundleProduct.sku$$.html" stepKey="goToProductPage1"/> |
| 132 | + <waitForPageLoad stepKey="waitForProductPageLoad1"/> |
| 133 | + |
| 134 | + <!--Click "Customize and Add to Cart" button--> |
| 135 | + <click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/> |
| 136 | + |
| 137 | + <!-- Select two products --> |
| 138 | + <click stepKey="selectProduct1" selector="{{StorefrontBundledSection.productCheckbox('1','1')}}"/> |
| 139 | + <click stepKey="selectProduct2" selector="{{StorefrontBundledSection.productCheckbox('2','1')}}"/> |
| 140 | + |
| 141 | + <!--Click "Add to Cart" button--> |
| 142 | + <click selector="{{StorefrontBundleProductActionSection.addToCartButton}}" stepKey="clickAddBundleProductToCart"/> |
| 143 | + <waitForPageLoad time="30" stepKey="waitForAddBundleProductPageLoad"/> |
| 144 | + |
| 145 | + <!--Click "mini cart" icon--> |
| 146 | + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/> |
| 147 | + <waitForPageLoad stepKey="waitForDetailsOpen"/> |
| 148 | + |
| 149 | + <!--Check all products and Cart Subtotal --> |
| 150 | + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert" after="waitForDetailsOpen"> |
| 151 | + <argument name="subtotal" value="12.00"/> |
| 152 | + <argument name="shipping" value="5.00"/> |
| 153 | + <argument name="shippingMethod" value="Flat Rate - Fixed"/> |
| 154 | + <argument name="total" value="16.50"/> |
| 155 | + </actionGroup> |
| 156 | + </test> |
| 157 | +</tests> |
0 commit comments