|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="AdminVerifySubTotalRoundingForDecimalQuantityEnabledTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Decimal quantity product subtotal and order total validation"/> |
| 15 | + <title value="Verify subtotal and order total for decimal enabled product"/> |
| 16 | + <description value="Checks that subtotal and order total are correct for a product with decimal quantity and no rounding issues."/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-10575"/> |
| 19 | + <group value="catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!--Pre-condition 1: Create customer --> |
| 23 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 24 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> |
| 25 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 26 | + </actionGroup> |
| 27 | + <!-- Admin login --> |
| 28 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 29 | + <!--Step1: Set notify for quantity below = 0.5 in config --> |
| 30 | + <actionGroup ref="AdminNavigateToProductStockOptionsFeatureActionGroup" stepKey="navigateToProductStockOptions"/> |
| 31 | + <actionGroup ref="AdminInProductStockOptionsFeatureSetNotifyForQuantityBelowActionGroup" stepKey="setNotifyQtyBelow"> |
| 32 | + <argument name="quantityValue" value="0.5"/> |
| 33 | + </actionGroup> |
| 34 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/> |
| 35 | + <!-- Step 2: Create product with price 20.67 --> |
| 36 | + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> |
| 37 | + <field key="price">20.67</field> |
| 38 | + </createData> |
| 39 | + </before> |
| 40 | + <after> |
| 41 | + <!-- Logout from storefront --> |
| 42 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutStorefront"/> |
| 43 | + <!-- Delete customer,product --> |
| 44 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 45 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 46 | + <!-- Reset notify for quantity below --> |
| 47 | + <actionGroup ref="AdminNavigateToProductStockOptionsFeatureActionGroup" stepKey="navigateToProductStockOption"/> |
| 48 | + <actionGroup ref="AdminInProductStockOptionsFeatureResetNotifyForQuantityBelowActionGroup" stepKey="resetNotifyForQuantityBelow"/> |
| 49 | + <!-- Admin logout --> |
| 50 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> |
| 51 | + </after> |
| 52 | + <!-- Open Product page by id --> |
| 53 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage"> |
| 54 | + <argument name="productId" value="$$createSimpleProduct.id$$"/> |
| 55 | + </actionGroup> |
| 56 | + <!-- Step 2: Add quantity of product with 1.5 --> |
| 57 | + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="1.5" stepKey="seeProductQuantity"/> |
| 58 | + <!--Step 2: Open advanced inventory Section --> |
| 59 | + <actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/> |
| 60 | + <!-- Step 2: Set decimal quantity to yes --> |
| 61 | + <actionGroup ref="AdminSetQtyUsesDecimalsConfigActionGroup" stepKey="setQtyUsesDecimalsConfig"> |
| 62 | + <argument name="value" value="Yes"/> |
| 63 | + </actionGroup> |
| 64 | + <!-- Step 2: Set minimum allowed quantity as 0.5 --> |
| 65 | + <actionGroup ref="AdminSetMinAllowedQtyForProductActionGroup" stepKey="fillMiniAllowedQty"> |
| 66 | + <argument name="qty" value="0.5"/> |
| 67 | + </actionGroup> |
| 68 | + <!-- Step 2: Click on done button --> |
| 69 | + <actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickOnDoneButton"/> |
| 70 | + <!-- Step 2: Click on save button --> |
| 71 | + <actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/> |
| 72 | + <!-- Step 3: Navigate to product page on storefront --> |
| 73 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> |
| 74 | + <argument name="productUrl" value="$$createSimpleProduct.custom_attributes[url_key]$$"/> |
| 75 | + </actionGroup> |
| 76 | + <!-- Step 3: Add product to cart --> |
| 77 | + <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="addToCart"> |
| 78 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 79 | + </actionGroup> |
| 80 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="amOnPageShoppingCart"/> |
| 81 | + <!-- Step 3: Assert subtotal and grand total --> |
| 82 | + <waitForPageLoad stepKey="waitForPriceLoad"/> |
| 83 | + <waitForText selector="{{StorefrontProductPageSection.subTotal}}" userInput="$10.34" stepKey="seeSubTotal"/> |
| 84 | + <waitForText selector="{{StorefrontProductPageSection.orderTotal}}" userInput="$12.84" stepKey="seeOrderTotal"/> |
| 85 | + <!-- Step 4: Proceed to checkout, place order and verify order placed successfully --> |
| 86 | + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> |
| 87 | + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/> |
| 88 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToPaymentPage"/> |
| 89 | + <waitForPageLoad stepKey="waitForPaymentPageToLoad"/> |
| 90 | + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/> |
| 91 | + <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"> |
| 92 | + <argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/> |
| 93 | + <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> |
| 94 | + </actionGroup> |
| 95 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> |
| 96 | + <!-- Step 5: In admin check order details total in created order and verify no subtotal rounding issues for decimal enabled product --> |
| 97 | + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="addFilterToGridAndOpenOrder"> |
| 98 | + <argument name="entityId" value="{$grabOrderNumber}"/> |
| 99 | + </actionGroup> |
| 100 | + <actionGroup ref="AdminAssertTotalsOnOrderViewPageActionGroup" stepKey="checkSubtotal"> |
| 101 | + <argument name="subtotal" value="$10.34"/> |
| 102 | + <argument name="shippingAndHandling" value="$2.50"/> |
| 103 | + <argument name="grandTotal" value="$12.84"/> |
| 104 | + </actionGroup> |
| 105 | + </test> |
| 106 | +</tests> |
0 commit comments