Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 25595 - multiple address virtual product error at checkout fixe… #29269

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAssertCheckoutErrorMessageActionGroup">
<arguments>
<argument name="message" type="string"/>
</arguments>

<waitForElementVisible selector="{{CheckoutCartMessageSection.errorMessageText(message)}}" stepKey="assertErrorMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<element name="successMessage" type="text" selector=".message.message-success.success>div" />
<element name="errorMessage" type="text" selector=".message-error.error.message>div" />
<element name="emptyCartMessage" type="text" selector=".cart-empty>p"/>
<element name="errorMessageText" type="text" selector="//div[contains(@class, 'message-error')]/div[text()='{{var}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
);

$shippingMethodCode = $address->getShippingMethod();
if (isset($shippingMethodCode) && !empty($shippingMethodCode)) {
if ($shippingMethodCode) {
$rate = $address->getShippingRateByCode($shippingMethodCode);
$shippingPrice = $rate->getPrice();
} else {
Expand Down Expand Up @@ -975,7 +975,8 @@ public function getMinimumAmountError()
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
return $error;

return __($error);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontRemoveProductOnCheckoutActionGroup">
<arguments>
<argument name="itemNumber" type="string" defaultValue="1"/>
</arguments>

<click selector="{{MultishippingSection.removeItemButton(itemNumber)}}" stepKey="removeItem"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
<element name="shippingAddressSelector" type="select" selector="//tr[position()={{addressPosition}}]//td[@data-th='Send To']//select" parameterized="true"/>
<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"/>
<element name="selectShippingAddress" type="select" selector="(//table[@id='multiship-addresses-table'] //div[@class='field address'] //select)[{{sequenceNumber}}]" parameterized="true"/>
<element name="removeItemButton" type="button" selector="//a[contains(@title, 'Remove Item')][{{var}}]" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCheckoutWithWithVirtualProductTest">
<annotations>
<features value="Multishipping"/>
<stories value="Multiple Shipping"/>
<title value="Check error when cart contains virtual product"/>
<description value="Check error when cart contains only virtual product"/>
<severity value="MAJOR"/>
<group value="Multishipment"/>
</annotations>
<before>
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct" stepKey="firstProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="VirtualProduct" stepKey="virtualProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="Customer_US_UK_DE" stepKey="createCustomerWithMultipleAddresses"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
<deleteData createDataKey="virtualProduct" stepKey="deleteVirtualProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/>
</after>
<!-- Login to the Storefront as created customer -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
<argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/>
</actionGroup>
<!-- Open the simple product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToFirstProductPage">
<argument name="productUrl" value="$$firstProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<!-- Add the simple product to the Shopping Cart -->
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addFirstProductToCart">
<argument name="productName" value="$$firstProduct.name$$"/>
<argument name="productQty" value="1"/>
</actionGroup>
<!-- Open the virtual product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToVirtualProductPage">
<argument name="productUrl" value="$$virtualProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<!-- Add the virtual product to the Shopping Cart -->
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addVirtualProductToCart">
<argument name="productName" value="$$virtualProduct.name$$"/>
<argument name="productQty" value="1"/>
</actionGroup>
<!-- Go to Cart -->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
<!-- Check Out with Multiple Addresses -->
<actionGroup ref="StorefrontCheckoutWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/>
<!-- Remove simple product from cart -->
<actionGroup ref="StorefrontRemoveProductOnCheckoutActionGroup" stepKey="removeFirstProductFromCart"/>
<!-- Assert error message on checkout -->
<actionGroup ref="StorefrontAssertCheckoutErrorMessageActionGroup" stepKey="assertErrorMessage">
<argument name="message" value="The current cart does not match multi shipping criteria, please review or contact the store administrator"/>
</actionGroup>
</test>
</tests>
5 changes: 5 additions & 0 deletions app/code/Magento/Multishipping/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
<checkout_multiple_maximum_qty>100</checkout_multiple_maximum_qty>
</options>
</multishipping>
<sales>
<minimum_order>
<multi_address_error_message>The current cart does not match multi shipping criteria, please review or contact the store administrator</multi_address_error_message>
</minimum_order>
</sales>
</default>
</config>
1 change: 1 addition & 0 deletions app/code/Magento/Multishipping/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ Options,Options
"Error:","Error:"
"We are unable to process your request. Please, try again later.","We are unable to process your request. Please, try again later."
"Quote address for failed order ID "%1" not found.","Quote address for failed order ID "%1" not found."
"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"