|
| 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="AdminCreateCartPriceRuleEmptyFromDateTest"> |
| 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 with no starting date"/> |
| 16 | + <description value="Admin should be able to create a cart price rule without specifying the from_date and it should be set with the current date"/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value="MC-5299"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + |
| 22 | + <before> |
| 23 | + <createData entity="_defaultCategory" stepKey="category"/> |
| 24 | + <createData entity="SimpleProduct" stepKey="product"> |
| 25 | + <requiredEntity createDataKey="category"/> |
| 26 | + </createData> |
| 27 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 28 | + </before> |
| 29 | + |
| 30 | + <after> |
| 31 | + <!-- Delete the cart price rule we made during the test --> |
| 32 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> |
| 33 | + <argument name="ruleName" value="{{_defaultCoupon.code}}"/> |
| 34 | + </actionGroup> |
| 35 | + <deleteData createDataKey="category" stepKey="deleteCategory"/> |
| 36 | + <deleteData createDataKey="product" stepKey="deleteProduct"/> |
| 37 | + <actionGroup ref="logout" stepKey="logout"/> |
| 38 | + </after> |
| 39 | + |
| 40 | + <!--Set timezone--> |
| 41 | + <!--Set timezone so we need compare with the same timezone used in "generateDate" action--> |
| 42 | + <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfig"/> |
| 43 | + <waitForPageLoad stepKey="waitForConfigPage"/> |
| 44 | + <wait stepKey="wait" time="10"/> |
| 45 | + <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSection"/> |
| 46 | + <grabValueFrom selector="{{LocaleOptionsSection.timezone}}" stepKey="originalTimezone"/> |
| 47 | + <selectOption selector="{{LocaleOptionsSection.timezone}}" userInput="America/Los_Angeles" stepKey="setTimezone"/> |
| 48 | + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig"/> |
| 49 | + |
| 50 | + <!-- Create a cart price rule based on a coupon code --> |
| 51 | + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> |
| 52 | + <waitForPageLoad stepKey="waitForPriceList"/> |
| 53 | + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> |
| 54 | + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/> |
| 55 | + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> |
| 56 | + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectCustomerGroup"/> |
| 57 | + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> |
| 58 | + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/> |
| 59 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> |
| 60 | + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> |
| 61 | + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="5" stepKey="fillDiscountAmount"/> |
| 62 | + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> |
| 63 | + |
| 64 | + <!-- Verify initial successful save --> |
| 65 | + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> |
| 66 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{_defaultCoupon.code}}" stepKey="filterByName"/> |
| 67 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> |
| 68 | + <see selector="{{AdminCartPriceRulesSection.nameColumns}}" userInput="{{_defaultCoupon.code}}" stepKey="seeRuleInResults"/> |
| 69 | + |
| 70 | + <!-- Verify further on the Rule's edit page --> |
| 71 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(_defaultCoupon.code)}}" stepKey="goToEditRule"/> |
| 72 | + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="seeRuleName"/> |
| 73 | + <seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="seeWebsites"/> |
| 74 | + <seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="seeCouponType"/> |
| 75 | + <seeInField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="seeCouponCode"/> |
| 76 | + <generateDate date="now" format="m/j/Y" timezone="America/Los_Angeles" stepKey="today"/> |
| 77 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="$today" stepKey="seeCorrectFromDate"/> |
| 78 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="" stepKey="seeEmptyToDate"/> |
| 79 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions2"/> |
| 80 | + <seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="seeActionType"/> |
| 81 | + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="5" stepKey="seeDiscountAmount"/> |
| 82 | + |
| 83 | + <!-- Spot check the storefront --> |
| 84 | + <amOnPage url="$$product.custom_attributes[url_key]$$.html" stepKey="goToProductPage"/> |
| 85 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 86 | + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> |
| 87 | + <waitForPageLoad stepKey="waitForAddToCart"/> |
| 88 | + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> |
| 89 | + <waitForPageLoad stepKey="waitForCartPage"/> |
| 90 | + <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyCoupon"> |
| 91 | + <argument name="coupon" value="_defaultCoupon"/> |
| 92 | + </actionGroup> |
| 93 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 94 | + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> |
| 95 | + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$5.00" stepKey="seeDiscountTotal"/> |
| 96 | + |
| 97 | + <!--Reset timezone--> |
| 98 | + <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfigReset"/> |
| 99 | + <waitForPageLoad stepKey="waitForConfigPageReset"/> |
| 100 | + <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSectionReset"/> |
| 101 | + <selectOption selector="{{LocaleOptionsSection.timezone}}" userInput="$originalTimezone" stepKey="resetTimezone"/> |
| 102 | + <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigReset"/> |
| 103 | + </test> |
| 104 | +</tests> |
0 commit comments