Skip to content

Commit a2130b2

Browse files
author
Alexander Akimov
authored
Merge pull request #3327 from magento-tsg/2.2-develop-pr50
[TSG] Backporting for 2.2 (pr50) (2.2.8)
2 parents 88d6b51 + 0ef0f43 commit a2130b2

File tree

43 files changed

+929
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+929
-110
lines changed

app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ public function __construct(Config $config, ResolverInterface $resolver)
4141
}
4242

4343
/**
44-
* Retrieve assoc array of checkout configuration
44+
* Retrieve assoc array of checkout configuration.
4545
*
4646
* @return array
4747
*/
48-
public function getConfig()
48+
public function getConfig(): array
4949
{
50+
$requireBillingAddressAll = \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_ALL;
51+
5052
return [
5153
'payment' => [
5254
self::PAYPAL_CODE => [
@@ -60,6 +62,8 @@ public function getConfig()
6062
'vaultCode' => self::PAYPAL_VAULT_CODE,
6163
'skipOrderReview' => $this->config->isSkipOrderReview(),
6264
'paymentIcon' => $this->config->getPayPalIcon(),
65+
'isRequiredBillingAddress' =>
66+
(int)$this->config->isRequiredBillingAddress() === $requireBillingAddressAll,
6367
]
6468
]
6569
];

app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ protected function setUp()
4747
}
4848

4949
/**
50-
* Run test getConfig method
50+
* Run test getConfig method.
5151
*
5252
* @param array $expected
53+
* @return void
5354
* @dataProvider getConfigDataProvider
5455
*/
5556
public function testGetConfig($expected)
@@ -77,13 +78,16 @@ public function testGetConfig($expected)
7778
'width' => 30, 'height' => 26, 'url' => 'https://icon.test.url'
7879
]);
7980

81+
$this->config->method('isRequiredBillingAddress')
82+
->willReturn(1);
83+
8084
self::assertEquals($expected, $this->configProvider->getConfig());
8185
}
8286

8387
/**
8488
* @return array
8589
*/
86-
public function getConfigDataProvider()
90+
public function getConfigDataProvider(): array
8791
{
8892
return [
8993
[
@@ -101,7 +105,8 @@ public function getConfigDataProvider()
101105
'skipOrderReview' => false,
102106
'paymentIcon' => [
103107
'width' => 30, 'height' => 26, 'url' => 'https://icon.test.url'
104-
]
108+
],
109+
'isRequiredBillingAddress' => true,
105110
]
106111
]
107112
]

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ define([
206206
beforePlaceOrder: function (data) {
207207
this.setPaymentMethodNonce(data.nonce);
208208

209-
if (quote.billingAddress() === null && typeof data.details.billingAddress !== 'undefined') {
209+
if ((this.isRequiredBillingAddress() || quote.billingAddress() === null) &&
210+
typeof data.details.billingAddress !== 'undefined'
211+
) {
210212
this.setBillingAddress(data.details, data.details.billingAddress);
211213
}
212214

@@ -264,6 +266,14 @@ define([
264266
return window.checkoutConfig.payment[this.getCode()].isAllowShippingAddressOverride;
265267
},
266268

269+
/**
270+
* Is billing address required from PayPal side.
271+
* @returns {Boolean}
272+
*/
273+
isRequiredBillingAddress: function () {
274+
return window.checkoutConfig.payment[this.getCode()].isRequiredBillingAddress;
275+
},
276+
267277
/**
268278
* Get configuration for PayPal
269279
* @returns {Object}

app/code/Magento/Catalog/Model/Product/Gallery/UpdateHandler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
class UpdateHandler extends \Magento\Catalog\Model\Product\Gallery\CreateHandler
1717
{
1818
/**
19-
* {@inheritdoc}
19+
* @inheritdoc
20+
*
2021
* @since 101.0.0
2122
*/
2223
protected function processDeletedImages($product, array &$images)
@@ -31,7 +32,7 @@ protected function processDeletedImages($product, array &$images)
3132

3233
foreach ($images as &$image) {
3334
if (!empty($image['removed'])) {
34-
if (!empty($image['value_id']) && !isset($picturesInOtherStores[$image['file']])) {
35+
if (!empty($image['value_id'])) {
3536
if (preg_match('/\.\.(\\\|\/)/', $image['file'])) {
3637
continue;
3738
}
@@ -52,7 +53,8 @@ protected function processDeletedImages($product, array &$images)
5253
}
5354

5455
/**
55-
* {@inheritdoc}
56+
* @inheritdoc
57+
*
5658
* @since 101.0.0
5759
*/
5860
protected function processNewImage($product, array &$image)
@@ -79,6 +81,8 @@ protected function processNewImage($product, array &$image)
7981
}
8082

8183
/**
84+
* Retrieve store ids from product.
85+
*
8286
* @param \Magento\Catalog\Model\Product $product
8387
* @return array
8488
* @since 101.0.0
@@ -97,6 +101,8 @@ protected function extractStoreIds($product)
97101
}
98102

99103
/**
104+
* Remove deleted images.
105+
*
100106
* @param array $files
101107
* @return null
102108
* @since 101.0.0

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@
2525
<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitingForWarningModal"/>
2626
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreDelete"/>
2727
</actionGroup>
28+
29+
<actionGroup name="navigateToProductAttribute">
30+
<arguments>
31+
<argument name="attributeCode" type="string"/>
32+
</arguments>
33+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
34+
<waitForPageLoad stepKey="waitForAttributeGridPageLoad"/>
35+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
36+
<fillField selector="{{AdminProductAttributeGridSection.filterByAttributeCode}}" userInput="{{attributeCode}}" stepKey="fillAttributeCodeFilter"/>
37+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
38+
<click selector="{{AdminProductAttributeGridSection.attributeCode(attributeCode)}}" stepKey="navigateToAttributeEditPage" />
39+
<waitForPageLoad stepKey="waitForAttributeEditPageLoad" />
40+
</actionGroup>
2841
</actionGroups>

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/>
9292
</actionGroup>
9393

94+
<!--Set product to website-->
9495
<actionGroup name="ProductSetWebsite">
9596
<arguments>
9697
<argument name="website"/>
@@ -131,12 +132,12 @@
131132
<!--Switch to New Store view-->
132133
<actionGroup name="SwitchToTheNewStoreView">
133134
<arguments>
134-
<argument name="storeViewName" type="string"/>
135+
<argument name="storeViewName"/>
135136
</arguments>
136-
<scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/>
137+
<scrollTo selector="{{AdminHeaderSection.pageTitle}}" stepKey="scrollToUp"/>
137138
<waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/>
138139
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
139-
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/>
140+
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName.name)}}" stepKey="chooseStoreView"/>
140141
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
141142
<waitForPageLoad stepKey="waitForPageLoad"/>
142143
</actionGroup>
@@ -151,4 +152,21 @@
151152
<waitForPageLoad stepKey="waitForPageOpened"/>
152153
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
153154
</actionGroup>
155+
156+
<!--Remove product image-->
157+
<actionGroup name="RemoveProductImage">
158+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
159+
<waitForPageLoad time="30" stepKey="waitForPageRefresh"/>
160+
<click selector="{{AdminProductImagesSection.removeImageButton}}" stepKey="clickRemoveImage"/>
161+
</actionGroup>
162+
163+
<!-- Assert no product image in Admin Product page -->
164+
<actionGroup name="AssertProductImageNotInAdminProductPage">
165+
<arguments>
166+
<argument name="image" defaultValue="MagentoLogo" />
167+
</arguments>
168+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
169+
<waitForPageLoad stepKey="waitForPageLoad"/>
170+
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/>
171+
</actionGroup>
154172
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductAttributeEditPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<page name="AdminProductAttributeEditPage" url="catalog/product_attribute/edit/" area="admin" module="Magento_Catalog">
1212
<section name="AdminProductAttributeEditSection"/>
1313
<section name="AdminConfirmationModalSection"/>
14+
<section name="AdminEditAttributeStorefrontPropertiesSection"/>
1415
</page>
1516
</pages>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductAttributeGridPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1010
<page name="AdminProductAttributeGridPage" url="catalog/product_attribute" area="admin" module="Catalog">
1111
<section name="AdminProductAttributeGridSection"/>
12+
<section name="AdminDataGridHeaderSection"/>
1213
</page>
1314
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<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">
11+
<section name="AdminEditAttributeStorefrontPropertiesSection">
12+
<element name="storeFrontPropertiesTab" selector="#product_attribute_tabs_front" type="button"/>
13+
<element name="useForPromoRuleConditions" type="select" selector="#is_used_for_promo_rules"/>
14+
</section>
15+
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
1717
<element name="firstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]"/>
1818
<element name="attributeCodeFilterInput" type="input" selector=".admin__data-grid-filters input[name='attribute_code']"/>
19+
<element name="filterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/>
1920
</section>
2021
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
<waitForPageLoad stepKey="waitForCategoryPageLoad1"/>
130130
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewOption('Default Store View')}}"
131131
stepKey="clickStoreView"/>
132+
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
133+
stepKey="waitForPopup1"/>
132134
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}" stepKey="clickActionAccept"/>
133135
<waitForPageLoad stepKey="waitForCategoryPageLoad2"/>
134136
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection1"/>
@@ -148,6 +150,8 @@
148150
<waitForPageLoad stepKey="waitForCategoryPageLoad3"/>
149151
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewOption(secondStore.name)}}"
150152
stepKey="clickStoreView1"/>
153+
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
154+
stepKey="waitForPopup2"/>
151155
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
152156
stepKey="clickActionAccept1"/>
153157
<waitForPageLoad stepKey="waitForCategoryPageLoad4"/>

0 commit comments

Comments
 (0)