|
| 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="AdminOrderPlacementWithPaymentMethodConstraintsTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Sales"/> |
| 14 | + <stories value="Admin Order Management"/> |
| 15 | + <title value="Admin cannot handle order placement when payment methods are not available"/> |
| 16 | + <description value="Verify admin order creation behavior when payment methods are disabled or not available due to order total constraints"/> |
| 17 | + <severity value="MINOR"/> |
| 18 | + <testCaseId value="AC-13220"/> |
| 19 | + <group value="payment"/> |
| 20 | + <group value="sales"/> |
| 21 | + <group value="order_management"/> |
| 22 | + </annotations> |
| 23 | + <before> |
| 24 | + <!-- Precondition 1: Create product --> |
| 25 | + <createData entity="SimpleProduct_25" stepKey="simpleProduct"> |
| 26 | + <field key="price">10</field> |
| 27 | + </createData> |
| 28 | + <createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/> |
| 29 | + <!-- Step 1&2: Disable payment method one of "Check/Money Order" and "Zero Subtotal Checkout" --> |
| 30 | + <actionGroup ref="CliDisableCheckMoneyOrderPaymentMethodActionGroup" stepKey="disableCheckMoneyOrderValue"/> |
| 31 | + <magentoCLI command="config:set {{DisableZeroSubtotalCheckoutConfigData.path}} {{DisableZeroSubtotalCheckoutConfigData.value}}" stepKey="disabledZeroSubtotalCheckoutOrderValue"/> |
| 32 | + <!-- Step 3: Enable CashOnDelivery --> |
| 33 | + <createData entity="CashOnDeliveryPaymentMethodDefault" stepKey="enableCashOnDeliveryPaymentMethod"/> |
| 34 | + <!-- Step 4: Set the Maximum Order Total and Maximum Order Total CashOnDelivery --> |
| 35 | + <magentoCLI command="config:set {{cashOnDeliveryMaximumOrderTotalOrderPayment.path}} {{cashOnDeliveryMaximumOrderTotalOrderPayment.value}}" stepKey="cashOnDeliveryMaximumOrderTotalConfigData"/> |
| 36 | + <magentoCLI command="config:set {{cashOnDeliveryMinimumOrderTotalOrderPayment.path}} {{cashOnDeliveryMinimumOrderTotalOrderPayment.value}}" stepKey="cashOnDeliveryMinimumOrderTotalOrderPayment"/> |
| 37 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 38 | + </before> |
| 39 | + <after> |
| 40 | + <!-- Clean up created data --> |
| 41 | + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> |
| 42 | + <deleteData createDataKey="simpleCustomer" stepKey="deleteCustomer"/> |
| 43 | + <!-- Restore original payment method configurations --> |
| 44 | + <magentoCLI command="config:set {{EnableCheckMoneyOrderPaymentMethod.path}} {{EnableCheckMoneyOrderPaymentMethod.value}}" stepKey="enableCheckMoneyOrderPaymentMethod"/> |
| 45 | + <magentoCLI command="config:set {{disabledCashOnDeliveryPayment.label}} {{disabledCashOnDeliveryPayment.value}}" stepKey="restoreCOD"/> |
| 46 | + <!-- Clear cache and logout --> |
| 47 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> |
| 48 | + </after> |
| 49 | + <!-- Step 5: Create an new order from admin --> |
| 50 | + <actionGroup ref="AdminNavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> |
| 51 | + <argument name="customer" value="$$simpleCustomer$$"/> |
| 52 | + </actionGroup> |
| 53 | + <!-- Step 6: Add products to cart below 100$ and check COD available --> |
| 54 | + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder"> |
| 55 | + <argument name="product" value="$$simpleProduct$$"/> |
| 56 | + <argument name="productQty" value="1"/> |
| 57 | + </actionGroup> |
| 58 | + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.verifyCashOnDelivery}}" stepKey="verifyCashOnDeliveryPaymentMethodIsAvaiable"/> |
| 59 | + <!-- Step 7: Add more products or increase quantity more than 100$ and check COD is not available --> |
| 60 | + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductAgainByChangingQuantity"> |
| 61 | + <argument name="product" value="$$simpleProduct$$"/> |
| 62 | + <argument name="productQty" value="11"/> |
| 63 | + </actionGroup> |
| 64 | + <waitForElementNotVisible selector="{{AdminOrderFormPaymentSection.verifyCashOnDelivery}}" stepKey="verifyCashOnDeliveryPaymentMethodNotAvaiable"/> |
| 65 | + <!-- Step 8: Submit order when no payment methods visible and verify error message --> |
| 66 | + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> |
| 67 | + <actionGroup ref="AdminCheckoutSelectCheckMoneyOrderBillingMethodActionGroup" stepKey="selectBillingMethod"/> |
| 68 | + <actionGroup ref="AdminOrderClickSubmitOrderActionGroup" stepKey="submitOrder"/> |
| 69 | + <waitForText selector="{{AdminOrderFormPaymentSection.paymentErrorMessage}}" userInput="{{AdminPaymentErrorMessage.error_Message}}" stepKey="verifyOrderDonotPlacedAndSeeErrorMessage"/> |
| 70 | + </test> |
| 71 | +</tests> |
0 commit comments