Skip to content

Commit b4e13f8

Browse files
authored
ENGCOM-8025: Issue 25595 - multiple address virtual product error at checkout fixe… #29269
2 parents 16febba + 7036834 commit b4e13f8

File tree

8 files changed

+118
-2
lines changed

8 files changed

+118
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertCheckoutErrorMessageActionGroup">
12+
<arguments>
13+
<argument name="message" type="string"/>
14+
</arguments>
15+
16+
<waitForElementVisible selector="{{CheckoutCartMessageSection.errorMessageText(message)}}" stepKey="assertErrorMessage"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="successMessage" type="text" selector=".message.message-success.success>div" />
1313
<element name="errorMessage" type="text" selector=".message-error.error.message>div" />
1414
<element name="emptyCartMessage" type="text" selector=".cart-empty>p"/>
15+
<element name="errorMessageText" type="text" selector="//div[contains(@class, 'message-error')]/div[text()='{{var}}']" parameterized="true"/>
1516
</section>
1617
</sections>

app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
695695
);
696696

697697
$shippingMethodCode = $address->getShippingMethod();
698-
if (isset($shippingMethodCode) && !empty($shippingMethodCode)) {
698+
if ($shippingMethodCode) {
699699
$rate = $address->getShippingRateByCode($shippingMethodCode);
700700
$shippingPrice = $rate->getPrice();
701701
} else {
@@ -975,7 +975,8 @@ public function getMinimumAmountError()
975975
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
976976
);
977977
}
978-
return $error;
978+
979+
return __($error);
979980
}
980981

981982
/**
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontRemoveProductOnCheckoutActionGroup">
12+
<arguments>
13+
<argument name="itemNumber" type="string" defaultValue="1"/>
14+
</arguments>
15+
16+
<click selector="{{MultishippingSection.removeItemButton(itemNumber)}}" stepKey="removeItem"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/MultishippingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="shippingAddressSelector" type="select" selector="//tr[position()={{addressPosition}}]//td[@data-th='Send To']//select" parameterized="true"/>
1515
<element name="shippingAddressOptions" type="select" selector="#multiship-addresses-table tbody tr:nth-of-type({{addressPosition}}) .col.address select option:nth-of-type({{optionIndex}})" parameterized="true"/>
1616
<element name="selectShippingAddress" type="select" selector="(//table[@id='multiship-addresses-table'] //div[@class='field address'] //select)[{{sequenceNumber}}]" parameterized="true"/>
17+
<element name="removeItemButton" type="button" selector="//a[contains(@title, 'Remove Item')][{{var}}]" parameterized="true"/>
1718
</section>
1819
</sections>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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="StorefrontCheckoutWithWithVirtualProductTest">
12+
<annotations>
13+
<features value="Multishipping"/>
14+
<stories value="Multiple Shipping"/>
15+
<title value="Check error when cart contains virtual product"/>
16+
<description value="Check error when cart contains only virtual product"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-36921"/>
19+
<group value="Multishipment"/>
20+
</annotations>
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="SimpleProduct" stepKey="firstProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
<createData entity="VirtualProduct" stepKey="virtualProduct">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
<createData entity="Customer_US_UK_DE" stepKey="createCustomerWithMultipleAddresses"/>
30+
</before>
31+
<after>
32+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
33+
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
34+
<deleteData createDataKey="virtualProduct" stepKey="deleteVirtualProduct"/>
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/>
37+
</after>
38+
<!-- Login to the Storefront as created customer -->
39+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
40+
<argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/>
41+
</actionGroup>
42+
<!-- Open the simple product page -->
43+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToFirstProductPage">
44+
<argument name="productUrl" value="$$firstProduct.custom_attributes[url_key]$$"/>
45+
</actionGroup>
46+
<!-- Add the simple product to the Shopping Cart -->
47+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addFirstProductToCart">
48+
<argument name="productName" value="$$firstProduct.name$$"/>
49+
<argument name="productQty" value="1"/>
50+
</actionGroup>
51+
<!-- Open the virtual product page -->
52+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToVirtualProductPage">
53+
<argument name="productUrl" value="$$virtualProduct.custom_attributes[url_key]$$"/>
54+
</actionGroup>
55+
<!-- Add the virtual product to the Shopping Cart -->
56+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addVirtualProductToCart">
57+
<argument name="productName" value="$$virtualProduct.name$$"/>
58+
<argument name="productQty" value="1"/>
59+
</actionGroup>
60+
<!-- Go to Cart -->
61+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
62+
<!-- Check Out with Multiple Addresses -->
63+
<actionGroup ref="StorefrontCheckoutWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/>
64+
<!-- Remove simple product from cart -->
65+
<actionGroup ref="StorefrontRemoveProductOnCheckoutActionGroup" stepKey="removeFirstProductFromCart"/>
66+
<!-- Assert error message on checkout -->
67+
<actionGroup ref="StorefrontAssertCheckoutErrorMessageActionGroup" stepKey="assertErrorMessage">
68+
<argument name="message" value="The current cart does not match multi shipping criteria, please review or contact the store administrator"/>
69+
</actionGroup>
70+
</test>
71+
</tests>

app/code/Magento/Multishipping/etc/config.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
<checkout_multiple_maximum_qty>100</checkout_multiple_maximum_qty>
1414
</options>
1515
</multishipping>
16+
<sales>
17+
<minimum_order>
18+
<multi_address_error_message>The current cart does not match multi shipping criteria, please review or contact the store administrator</multi_address_error_message>
19+
</minimum_order>
20+
</sales>
1621
</default>
1722
</config>

app/code/Magento/Multishipping/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ Options,Options
9292
"Error:","Error:"
9393
"We are unable to process your request. Please, try again later.","We are unable to process your request. Please, try again later."
9494
"Quote address for failed order ID "%1" not found.","Quote address for failed order ID "%1" not found."
95+
"The current cart does not match multi shipping criteria, please review or contact the store administrator","The current cart does not match multi shipping criteria, please review or contact the store administrator"

0 commit comments

Comments
 (0)