Skip to content

Commit 91ae8e9

Browse files
Merge branch 2.2-develop into ENGCOM-4017-magento-magento2-20613
2 parents c09b8df + b3abf20 commit 91ae8e9

File tree

22 files changed

+310
-20
lines changed

22 files changed

+310
-20
lines changed

app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="save" type="button" selector="#save" timeout="30"/>
1313
<element name="delete" type="button" selector="#delete"/>
1414
<element name="add" type="button" selector="#add" timeout="30"/>
15+
<element name="back" type="button" selector="#back" timeout="30"/>
1516
</section>
1617
</sections>

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
*/
77
-->
88

9-
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1011
<section name="AdminMessagesSection">
1112
<element name="test" type="input" selector=".test"/>
1213
<element name="success" type="text" selector="#messages div.message-success"/>
1314
<element name="successMessageByIndex" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
1415
<element name="error" type="text" selector="#messages div.message-error"/>
16+
<element name="notice" type="text" selector=".message.message-notice.notice"/>
1517
</section>
1618
</sections>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@
5252
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
5353
</actionGroup>
5454

55+
<actionGroup name="DeleteProductByName" extends="deleteProductUsingProductGrid">
56+
<arguments>
57+
<argument name="product" type="string"/>
58+
</arguments>
59+
<remove keyForRemoval="fillProductSkuFilter"/>
60+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product}}" stepKey="fillProductSkuFilter" after="openProductFilters"/>
61+
<remove keyForRemoval="seeProductSkuInGrid"/>
62+
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{product}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/>
63+
</actionGroup>
64+
5565
<!--Disabled a product by filtering grid and using change status action-->
5666
<actionGroup name="ChangeStatusProductUsingProductGridActionGroup">
5767
<arguments>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="SearchForProductOnBackendActionGroup">
1212
<arguments>
1313
<argument name="product" defaultValue="product"/>
@@ -19,4 +19,11 @@
1919
<fillField stepKey="fillSkuFieldOnFiltersSection" userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.SkuInput}}"/>
2020
<click stepKey="clickApplyFiltersButton" selector="{{AdminProductFiltersSection.Apply}}"/>
2121
</actionGroup>
22+
<actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup">
23+
<arguments>
24+
<argument name="productName" type="string"/>
25+
</arguments>
26+
<remove keyForRemoval="fillSkuFieldOnFiltersSection"/>
27+
<fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.NameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/>
28+
</actionGroup>
2229
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductGridSection">
12+
<element name="productRowBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" />
1213
<element name="loadingMask" type="text" selector=".admin__data-grid-loading-mask[data-component*='product_listing']"/>
1314
<element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
1415
<element name="productGridElement1" type="input" selector="#addselector" />

app/code/Magento/CatalogInventory/Observer/CancelOrderItemObserver.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66

77
namespace Magento\CatalogInventory\Observer;
88

9-
use Magento\Framework\Event\ObserverInterface;
109
use Magento\CatalogInventory\Api\StockManagementInterface;
10+
use Magento\CatalogInventory\Model\Configuration;
1111
use Magento\Framework\Event\Observer as EventObserver;
12+
use Magento\Framework\Event\ObserverInterface;
1213

1314
/**
1415
* Catalog inventory module observer
1516
*/
1617
class CancelOrderItemObserver implements ObserverInterface
1718
{
19+
/**
20+
* @var \Magento\CatalogInventory\Model\Configuration
21+
*/
22+
protected $configuration;
23+
1824
/**
1925
* @var StockManagementInterface
2026
*/
@@ -26,13 +32,16 @@ class CancelOrderItemObserver implements ObserverInterface
2632
protected $priceIndexer;
2733

2834
/**
35+
* @param Configuration $configuration
2936
* @param StockManagementInterface $stockManagement
3037
* @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3138
*/
3239
public function __construct(
40+
Configuration $configuration,
3341
StockManagementInterface $stockManagement,
3442
\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3543
) {
44+
$this->configuration = $configuration;
3645
$this->stockManagement = $stockManagement;
3746
$this->priceIndexer = $priceIndexer;
3847
}
@@ -49,7 +58,8 @@ public function execute(EventObserver $observer)
4958
$item = $observer->getEvent()->getItem();
5059
$children = $item->getChildrenItems();
5160
$qty = $item->getQtyOrdered() - max($item->getQtyShipped(), $item->getQtyInvoiced()) - $item->getQtyCanceled();
52-
if ($item->getId() && $item->getProductId() && empty($children) && $qty) {
61+
if ($item->getId() && $item->getProductId() && empty($children) && $qty && $this->configuration
62+
->getCanBackInStock()) {
5363
$this->stockManagement->backItemQty($item->getProductId(), $qty, $item->getStore()->getWebsiteId());
5464
}
5565
$this->priceIndexer->reindexRow($item->getProductId());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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="StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Checkout via the Storefront"/>
15+
<title value="Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote"/>
16+
<description value="Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-78596"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<createData entity="VirtualProduct" stepKey="createVirtualProduct"/>
23+
<createData entity="Customer_With_Different_Default_Billing_Shipping_Addresses" stepKey="createCustomer"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="CustomerLogoutStorefrontActionGroup" stepKey="customerLogout"/>
27+
<deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/>
28+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
29+
</after>
30+
<!-- Steps -->
31+
<!-- Step 1: Go to Storefront as Customer -->
32+
<actionGroup ref="CustomerLoginOnStorefront" stepKey="customerLogin">
33+
<argument name="customer" value="$$createCustomer$$" />
34+
</actionGroup>
35+
<!-- Step 2: Add virtual product to cart -->
36+
<amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$)}}" stepKey="amOnPage"/>
37+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
38+
<argument name="product" value="$$createVirtualProduct$$"/>
39+
<argument name="productCount" value="1"/>
40+
</actionGroup>
41+
<!-- Step 3: Go to Shopping Cart -->
42+
<actionGroup ref="StorefrontViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingcart"/>
43+
<!-- Step 4: Open Estimate Tax section -->
44+
<click selector="{{StorefrontCheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/>
45+
<seeOptionIsSelected selector="{{StorefrontCheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country}}" stepKey="checkCountry"/>
46+
<seeOptionIsSelected selector="{{StorefrontCheckoutCartSummarySection.region}}" userInput="{{US_Address_CA.state}}" stepKey="checkState"/>
47+
<scrollTo selector="{{StorefrontCheckoutCartSummarySection.postcode}}" stepKey="scrollToPostCodeField"/>
48+
<grabValueFrom selector="{{StorefrontCheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/>
49+
<assertEquals message="Customer postcode is invalid" stepKey="checkCustomerPostcode">
50+
<expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult>
51+
<actualResult type="variable">grabTextPostCode</actualResult>
52+
</assertEquals>
53+
</test>
54+
</tests>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<data key="state">California</data>
6868
<data key="postcode">90230</data>
6969
<data key="country_id">US</data>
70+
<data key="country">United States</data>
7071
<data key="default_billing">Yes</data>
7172
<data key="default_shipping">Yes</data>
7273
<requiredEntity type="region">RegionCA</requiredEntity>
@@ -104,4 +105,12 @@
104105
<data key="country">United Kingdom</data>
105106
<data key="telephone">444-44-444-44</data>
106107
</entity>
108+
<entity name="US_Default_Billing_Address_TX" type="address" extends="US_Address_TX">
109+
<data key="default_billing">false</data>
110+
<data key="default_shipping">true</data>
111+
</entity>
112+
<entity name="US_Default_Shipping_Address_CA" type="address" extends="US_Address_CA">
113+
<data key="default_billing">true</data>
114+
<data key="default_shipping">false</data>
115+
</entity>
107116
</entities>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,16 @@
7474
<data key="website_id">0</data>
7575
<requiredEntity type="address">US_Address_NY</requiredEntity>
7676
</entity>
77+
<entity name="Customer_With_Different_Default_Billing_Shipping_Addresses" type="customer">
78+
<data key="group_id">1</data>
79+
<data key="email" unique="prefix">John.Doe@example.com</data>
80+
<data key="firstname">John</data>
81+
<data key="lastname">Doe</data>
82+
<data key="fullname">John Doe</data>
83+
<data key="password">pwdTest123!</data>
84+
<data key="store_id">0</data>
85+
<data key="website_id">0</data>
86+
<requiredEntity type="address">US_Default_Billing_Address_TX</requiredEntity>
87+
<requiredEntity type="address">US_Default_Shipping_Address_CA</requiredEntity>
88+
</entity>
7789
</entities>

app/code/Magento/Quote/Model/Quote/Address/Total.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Quote\Model\Quote\Address;
77

88
/**
9+
* Class Total
10+
*
911
* @method string getCode()
1012
*
1113
* @api
@@ -54,6 +56,8 @@ public function __construct(
5456
*/
5557
public function setTotalAmount($code, $amount)
5658
{
59+
$amount = is_float($amount) ? round($amount, 4) : $amount;
60+
5761
$this->totalAmounts[$code] = $amount;
5862
if ($code != 'subtotal') {
5963
$code = $code . '_amount';
@@ -72,6 +76,8 @@ public function setTotalAmount($code, $amount)
7276
*/
7377
public function setBaseTotalAmount($code, $amount)
7478
{
79+
$amount = is_float($amount) ? round($amount, 4) : $amount;
80+
7581
$this->baseTotalAmounts[$code] = $amount;
7682
if ($code != 'subtotal') {
7783
$code = $code . '_amount';
@@ -167,6 +173,7 @@ public function getAllBaseTotalAmounts()
167173

168174
/**
169175
* Set the full info, which is used to capture tax related information.
176+
*
170177
* If a string is used, it is assumed to be serialized.
171178
*
172179
* @param array|string $info

0 commit comments

Comments
 (0)