|
| 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 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminCartRulesAppliedForProductInCartTest"> |
| 12 | + <annotations> |
| 13 | + <features value="SalesRule"/> |
| 14 | + <stories value="The cart rule cannot effect the cart"/> |
| 15 | + <title value="Check that cart rules applied for product in cart"/> |
| 16 | + <description value="Check that cart rules applied for product in cart"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="MAGETWO-96722"/> |
| 19 | + <useCaseId value="MAGETWO-96410"/> |
| 20 | + <group value="SalesRule"/> |
| 21 | + </annotations> |
| 22 | + |
| 23 | + <before> |
| 24 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 25 | + |
| 26 | + <!--Create category and product--> |
| 27 | + <createData entity="_defaultCategory" stepKey="defaultCategory"/> |
| 28 | + <createData entity="SimpleProduct2" stepKey="simpleProduct"> |
| 29 | + <field key="price">200</field> |
| 30 | + <field key="quantity">500</field> |
| 31 | + </createData> |
| 32 | + </before> |
| 33 | + <after> |
| 34 | + <!--Delete created data--> |
| 35 | + <deleteData createDataKey="defaultCategory" stepKey="deleteCategory"/> |
| 36 | + <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> |
| 37 | + |
| 38 | + <actionGroup stepKey="deleteProduct1" ref="deleteProductBySku"> |
| 39 | + <argument name="sku" value="{{BundleProduct.sku}}"/> |
| 40 | + </actionGroup> |
| 41 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> |
| 42 | + <argument name="ruleName" value="{{PriceRuleWithCondition.name}}"/> |
| 43 | + </actionGroup> |
| 44 | + |
| 45 | + <actionGroup ref="logout" stepKey="logout"/> |
| 46 | + </after> |
| 47 | + |
| 48 | + <!--Start creating a bundle product--> |
| 49 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> |
| 50 | + <waitForPageLoad stepKey="waitForProductList"/> |
| 51 | + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct"> |
| 52 | + <argument name="product" value="BundleProduct"/> |
| 53 | + </actionGroup> |
| 54 | + <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillNameAndSku"> |
| 55 | + <argument name="product" value="BundleProduct"/> |
| 56 | + </actionGroup> |
| 57 | + <pressKey selector="{{AdminProductFormSection.productSku}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="enter"/> |
| 58 | + |
| 59 | + <!--Off dynamic price and set value--> |
| 60 | + <click selector="{{AdminProductFormBundleSection.dynamicPrice}}" stepKey="offDynamicPrice"/> |
| 61 | + <fillField selector="{{AdminProductFormBundleSection.priceField}}" userInput="0" stepKey="setProductPrice"/> |
| 62 | + |
| 63 | + <!-- Add category to product --> |
| 64 | + <click selector="{{AdminProductFormBundleSection.categoriesDropDown}}" stepKey="dropDownCategories"/> |
| 65 | + <fillField selector="{{AdminProductFormBundleSection.searchForCategory}}" userInput="$$defaultCategory.name$$" stepKey="searchForCategory"/> |
| 66 | + <click selector="{{AdminProductFormBundleSection.selectCategory}}" stepKey="selectCategory"/> |
| 67 | + <click selector="{{AdminProductFormBundleSection.categoriesLabel}}" stepKey="clickOnCategoriesLabelToCloseOptions"/> |
| 68 | + |
| 69 | + <!-- Add option, a "Radio Buttons" type option, with one product and set fixed price 200--> |
| 70 | + <actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOptionWithOneProduct"> |
| 71 | + <argument name="x" value="0"/> |
| 72 | + <argument name="n" value="1"/> |
| 73 | + <argument name="prodOneSku" value="$$simpleProduct.sku$$"/> |
| 74 | + <argument name="prodTwoSku" value=""/> |
| 75 | + <argument name="optionTitle" value="Option One"/> |
| 76 | + <argument name="inputType" value="radio"/> |
| 77 | + </actionGroup> |
| 78 | + <selectOption selector="{{AdminProductFormBundleSection.bundlePriceType}}" userInput="Fixed" stepKey="selectPriceType"/> |
| 79 | + <fillField selector="{{AdminProductFormBundleSection.bundlePriceValue}}" userInput="200" stepKey="fillPriceValue"/> |
| 80 | + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> |
| 81 | + |
| 82 | + <!--Create cart price rule--> |
| 83 | + <actionGroup ref="AdminCreateCartPriceRuleWithConditions" stepKey="createRule"> |
| 84 | + <argument name="ruleName" value="PriceRuleWithCondition"/> |
| 85 | + <argument name="condition1" value="Products subselection"/> |
| 86 | + <argument name="condition2" value="Category"/> |
| 87 | + <argument name="ruleToChange1" value="is"/> |
| 88 | + <argument name="rule1" value="equals or greater than"/> |
| 89 | + <argument name="ruleToChange2" value="..."/> |
| 90 | + <argument name="rule2" value="2"/> |
| 91 | + <argument name="categoryName" value="{{_defaultCategory.name}}"/> |
| 92 | + </actionGroup> |
| 93 | + |
| 94 | + <!--Go to Storefront and add product to cart and checkout from cart--> |
| 95 | + <amOnPage url="/$$simpleProduct.name$$.html" stepKey="GoToProduct"/> |
| 96 | + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="2" stepKey="setQuantity"/> |
| 97 | + <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard"> |
| 98 | + <argument name="productName" value="$$simpleProduct.name$$"/> |
| 99 | + </actionGroup> |
| 100 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 101 | + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"/> |
| 102 | + |
| 103 | + <!--Check totals--> |
| 104 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="grabSubtotal"/> |
| 105 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" stepKey="grabShippingTotal"/> |
| 106 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="grabTotal"/> |
| 107 | + <assertEquals stepKey="assertSubtotal"> |
| 108 | + <expectedResult type="string">$400.00</expectedResult> |
| 109 | + <actualResult type="variable">$grabSubtotal</actualResult> |
| 110 | + </assertEquals> |
| 111 | + <assertEquals stepKey="assertShippingTotal"> |
| 112 | + <expectedResult type="string">$10.00</expectedResult> |
| 113 | + <actualResult type="variable">$grabShippingTotal</actualResult> |
| 114 | + </assertEquals> |
| 115 | + <assertEquals stepKey="assertTotal"> |
| 116 | + <expectedResult type="string">$410.00</expectedResult> |
| 117 | + <actualResult type="variable">$grabTotal</actualResult> |
| 118 | + </assertEquals> |
| 119 | + </test> |
| 120 | +</tests> |
0 commit comments