Skip to content

Commit 7bd45ea

Browse files
committed
ACP2E-1514: Front-end re-order function applies same backend custom price
added mftf test
1 parent 101644d commit 7bd45ea

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

app/code/Magento/Sales/Test/Mftf/Section/OrdersGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<element name="setQuantity" type="checkbox" selector="//td[contains(., '{{arg}}')]/following-sibling::td[contains(@class, 'col-qty')]/input" parameterized="true"/>
2424
<element name="addProductsToOrder" type="button" selector="//span[text()='Add Selected Product(s) to Order']"/>
2525
<element name="customPrice" type="checkbox" selector="//span[.='{{arg}}']/parent::td/following-sibling::td/div//span[contains(text(),'Custom Price')]" parameterized="true"/>
26+
<element name="customPriceInput" type="input" selector="//span[.='{{arg}}']/parent::td/following-sibling::td/input[@class='input-text item-price admin__control-text']" parameterized="true"/>
2627
<element name="customQuantity" type="input" selector="//span[.='{{arg}}']/parent::td/following-sibling::td[@class='col-qty']/input" parameterized="true"/>
2728
<element name="update" type="button" selector="//span[text()='Update Items and Quantities']"/>
2829
<element name="discount" type="text" selector="//span[.='{{arg}}']/parent::td/following-sibling::td[@class='col-discount col-price']/span" parameterized="true"/>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontReorderAsCustomerCustomPrice">
11+
<annotations>
12+
<stories value="Reorder"/>
13+
<title value="Make reorder as customer on frontend"/>
14+
<description value="Make reorder with custom product price on frontend"/>
15+
<severity value="CRITICAL"/>
16+
<testCaseId value="AC-7712"/>
17+
<group value="sales"/>
18+
</annotations>
19+
<before>
20+
<!--Enable flat rate shipping-->
21+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}"
22+
stepKey="enableFlatRate"/>
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
25+
<field key="price">100.00</field>
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
29+
<!-- Create Customer Account -->
30+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
31+
</before>
32+
<after>
33+
<!-- Disable shipping method for customer with default address -->
34+
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="LogoutAsAdmin"/>
36+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
37+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
38+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
39+
</after>
40+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
41+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/>
42+
43+
<!--Create new order-->
44+
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="CreateNewOrder">
45+
<argument name="customer" value="Simple_US_Customer"/>
46+
</actionGroup>
47+
48+
<!--Click on "Add products by SKU" button > Type SKU > And add it to order without qty value-->
49+
<click selector="{{AdminOrderFormItemsOrderedSection.addProductsBySku}}" stepKey="clickAddProductsBySKUButton"/>
50+
<waitForElementVisible stepKey="waitForElementVisible" selector="{{AdminOrderFormItemsSection.skuNumber('0')}}"/>
51+
<fillField selector="{{AdminOrderFormItemsSection.skuNumber('0')}}" stepKey="typeCreatedProductGroupSKU" userInput="$$createSimpleProduct.sku$$"/>
52+
<fillField selector="{{AdminOrderFormItemsSection.qty('0')}}" stepKey="setOrderItemQuantity" userInput="1"/>
53+
<pressKey selector="{{AdminOrderFormItemsSection.skuNumber('0')}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" stepKey="pressKey"/>
54+
<waitForPageLoad stepKey="WaitForProductAdd"/>
55+
<waitForLoadingMaskToDisappear stepKey="wait1"/>
56+
57+
<!-- Set product custom price -->
58+
<click selector="{{OrdersGridSection.customPrice($$createSimpleProduct.name$$)}}" stepKey="ClickOnCustomPrice"/>
59+
<fillField selector="{{OrdersGridSection.customPriceInput($$createSimpleProduct.name$$)}}" userInput="10.00" stepKey="FillCustomPrice"/>
60+
<click selector="{{AdminOrderFormItemsSection.updateItemsAndQuantities}}" stepKey="clickUpdateItemsAndQuantities"/>
61+
<waitForPageLoad stepKey="waitForItemsAndQuantitesUpdating"/>
62+
63+
<!--Select FlatRate shipping method-->
64+
<actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/>
65+
66+
<!--Submit order-->
67+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/>
68+
<waitForPageLoad stepKey="WaitForOrderSubmit"/>
69+
70+
<!--Login customer on storefront-->
71+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
72+
<argument name="Customer" value="$$createCustomer$$" />
73+
</actionGroup>
74+
75+
<!-- Go to my Orders page -->
76+
<amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="onMyAccount"/>
77+
<waitForPageLoad stepKey="waitForAccountPage"/>
78+
<click selector="{{StorefrontCustomerSidebarSection.sidebarTab('My Orders')}}" stepKey="clickOnMyOrders"/>
79+
<waitForPageLoad stepKey="waitForOrdersLoad"/>
80+
81+
<!-- Clicking on Reorder link from Order Details Tab -->
82+
<click selector="{{StorefrontCustomerOrderViewSection.reorder}}" stepKey="clickReorder"/>
83+
84+
<!-- Validate product subtotal -->
85+
<actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssertCart">
86+
<argument name="subtotal" value="100.00"/>
87+
<argument name="shipping" value="5.00"/>
88+
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
89+
<argument name="total" value="105.00"/>
90+
</actionGroup>
91+
</test>
92+
</tests>

0 commit comments

Comments
 (0)