Skip to content

Commit b158e99

Browse files
authored
Merge branch 'magento-commerce:2.4-develop' into comm_78764_32435
2 parents f16f60d + 8ef004d commit b158e99

File tree

26 files changed

+925
-85
lines changed

26 files changed

+925
-85
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminToggleProductGridColumnByClickingItsNameActionGroup">
12+
<annotations>
13+
<description>Click on 'Columns' name from Columns dropdown menu in Admin Product Grid.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="optionName" type="string" defaultValue="Name"/>
17+
</arguments>
18+
<click selector="{{AdminProductGridFilterSection.viewColumnOptionName(optionName)}}" stepKey="clickOnTheColumnName"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/>
4040
<element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/>
4141
<element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/>
42+
<element name="viewColumnOptionName" type="text" selector="//div[contains(@class, '_active')]//div[contains(@class, 'admin__data-grid-action-columns-menu')]//div[@class='admin__field-option']//label[text()='{{col}}']" parameterized="true"/>
4243
<element name="customAttribute" type="text" selector="input.admin__control-text[name='{{var}}']" parameterized="true"/>
4344
</section>
4445
</sections>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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="AdminProductGridCustomViewColumnDisplayTest">
12+
<annotations>
13+
<stories value="Product grid columns visibility can be toggled by clicking on their names in the Columns drop-down menu, not just on their respective checkboxes."/>
14+
<title value="Product grid columns visibility can be toggled by clicking on their names in the Columns drop-down menu, not just on their respective checkboxes."/>
15+
<description value="Assert that after rearranging columns order on the product grid in Admin, it will still be possible to toggle the visibility of the columns by clicking on their names in the Columns dropdown menu, and not only on their respective checkboxes."/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="AC-6229"/>
18+
<useCaseId value="ACP2E-1073"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Log in as admin -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearFilters"/>
27+
<actionGroup ref="AdminLogoutActionGroup" stepKey="beginWithLogout"/>
28+
</after>
29+
<!-- Navigate to products list page -->
30+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
31+
<!-- Sort SKU and Name column position -->
32+
<dragAndDrop selector1="{{AdminProductGridSection.columnHeader('SKU')}}" selector2="{{AdminProductGridSection.columnHeader('Name')}}" stepKey="dragAndDropColumnName"/>
33+
<!-- Check if price column is visible in grid -->
34+
<seeElement selector="{{AdminProductGridSection.columnHeader('Price')}}" stepKey="seeProductPriceColumn"/>
35+
<!-- Click on columns, in dropdown uncheck price -->
36+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdownMenuToTogglePrice"/>
37+
<actionGroup ref="AdminToggleProductGridColumnByClickingItsNameActionGroup" stepKey="hidePriceColumn">
38+
<argument name="optionName" value="Price"/>
39+
</actionGroup>
40+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdownMenuAfterTogglePrice"/>
41+
<!-- Price column is not visible in product grid -->
42+
<dontSeeElement selector="{{AdminProductGridSection.columnHeader('Price')}}" stepKey="dontSeeProductPriceColumn"/>
43+
<!-- Check weight column is not visible in product grid -->
44+
<dontSeeElement selector="{{AdminProductGridSection.columnHeader('Weight')}}" stepKey="dontSeeWeightColumn"/>
45+
<!-- Click on columns, in dropdown click on column name weight -->
46+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdownMenuToToggleWeight"/>
47+
<actionGroup ref="AdminToggleProductGridColumnByClickingItsNameActionGroup" stepKey="showWeightColumn">
48+
<argument name="optionName" value="Weight"/>
49+
</actionGroup>
50+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdownMenuAfterToggleWeight"/>
51+
<seeElement selector="{{AdminProductGridSection.columnHeader('Weight')}}" stepKey="seeWeightColumn"/>
52+
</test>
53+
</tests>

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoriesQuery.php

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
use Magento\CatalogGraphQl\Model\Category\CategoryFilter;
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\CategoryTree;
1212
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\ExtractDataFromCategoryTree;
13+
use Magento\Framework\Api\Search\SearchCriteriaFactory;
1314
use Magento\Framework\Exception\InputException;
1415
use Magento\Framework\GraphQl\Config\Element\Field;
1516
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1617
use Magento\Framework\GraphQl\Query\Resolver\ArgumentsProcessorInterface;
1718
use Magento\Framework\GraphQl\Query\ResolverInterface;
1819
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
20+
use Magento\GraphQl\Model\Query\ContextInterface;
21+
use Magento\Store\Api\Data\StoreInterface;
1922

2023
/**
2124
* Categories resolver, used for GraphQL category data request processing.
@@ -42,22 +45,30 @@ class CategoriesQuery implements ResolverInterface
4245
*/
4346
private $argsSelection;
4447

48+
/**
49+
* @var SearchCriteriaFactory
50+
*/
51+
private $searchCriteriaFactory;
52+
4553
/**
4654
* @param CategoryTree $categoryTree
4755
* @param ExtractDataFromCategoryTree $extractDataFromCategoryTree
4856
* @param CategoryFilter $categoryFilter
4957
* @param ArgumentsProcessorInterface $argsSelection
58+
* @param SearchCriteriaFactory $searchCriteriaFactory
5059
*/
5160
public function __construct(
5261
CategoryTree $categoryTree,
5362
ExtractDataFromCategoryTree $extractDataFromCategoryTree,
5463
CategoryFilter $categoryFilter,
55-
ArgumentsProcessorInterface $argsSelection
64+
ArgumentsProcessorInterface $argsSelection,
65+
SearchCriteriaFactory $searchCriteriaFactory
5666
) {
5767
$this->categoryTree = $categoryTree;
5868
$this->extractDataFromCategoryTree = $extractDataFromCategoryTree;
5969
$this->categoryFilter = $categoryFilter;
6070
$this->argsSelection = $argsSelection;
71+
$this->searchCriteriaFactory = $searchCriteriaFactory;
6172
}
6273

6374
/**
@@ -87,7 +98,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8798

8899
$rootCategoryIds = $filterResult['category_ids'] ?? [];
89100

90-
$filterResult['items'] = $this->fetchCategories($rootCategoryIds, $info, (int) $store->getId());
101+
$filterResult['items'] = $this->fetchCategories($rootCategoryIds, $info, $store, $context);
91102
return $filterResult;
92103
}
93104

@@ -96,17 +107,28 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
96107
*
97108
* @param array $categoryIds
98109
* @param ResolveInfo $info
99-
* @param int $storeId
110+
* @param StoreInterface $store
111+
* @param ContextInterface $context
100112
* @return array
101113
*/
102-
private function fetchCategories(array $categoryIds, ResolveInfo $info, int $storeId)
103-
{
114+
private function fetchCategories(
115+
array $categoryIds,
116+
ResolveInfo $info,
117+
StoreInterface $store,
118+
ContextInterface $context
119+
) {
104120
$fetchedCategories = [];
105121
foreach ($categoryIds as $categoryId) {
106-
$categoryTree = $this->categoryTree->getTree($info, $categoryId, $storeId);
107-
if (empty($categoryTree)) {
108-
continue;
109-
}
122+
/* Search Criteria is created for compatibility */
123+
$searchCriteria = $this->searchCriteriaFactory->create();
124+
$categoryTree = $this->categoryTree->getFilteredTree(
125+
$info,
126+
$categoryId,
127+
$searchCriteria,
128+
$store,
129+
[],
130+
$context
131+
);
110132
$fetchedCategories[] = current($this->extractDataFromCategoryTree->execute($categoryTree));
111133
}
112134

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoryList.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver;
99

10+
use Magento\CatalogGraphQl\Model\Category\Filter\SearchCriteria;
1011
use Magento\Store\Api\Data\StoreInterface;
1112
use Magento\GraphQl\Model\Query\ContextInterface;
1213
use Magento\CatalogGraphQl\Model\Category\CategoryFilter;
@@ -45,22 +46,30 @@ class CategoryList implements ResolverInterface
4546
*/
4647
private $argsSelection;
4748

49+
/**
50+
* @var SearchCriteria
51+
*/
52+
private $searchCriteria;
53+
4854
/**
4955
* @param CategoryTree $categoryTree
5056
* @param ExtractDataFromCategoryTree $extractDataFromCategoryTree
5157
* @param CategoryFilter $categoryFilter
5258
* @param ArgumentsProcessorInterface $argsSelection
59+
* @param SearchCriteria $searchCriteria
5360
*/
5461
public function __construct(
5562
CategoryTree $categoryTree,
5663
ExtractDataFromCategoryTree $extractDataFromCategoryTree,
5764
CategoryFilter $categoryFilter,
58-
ArgumentsProcessorInterface $argsSelection
65+
ArgumentsProcessorInterface $argsSelection,
66+
SearchCriteria $searchCriteria
5967
) {
6068
$this->categoryTree = $categoryTree;
6169
$this->extractDataFromCategoryTree = $extractDataFromCategoryTree;
6270
$this->categoryFilter = $categoryFilter;
6371
$this->argsSelection = $argsSelection;
72+
$this->searchCriteria = $searchCriteria;
6473
}
6574

6675
/**
@@ -105,21 +114,19 @@ private function fetchCategories(
105114
array $criteria,
106115
StoreInterface $store,
107116
array $attributeNames,
108-
$context
117+
ContextInterface $context
109118
) : array {
110119
$fetchedCategories = [];
111120
foreach ($categoryIds as $categoryId) {
121+
$searchCriteria = $this->searchCriteria->buildCriteria($criteria, $store);
112122
$categoryTree = $this->categoryTree->getFilteredTree(
113123
$info,
114124
$categoryId,
115-
$criteria,
125+
$searchCriteria,
116126
$store,
117127
$attributeNames,
118128
$context
119129
);
120-
if (empty($categoryTree)) {
121-
continue;
122-
}
123130
$fetchedCategories[] = current($this->extractDataFromCategoryTree->execute($categoryTree));
124131
}
125132

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/CategoryTree.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
1818
use Magento\CatalogGraphQl\Model\AttributesJoiner;
1919
use Magento\CatalogGraphQl\Model\Category\DepthCalculator;
20-
use Magento\CatalogGraphQl\Model\Category\Filter\SearchCriteria;
2120
use Magento\CatalogGraphQl\Model\Category\LevelCalculator;
2221
use Magento\CatalogGraphQl\Model\Resolver\Categories\DataProvider\Category\CollectionProcessorInterface;
22+
use Magento\Framework\Api\Search\SearchCriteria;
2323
use Magento\Framework\EntityManager\MetadataPool;
2424
use Magento\Framework\Exception\LocalizedException;
2525
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
@@ -68,36 +68,28 @@ class CategoryTree
6868
*/
6969
private $collectionProcessor;
7070

71-
/**
72-
* @var SearchCriteria
73-
*/
74-
private $searchCriteria;
75-
7671
/**
7772
* @param CollectionFactory $collectionFactory
7873
* @param AttributesJoiner $attributesJoiner
7974
* @param DepthCalculator $depthCalculator
8075
* @param LevelCalculator $levelCalculator
8176
* @param MetadataPool $metadata
8277
* @param CollectionProcessorInterface $collectionProcessor
83-
* @param SearchCriteria $searchCriteria
8478
*/
8579
public function __construct(
8680
CollectionFactory $collectionFactory,
8781
AttributesJoiner $attributesJoiner,
8882
DepthCalculator $depthCalculator,
8983
LevelCalculator $levelCalculator,
9084
MetadataPool $metadata,
91-
CollectionProcessorInterface $collectionProcessor,
92-
SearchCriteria $searchCriteria
85+
CollectionProcessorInterface $collectionProcessor
9386
) {
9487
$this->collectionFactory = $collectionFactory;
9588
$this->attributesJoiner = $attributesJoiner;
9689
$this->depthCalculator = $depthCalculator;
9790
$this->levelCalculator = $levelCalculator;
9891
$this->metadata = $metadata;
9992
$this->collectionProcessor = $collectionProcessor;
100-
$this->searchCriteria = $searchCriteria;
10193
}
10294

10395
/**
@@ -201,23 +193,23 @@ private function joinAttributesRecursively(
201193
*
202194
* @param ResolveInfo $resolveInfo
203195
* @param int $rootCategoryId
204-
* @param array $criteria
196+
* @param SearchCriteria $searchCriteria
205197
* @param StoreInterface $store
206198
* @param array $attributeNames
207199
* @param ContextInterface $context
208200
* @return Iterator
209201
* @throws LocalizedException
210202
* @throws Exception
203+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
211204
*/
212205
public function getFilteredTree(
213206
ResolveInfo $resolveInfo,
214207
int $rootCategoryId,
215-
array $criteria,
208+
SearchCriteria $searchCriteria,
216209
StoreInterface $store,
217210
array $attributeNames,
218211
ContextInterface $context
219212
): Iterator {
220-
$searchCriteria = $this->searchCriteria->buildCriteria($criteria, $store);
221213
$collection = $this->getCollection($resolveInfo, $rootCategoryId);
222214
$this->collectionProcessor->process($collection, $searchCriteria, $attributeNames, $context);
223215
return $collection->getIterator();

app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckZeroSubtotalOrderIsInProcessingStatusTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
<test name="AdminCheckZeroSubtotalOrderIsInProcessingStatusTest">
1212
<annotations>
1313
<features value="Checkout"/>
14-
<stories value="MAGETWO-71375: Zero Subtotal Orders have incorrect status"/>
14+
<stories value="Zero Subtotal Orders have incorrect status"/>
1515
<title value="Zero Subtotal Orders should have the 'Processing' status on creating"/>
1616
<description value="Created order should be in Processing status"/>
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MAGETWO-94178"/>
19+
<useCaseId value="MAGETWO-71375"/>
1920
<group value="checkout"/>
2021
</annotations>
2122
<before>
@@ -37,7 +38,6 @@
3738
</createData>
3839

3940
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
40-
4141
</before>
4242

4343
<after>

0 commit comments

Comments
 (0)