|
| 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="AdminCreateOrderWithLimitedNumberOfProductsInGridTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Sales"/> |
| 14 | + <stories value="Limit number of products in grid during order creation"/> |
| 15 | + <title value="Limit total number of products in grid collection during order creation"/> |
| 16 | + <description value="Verify that total number of products in grid collection can be limited during order creation"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="ACPT-706"/> |
| 19 | + <group value="Sales"/> |
| 20 | + </annotations> |
| 21 | + |
| 22 | + <before> |
| 23 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 24 | + <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> |
| 25 | + <magentoCLI stepKey="enableLimitNumberOfProductsInGrid" command="config:set admin/grid/limit_total_number_of_products 1"/> |
| 26 | + <magentoCLI stepKey="setCustomRecordsLimit" command="config:set admin/grid/records_limit 2"/> |
| 27 | + <createData entity="SimpleProduct" stepKey="createSimpleProduct1"/> |
| 28 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct2"/> |
| 29 | + <createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/> |
| 30 | + <createData entity="CashOnDeliveryPaymentMethodDefault" stepKey="cashOnDeliveryPaymentMethod"/> |
| 31 | + <createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/> |
| 32 | + </before> |
| 33 | + |
| 34 | + <after> |
| 35 | + <magentoCLI stepKey="disableLimitNumberOfProductsInGrid" command="config:set admin/grid/limit_total_number_of_products 0"/> |
| 36 | + <magentoCLI stepKey="setDefaultRecordsLimit" command="config:set admin/grid/records_limit 20000"/> |
| 37 | + <deleteData createDataKey="createSimpleProduct1" stepKey="deleteSimpleProduct1"/> |
| 38 | + <deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/> |
| 39 | + <magentoCLI command="config:set payment/cashondelivery/active 0" stepKey="disableCashOnDeliveryMethod"/> |
| 40 | + <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> |
| 41 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 42 | + </after> |
| 43 | + |
| 44 | + <!-- Start Order Creation --> |
| 45 | + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer"> |
| 46 | + <argument name="customer" value="$$simpleCustomer$$"/> |
| 47 | + </actionGroup> |
| 48 | + |
| 49 | + <!-- Click Add Products button to open products grid--> |
| 50 | + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts"/> |
| 51 | + |
| 52 | + <!-- Check that number of records and pagination is not displayed because number of products equal or greater than limit --> |
| 53 | + <dontSee userInput="2" selector="{{AdminOrderFormItemsSection.totalRecords}}" stepKey="dontSeeRecords"/> |
| 54 | + <dontSee userInput="1" selector="{{AdminOrderFormItemsSection.numberOfPages}}" stepKey="dontSeeCurrentPageFound"/> |
| 55 | + |
| 56 | + <!-- Search for the SimpleProduct1 using grid filter --> |
| 57 | + <fillField selector="{{AdminOrderFormItemsSection.skuFilter}}" userInput="{{SimpleProduct.sku}}" stepKey="fillSkuFilter"/> |
| 58 | + <click selector="{{AdminOrderFormItemsSection.search}}" stepKey="clickSearch"/> |
| 59 | + |
| 60 | + <!-- Check that 1 record found and pagination is displayed because number of filtered products is less than limit --> |
| 61 | + <see userInput="1" selector="{{AdminOrderFormItemsSection.totalRecords}}" stepKey="seeRecords"/> |
| 62 | + <see userInput="1" selector="{{AdminOrderFormItemsSection.numberOfPages}}" stepKey="SeeCurrentPageFound"/> |
| 63 | + |
| 64 | + <!-- Add SimpleProduct1 to the order --> |
| 65 | + <scrollTo selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" x="0" y="-100" stepKey="scrollToCheckColumn"/> |
| 66 | + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> |
| 67 | + <waitForPageLoad stepKey="waitForProductLoad"/> |
| 68 | + <fillField selector="{{AdminOrderFormItemsSection.rowQty('1')}}" userInput="{{SimpleProduct.quantity}}" stepKey="fillProductQty"/> |
| 69 | + <scrollTo selector="{{AdminOrderFormItemsSection.addSelected}}" x="0" y="-100" stepKey="scrollToAddSelectedButton"/> |
| 70 | + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> |
| 71 | + <waitForPageLoad stepKey="waitForOptionsToLoad"/> |
| 72 | + |
| 73 | + <!-- Select payment method, shipping method and place order --> |
| 74 | + <actionGroup ref="SelectCashOnDeliveryPaymentMethodActionGroup" stepKey="selectPaymentMethod"/> |
| 75 | + <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/> |
| 76 | + <actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/> |
| 77 | + <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> |
| 78 | + <comment userInput="BIC workaround" stepKey="getOrderId"/> |
| 79 | + <grabTextFrom selector="|Order # (\d+)|" stepKey="orderNumber"/> |
| 80 | + <grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="orderId"/> |
| 81 | + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> |
| 82 | + <argument name="entityId" value="{$orderId}"/> |
| 83 | + </actionGroup> |
| 84 | + |
| 85 | + <!-- Create a shipment for placed order --> |
| 86 | + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> |
| 87 | + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> |
| 88 | + |
| 89 | + <!-- Check that SimpleProduct1 has become out of stock after shipment --> |
| 90 | + <actionGroup ref="AssertAdminProductStockStatusActionGroup" stepKey="checkProductStockStatus"> |
| 91 | + <argument name="productId" value="$$createSimpleProduct1.id$$"/> |
| 92 | + <argument name="stockStatus" value="Out of Stock"/> |
| 93 | + </actionGroup> |
| 94 | + |
| 95 | + <!-- Increase records limit --> |
| 96 | + <magentoCLI stepKey="setCustomRecordsLimit" command="config:set admin/grid/records_limit 3"/> |
| 97 | + |
| 98 | + <!-- Start order creation again --> |
| 99 | + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer2"> |
| 100 | + <argument name="customer" value="$$simpleCustomer$$"/> |
| 101 | + </actionGroup> |
| 102 | + |
| 103 | + <!-- Click Add Products button to open products grid--> |
| 104 | + <click selector="{{AdminOrderFormItemsSection.addProducts}}" stepKey="clickAddProducts2"/> |
| 105 | + |
| 106 | + <!-- Check that 2 records found and pagination is displayed because number of products is less than limit --> |
| 107 | + <see userInput="2" selector="{{AdminOrderFormItemsSection.totalRecords}}" stepKey="seeRecords2"/> |
| 108 | + <see userInput="1" selector="{{AdminOrderFormItemsSection.numberOfPages}}" stepKey="SeeCurrentPageFound2"/> |
| 109 | + </test> |
| 110 | +</tests> |
0 commit comments