|
| 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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminCreateCartPriceRuleForGeneratedCouponTest"> |
| 12 | + <annotations> |
| 13 | + <features value="SalesRule"/> |
| 14 | + <stories value="Create cart price rule"/> |
| 15 | + <title value="Admin should be able to create a cart price rule for auto generated coupon codes"/> |
| 16 | + <description value="Admin should be able to create a cart price rule for auto generated coupon codes"/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value="MC-75"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + |
| 22 | + <before> |
| 23 | + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> |
| 24 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 25 | + </before> |
| 26 | + |
| 27 | + <after> |
| 28 | + <!-- Delete the cart price rule we made during the test --> |
| 29 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> |
| 30 | + <argument name="ruleName" value="{{_defaultCoupon.code}}"/> |
| 31 | + </actionGroup> |
| 32 | + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> |
| 33 | + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> |
| 34 | + </after> |
| 35 | + |
| 36 | + <!-- Create a cart price rule --> |
| 37 | + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> |
| 38 | + <waitForPageLoad stepKey="waitForPriceList"/> |
| 39 | + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> |
| 40 | + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/> |
| 41 | + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> |
| 42 | + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> |
| 43 | + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> |
| 44 | + <checkOption selector="{{AdminCartPriceRulesFormSection.useAutoGeneration}}" stepKey="tickAutoGeneration"/> |
| 45 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> |
| 46 | + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> |
| 47 | + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="0.99" stepKey="fillDiscountAmount"/> |
| 48 | + <click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveAndContinueButton"/> |
| 49 | + |
| 50 | + <!-- Generate some coupon codes --> |
| 51 | + <click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSection"/> |
| 52 | + <fillField selector="{{AdminCartPriceRulesFormSection.couponQty}}" userInput="10" stepKey="fillCouponQty"/> |
| 53 | + <click selector="{{AdminCartPriceRulesFormSection.generateCouponsButton}}" stepKey="clickGenerate"/> |
| 54 | + <see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="10 coupon(s) have been generated." stepKey="seeGenerationSuccess"/> |
| 55 | + |
| 56 | + <!-- Grab a coupon code and hold on to it for later --> |
| 57 | + <grabTextFrom selector="{{AdminCartPriceRulesFormSection.generatedCouponByIndex('1')}}" stepKey="grabCouponCode"/> |
| 58 | + |
| 59 | + <!-- Create a product to check the storefront --> |
| 60 | + <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> |
| 61 | + <argument name="category" value="$$createPreReqCategory$$"/> |
| 62 | + <argument name="simpleProduct" value="_defaultProduct"/> |
| 63 | + </actionGroup> |
| 64 | + |
| 65 | + <!-- Spot check the storefront --> |
| 66 | + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/> |
| 67 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 68 | + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> |
| 69 | + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> |
| 70 | + <waitForPageLoad stepKey="waitForCartPage"/> |
| 71 | + <conditionalClick selector="{{StorefrontSalesRuleCartCouponSection.couponHeader}}" dependentSelector="{{StorefrontSalesRuleCartCouponSection.discountBlockActive}}" visible="false" stepKey="clickCouponHeader"/> |
| 72 | + <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField" /> |
| 73 | + <fillField selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" userInput="{$grabCouponCode}" stepKey="fillCouponField"/> |
| 74 | + <click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/> |
| 75 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 76 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> |
| 77 | + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$0.99" stepKey="seeDiscountTotal"/> |
| 78 | + </test> |
| 79 | +</tests> |
0 commit comments