Skip to content

Commit 3af45a3

Browse files
committed
Merge remote-tracking branch 'commerce/2.4-develop' into SFAPP-188-composer-test-blacklist
2 parents 3ce3b50 + 2c173c9 commit 3af45a3

File tree

61 files changed

+1432
-119
lines changed

Some content is hidden

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

61 files changed

+1432
-119
lines changed

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ public function isHostBackend()
123123
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
124124
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
125125
} else {
126-
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
126+
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
127+
if ($backendUrl === null) {
128+
$backendUrl = $this->scopeConfig->getValue(
129+
Store::XML_PATH_UNSECURE_BASE_URL,
130+
ScopeInterface::SCOPE_STORE
131+
);
132+
}
127133
}
128134
$host = $this->request->getServer('HTTP_HOST', '');
129135
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;

app/code/Magento/Backend/Block/Widget/Button.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Backend\Block\Widget;
77

8+
use Magento\Backend\Block\Template\Context;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Math\Random;
10-
use Magento\Backend\Block\Template\Context;
1111
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1212

1313
/**
@@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
125125
'value' => $this->getValue(),
126126
'disabled' => $disabled,
127127
];
128+
if ($this->hasData('onclick_attribute')) {
129+
$attributes['onclick'] = $this->getData('onclick_attribute');
130+
}
128131
if ($this->hasData('backend_button_widget_hook_id')) {
129132
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
130133
}

app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
9494
]
9595
];
9696
}
97+
98+
/**
99+
* Verifies ability of adding button onclick attribute
100+
*
101+
* @return void
102+
*/
103+
public function testOnClickAttribute(): void
104+
{
105+
$this->_blockMock->setData(['onclick_attribute' => 'value']);
106+
$attributes = $this->_blockMock->getAttributesHtml();
107+
$this->assertStringContainsString('onclick', $attributes);
108+
}
97109
}

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public function getTierPrices($product)
379379
if (array_key_exists('website_price', $price)) {
380380
$value = $price['website_price'];
381381
} else {
382-
$value = $price['price'];
382+
$value = $price['price'] ?? 0;
383383
}
384384
$tierPrice->setValue($value);
385385
$tierPrice->setQty($price['price_qty']);

app/code/Magento/Catalog/Observer/CategoryProductIndexer.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Catalog\Observer;
99

1010
use Magento\Catalog\Model\Indexer\Category\Product\Processor;
11+
use Magento\Catalog\Model\Indexer\Category\Flat\State as FlatState;
1112
use Magento\Framework\Event\Observer;
1213
use Magento\Framework\Event\ObserverInterface;
1314

@@ -21,12 +22,21 @@ class CategoryProductIndexer implements ObserverInterface
2122
*/
2223
private $processor;
2324

25+
/**
26+
* @var FlatState
27+
*/
28+
private $flatState;
29+
2430
/**
2531
* @param Processor $processor
32+
* @param FlatState $flatState
2633
*/
27-
public function __construct(Processor $processor)
28-
{
34+
public function __construct(
35+
Processor $processor,
36+
FlatState $flatState
37+
) {
2938
$this->processor = $processor;
39+
$this->flatState = $flatState;
3040
}
3141

3242
/**
@@ -35,7 +45,7 @@ public function __construct(Processor $processor)
3545
public function execute(Observer $observer): void
3646
{
3747
$productIds = $observer->getEvent()->getProductIds();
38-
if (!empty($productIds) && $this->processor->isIndexerScheduled()) {
48+
if (!empty($productIds) && $this->processor->isIndexerScheduled() && $this->flatState->isFlatEnabled()) {
3949
$this->processor->markIndexerAsInvalid();
4050
}
4151
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</annotations>
1515
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/>
1616
<click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickOption"/>
17-
<seeInCurrentUrl url="catalog/product_action_attribute/edit/" stepKey="seeInUrl"/>
17+
<waitForPageLoad stepKey="waitForBulkUpdatePage"/>
18+
<seeInCurrentUrl url="{{ProductAttributesEditPage.url}}" stepKey="seeInUrl"/>
1819
</actionGroup>
1920
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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="AdminDeleteAllProductAttributesFilteredByCodeActionGroup">
11+
<annotations>
12+
<description>Open product attributes grid filter it by attribute code and delete all found attributes one by one.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="codeFilter" type="string" defaultValue="fake-code"/>
16+
</arguments>
17+
18+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
19+
<!-- It sometimes is loading too long for default 10s -->
20+
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/>
21+
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFilters"/>
22+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{codeFilter}}" stepKey="fillAttributeCodeFilterField"/>
23+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="applyGridFilter"/>
24+
<helper class="\Magento\Catalog\Test\Mftf\Helper\CatalogHelper" method="deleteAllProductAttributesOneByOne" stepKey="deleteAllProductAttributesOneByOne">
25+
<argument name="notEmptyRow">{{AdminDataGridTableSection.firstNotEmptyRow2}}</argument>
26+
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument>
27+
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument>
28+
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument>
29+
<argument name="successMessage">You deleted the product attribute.</argument>
30+
</helper>
31+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
32+
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
33+
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFiltersAgain"/>
34+
</actionGroup>
35+
</actionGroups>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AdminMassUpdateProductQtyIncrementsActionGroup">
12+
<arguments>
13+
<argument name="enableQtyIncrements" type="string" defaultValue="Yes"/>
14+
<argument name="qtyIncrements" type="string" defaultValue="2"/>
15+
</arguments>
16+
<click selector="{{AdminUpdateAttributesAdvancedInventorySection.inventory}}" stepKey="openInventoryTab"/>
17+
<checkOption selector="{{AdminUpdateAttributesAdvancedInventorySection.changeEnableQtyIncrements}}" stepKey="changeEnableQtyIncrements"/>
18+
<uncheckOption selector="{{AdminUpdateAttributesAdvancedInventorySection.useConfigEnableQtyIncrements}}" stepKey="uncheckUseConfigEnableQtyIncrements"/>
19+
<selectOption selector="{{AdminUpdateAttributesAdvancedInventorySection.enableQtyIncrements}}" userInput="{{enableQtyIncrements}}" stepKey="setEnableQtyIncrements"/>
20+
<checkOption selector="{{AdminUpdateAttributesAdvancedInventorySection.changeQtyIncrements}}" stepKey="changeQtyIncrements"/>
21+
<uncheckOption selector="{{AdminUpdateAttributesAdvancedInventorySection.useConfigQtyIncrements}}" stepKey="uncheckUseConfigQtyIncrements"/>
22+
<fillField selector="{{AdminUpdateAttributesAdvancedInventorySection.qtyIncrements}}" userInput="{{qtyIncrements}}" stepKey="setQtyIncrements"/>
23+
<click selector="{{AdminUpdateAttributesSection.saveButton}}" stepKey="save"/>
24+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitVisibleSuccessMessage"/>
25+
<see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue" stepKey="seeSuccessMessage"/>
26+
</actionGroup>
27+
</actionGroups>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Test\Mftf\Helper;
9+
10+
use Facebook\WebDriver\Remote\RemoteWebDriver as FacebookWebDriver;
11+
use Facebook\WebDriver\WebDriverBy;
12+
use Magento\FunctionalTestingFramework\Helper\Helper;
13+
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver;
14+
15+
/**
16+
* Class for MFTF helpers for Catalog module.
17+
*/
18+
class CatalogHelper extends Helper
19+
{
20+
/**
21+
* Delete all product attributes one by one.
22+
*
23+
* @param string $notEmptyRow
24+
* @param string $modalAcceptButton
25+
* @param string $deleteButton
26+
* @param string $successMessageContainer
27+
* @param string $successMessage
28+
* @retrun void
29+
*/
30+
public function deleteAllProductAttributesOneByOne(
31+
string $notEmptyRow,
32+
string $modalAcceptButton,
33+
string $deleteButton,
34+
string $successMessageContainer,
35+
string $successMessage
36+
): void {
37+
try {
38+
/** @var MagentoWebDriver $webDriver */
39+
$magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
40+
/** @var FacebookWebDriver $webDriver */
41+
$webDriver = $magentoWebDriver->webDriver;
42+
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
43+
while (!empty($gridRows)) {
44+
$gridRows[0]->click();
45+
$magentoWebDriver->waitForPageLoad(30);
46+
$magentoWebDriver->click($deleteButton);
47+
$magentoWebDriver->waitForPageLoad(30);
48+
$magentoWebDriver->waitForElementVisible($modalAcceptButton);
49+
$magentoWebDriver->click($modalAcceptButton);
50+
$magentoWebDriver->waitForPageLoad(60);
51+
$magentoWebDriver->waitForElementVisible($successMessageContainer);
52+
$magentoWebDriver->see($successMessage, $successMessageContainer);
53+
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
54+
}
55+
} catch (\Exception $e) {
56+
$this->fail($e->getMessage());
57+
}
58+
}
59+
}

app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection/AdminUpdateAttributesAdvancedInventorySection.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
<element name="qty" type="input" selector="#inventory_qty"/>
1414
<element name="changeStockAvailability" type="checkbox" selector="#inventory_stock_availability_checkbox"/>
1515
<element name="stockAvailability" type="select" selector="//select[@name='inventory[is_in_stock]']"/>
16+
<element name="enableQtyIncrements" type="select" selector="#inventory_enable_qty_increments"/>
17+
<element name="useConfigEnableQtyIncrements" type="checkbox" selector="#inventory_use_config_enable_qty_increments"/>
18+
<element name="changeEnableQtyIncrements" type="checkbox" selector="#inventory_enable_qty_increments_checkbox"/>
19+
<element name="qtyIncrements" type="input" selector="#inventory_qty_increments"/>
20+
<element name="useConfigQtyIncrements" type="checkbox" selector="#inventory_use_config_qty_increments"/>
21+
<element name="changeQtyIncrements" type="checkbox" selector="#inventory_qty_increments_checkbox"/>
1622
</section>
1723
</sections>

0 commit comments

Comments
 (0)