Skip to content

Commit 5ddabaf

Browse files
committed
Merge remote-tracking branch 'origin/MC-38113' into 2.4-develop-pr97
2 parents 32ed03c + 3b2ece2 commit 5ddabaf

File tree

6 files changed

+109
-4
lines changed

6 files changed

+109
-4
lines changed

app/code/Magento/Checkout/Test/Mftf/ActionGroup/LoggedInUserCheckoutFillingShippingSectionActionGroup.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/>
2525
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
2626
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
27-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
27+
<waitForPageLoad stepKey="waitForLoadingMask"/>
2828
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
29-
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
29+
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
30+
<waitForPageLoad stepKey="waitForShippingLoadingMask"/>
3031
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
31-
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
32+
<waitForElementVisible selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
3233
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
3334
</actionGroup>
3435
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontCustomerHasNoOtherAddressesActionGroup">
11+
<annotations>
12+
<description>Verifies customer has no additional address in address book</description>
13+
</annotations>
14+
<amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/>
15+
<waitForText userInput="You have no other address entries in your address book." selector=".block-addresses-list" stepKey="assertOtherAddresses"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,9 @@ public function initFromOrder(\Magento\Sales\Model\Order $order)
550550

551551
$quote = $this->getQuote();
552552
if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
553+
$quote->getBillingAddress()->setCustomerAddressId(
554+
$quote->getShippingAddress()->getCustomerAddressId()
555+
);
553556
$this->setShippingAsBilling(1);
554557
}
555558

@@ -2120,6 +2123,9 @@ private function isAddressesAreEqual(Order $order)
21202123
$billingData['address_type'],
21212124
$billingData['entity_id']
21222125
);
2126+
if (isset($shippingData['customer_address_id']) && !isset($billingData['customer_address_id'])) {
2127+
unset($shippingData['customer_address_id']);
2128+
}
21232129

21242130
return $shippingData == $billingData;
21252131
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminStartReorderFromOrderPageActionGroup">
11+
<annotations>
12+
<description>Reorder existing order. Requires admin order page to be opened.</description>
13+
</annotations>
14+
15+
<click selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="clickReorder"/>
16+
<waitForPageLoad stepKey="waitPageLoad"/>
17+
<waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForPageTitle"/>
18+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeCreateNewOrderPageTitle"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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="AdminReorderAddressNotSavedInAddressBookTest">
11+
<annotations>
12+
<features value="Sales"/>
13+
<stories value="Reorder"/>
14+
<title value="Same shipping address is not repeating multiple times in storefront checkout when Reordered"/>
15+
<description value="Same shipping address is not repeating multiple times in storefront checkout when Reordered"/>
16+
<testCaseId value="MC-38412"/>
17+
<useCaseId value="MC-38113"/>
18+
<severity value="MAJOR"/>
19+
<group value="sales"/>
20+
</annotations>
21+
<before>
22+
<createData entity="ApiCategory" stepKey="category"/>
23+
<createData entity="ApiSimpleProduct" stepKey="product">
24+
<requiredEntity createDataKey="category"/>
25+
</createData>
26+
<createData entity="Simple_Customer_Without_Address" stepKey="customer"/>
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
29+
<argument name="Customer" value="$customer$"/>
30+
</actionGroup>
31+
</before>
32+
<after>
33+
<deleteData createDataKey="product" stepKey="deleteProduct"/>
34+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
35+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
36+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
37+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
38+
</after>
39+
40+
<!-- Create order for registered customer -->
41+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToOrder">
42+
<argument name="product" value="$product$"/>
43+
</actionGroup>
44+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="openCheckoutPage"/>
45+
<actionGroup ref="LoggedInUserCheckoutFillingShippingSectionActionGroup" stepKey="fillAddressForm"/>
46+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
47+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
48+
49+
<!-- Reorder created order -->
50+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById">
51+
<argument name="orderId" value="{$grabOrderNumber}"/>
52+
</actionGroup>
53+
<actionGroup ref="AdminStartReorderFromOrderPageActionGroup" stepKey="startReorder"/>
54+
<actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/>
55+
56+
<!-- Assert no additional addresses saved -->
57+
<actionGroup ref="AssertStorefrontCustomerHasNoOtherAddressesActionGroup" stepKey="assertAddresses"/>
58+
</test>
59+
</tests>

app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ endif; ?>
114114
type="checkbox"
115115
id="<?= $block->escapeHtmlAttr($block->getForm()->getHtmlIdPrefix()) ?>save_in_address_book"
116116
value="1"
117-
<?php if (!$block->getDontSaveInAddressBook()): ?> checked="checked"<?php endif; ?>
117+
<?php if (!$block->getDontSaveInAddressBook() && !$block->getAddressId()): ?>
118+
checked="checked"
119+
<?php endif; ?>
118120
class="admin__control-checkbox"/>
119121
<label for="<?= $block->escapeHtmlAttr($block->getForm()->getHtmlIdPrefix()) ?>save_in_address_book"
120122
class="admin__field-label"><?= $block->escapeHtml(__('Save in address book')) ?></label>

0 commit comments

Comments
 (0)