Skip to content

Commit fa8a9d2

Browse files
merge magento/2.3-develop into magento-engcom/2.3-develop-prs
2 parents e8da763 + 52f9fd4 commit fa8a9d2

File tree

64 files changed

+1604
-176
lines changed

Some content is hidden

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

64 files changed

+1604
-176
lines changed

app/code/Magento/Catalog/Model/Layer/FilterList.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Catalog\Model\Layer;
89

10+
/**
11+
* Layer navigation filters
12+
*/
913
class FilterList
1014
{
1115
const CATEGORY_FILTER = 'category';
@@ -106,9 +110,9 @@ protected function getAttributeFilterClass(\Magento\Catalog\Model\ResourceModel\
106110
{
107111
$filterClassName = $this->filterTypes[self::ATTRIBUTE_FILTER];
108112

109-
if ($attribute->getAttributeCode() == 'price') {
113+
if ($attribute->getFrontendInput() === 'price') {
110114
$filterClassName = $this->filterTypes[self::PRICE_FILTER];
111-
} elseif ($attribute->getBackendType() == 'decimal') {
115+
} elseif ($attribute->getBackendType() === 'decimal') {
112116
$filterClassName = $this->filterTypes[self::DECIMAL_FILTER];
113117
}
114118

app/code/Magento/Catalog/Plugin/Block/Topmenu.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Plugin\Block;
79

810
use Magento\Catalog\Model\Category;
@@ -156,12 +158,13 @@ private function getCurrentCategory()
156158
*/
157159
private function getCategoryAsArray($category, $currentCategory, $isParentActive)
158160
{
161+
$categoryId = $category->getId();
159162
return [
160163
'name' => $category->getName(),
161-
'id' => 'category-node-' . $category->getId(),
164+
'id' => 'category-node-' . $categoryId,
162165
'url' => $this->catalogCategory->getCategoryUrl($category),
163-
'has_active' => in_array((string)$category->getId(), explode('/', $currentCategory->getPath()), true),
164-
'is_active' => $category->getId() == $currentCategory->getId(),
166+
'has_active' => in_array((string)$categoryId, explode('/', (string)$currentCategory->getPath()), true),
167+
'is_active' => $categoryId == $currentCategory->getId(),
165168
'is_category' => true,
166169
'is_parent_active' => $isParentActive
167170
];
@@ -193,4 +196,22 @@ protected function getCategoryTree($storeId, $rootId)
193196

194197
return $collection;
195198
}
199+
200+
/**
201+
* Add active
202+
*
203+
* @param \Magento\Theme\Block\Html\Topmenu $subject
204+
* @param string[] $result
205+
* @return string[]
206+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
207+
*/
208+
public function afterGetCacheKeyInfo(\Magento\Theme\Block\Html\Topmenu $subject, array $result)
209+
{
210+
$activeCategory = $this->getCurrentCategory();
211+
if ($activeCategory) {
212+
$result[] = Category::CACHE_TAG . '_' . $activeCategory->getId();
213+
}
214+
215+
return $result;
216+
}
196217
}

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@
9999
<attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/>
100100
<waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/>
101101
<waitForLoadingMaskToDisappear stepKey="waitForLoading"/>
102-
<see selector="{{AdminCategoryContentSection.imageFileName}}" userInput="{{image.file}}" stepKey="seeImage"/>
102+
<grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/>
103+
<assertRegExp stepKey="assertEquals" message="pass">
104+
<expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult>
105+
<actualResult type="variable">grabCategoryFileName</actualResult>
106+
</assertRegExp>
103107
</actionGroup>
104108

105109
<!-- Remove image from category -->
@@ -128,7 +132,11 @@
128132
<conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/>
129133
<waitForPageLoad stepKey="waitForPageLoad"/>
130134
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
131-
<see selector="{{AdminCategoryContentSection.imageFileName}}" userInput="{{image.file}}" stepKey="seeImage"/>
135+
<grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/>
136+
<assertRegExp stepKey="assertEquals" message="pass">
137+
<expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult>
138+
<actualResult type="variable">grabCategoryFileName</actualResult>
139+
</assertRegExp>
132140
</actionGroup>
133141

134142
<!-- Action to navigate to Media Gallery. Used in tests to cleanup uploaded images -->

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
<scrollToTopOfPage stepKey="scrollTopPageProduct"/>
135135
<waitForElementVisible selector="{{AdminProductFormActionSection.saveButton}}" stepKey="waitForSaveProductButton"/>
136136
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
137-
<waitForPageLoad stepKey="waitForProductToSave"/>
138-
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
137+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitProductSaveSuccessMessage"/>
138+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
139139
</actionGroup>
140140

141141
<actionGroup name="toggleProductEnabled">
@@ -149,9 +149,10 @@
149149
<!-- Save product but do not expect a success message -->
150150
<actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm">
151151
<annotations>
152-
<description>EXTENDS: saveProductForm. Removes 'seeSaveConfirmation'.</description>
152+
<description>EXTENDS: saveProductForm. Removes 'waitProductSaveSuccessMessage' and 'seeSaveConfirmation'.</description>
153153
</annotations>
154154

155+
<remove keyForRemoval="waitProductSaveSuccessMessage"/>
155156
<remove keyForRemoval="seeSaveConfirmation"/>
156157
</actionGroup>
157158

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,23 @@
423423
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
424424
<waitForPageLoad stepKey="waitForGridLoad"/>
425425
</actionGroup>
426+
427+
<actionGroup name="deleteAllProductsUsingProductGrid">
428+
<annotations>
429+
<description>Deletes all products in Admin Products grid page.</description>
430+
</annotations>
431+
432+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openAdminGridProductsPage"/>
433+
<waitForPageLoad time="60" stepKey="waitForPageFullyLoad"/>
434+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clearGridFilters"/>
435+
436+
<conditionalClick selector="{{AdminProductGridSection.multicheckDropdown}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="openMulticheckDropdown"/>
437+
<conditionalClick selector="{{AdminProductGridSection.multicheckOption('Select All')}}" dependentSelector="{{AdminDataGridTableSection.dataGridEmpty}}" visible="false" stepKey="selectAllProductsInGrid"/>
438+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
439+
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
440+
441+
<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitForConfirmModal"/>
442+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/>
443+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitGridIsEmpty"/>
444+
</actionGroup>
426445
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,28 @@
278278
<data key="used_for_sort_by">false</data>
279279
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
280280
</entity>
281+
<entity name="productAttributeTypeOfPrice" type="ProductAttribute">
282+
<data key="attribute_code" unique="suffix">attribute</data>
283+
<data key="frontend_input">price</data>
284+
<data key="scope">global</data>
285+
<data key="is_required">false</data>
286+
<data key="is_unique">false</data>
287+
<data key="is_searchable">false</data>
288+
<data key="is_visible">true</data>
289+
<data key="is_wysiwyg_enabled">false</data>
290+
<data key="is_visible_in_advanced_search">false</data>
291+
<data key="is_visible_on_front">true</data>
292+
<data key="is_filterable">true</data>
293+
<data key="is_filterable_in_search">false</data>
294+
<data key="used_in_product_listing">false</data>
295+
<data key="is_used_for_promo_rules">false</data>
296+
<data key="is_comparable">true</data>
297+
<data key="is_used_in_grid">false</data>
298+
<data key="is_visible_in_grid">false</data>
299+
<data key="is_filterable_in_grid">false</data>
300+
<data key="used_for_sort_by">false</data>
301+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
302+
</entity>
281303
<entity name="textProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute">
282304
<data key="frontend_input">text</data>
283305
<data key="default_value" unique="suffix">defaultValue</data>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<section name="AdminProductAttributesSection"/>
1919
<section name="AdminProductFormRelatedUpSellCrossSellSection"/>
2020
<section name="AdminProductFormAdvancedPricingSection"/>
21-
<section name="AdminProductFormAdvancedInventorySection"/>
2221
<section name="AdminAddAttributeModalSection"/>
2322
</page>
2423
</pages>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<section name="AdminCategorySidebarTreeSection">
1212
<element name="collapseAll" type="button" selector=".tree-actions a:first-child"/>
1313
<element name="expandAll" type="button" selector=".tree-actions a:last-child"/>
14+
<element name="categoryHighlighted" type="text" selector="//div[@id='store.menu']//span[contains(text(),'{{name}}')]/ancestor::li" parameterized="true" timeout="30"/>
15+
<element name="categoryNotHighlighted" type="text" selector="ul[id=\'ui-id-2\'] li[class~=\'active\']" timeout="30"/>
1416
<element name="categoryTreeRoot" type="text" selector="div.x-tree-root-node>li.x-tree-node:first-of-type>div.x-tree-node-el:first-of-type" timeout="30"/>
1517
<element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>
1618
<element name="categoryInTreeUnderRoot" type="text" selector="//li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@
215215
<element name="textAttributeByName" type="text" selector="//div[@data-index='attributes']//fieldset[contains(@class, 'admin__field') and .//*[contains(.,'{{var}}')]]//input" parameterized="true"/>
216216
<element name="dropDownAttribute" type="select" selector="//select[@name='product[{{arg}}]']" parameterized="true" timeout="30"/>
217217
<element name="attributeSection" type="block" selector="//div[@data-index='attributes']/div[contains(@class, 'admin__collapsible-content _show')]" timeout="30"/>
218+
<element name="customAttribute" type="text" selector="product[{{attributecode}}]" timeout="30" parameterized="true"/>
218219
<element name="attributeGroupByName" type="button" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']" parameterized="true"/>
219220
<element name="attributeByGroupAndName" type="text" selector="//div[@class='fieldset-wrapper-title']//span[text()='{{group}}']/../../following-sibling::div//span[contains(text(),'attribute')]" parameterized="true"/>
220221
</section>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="StorefrontCategoryFilterSection">
1212
<element name="CategoryFilter" type="button" selector="//main//div[@class='filter-options']//div[contains(text(), 'Category')]"/>
1313
<element name="CategoryByName" type="button" selector="//main//div[@class='filter-options']//li[@class='item']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
14+
<element name="CustomPriceAttribute" type="button" selector="div.filter-options-title"/>
1415
</section>
1516
</sections>

0 commit comments

Comments
 (0)