Skip to content

Commit fc281c6

Browse files
committed
Merge remote-tracking branch 'origin/develop' into AC-8095_v1
2 parents c97e337 + 78b3a4e commit fc281c6

File tree

262 files changed

+1722
-572
lines changed

Some content is hidden

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

262 files changed

+1722
-572
lines changed

app/code/Magento/AwsS3PageBuilder/Test/Mftf/Suite/RemoteStorageAwsS3EnabledPageBuilderSuite.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
<magentoCLI command="config:set web/default_layouts/default_cms_layout cms-full-width" stepKey="setPageBuilderDefaultCmsLayout"/>
1919
<magentoCLI command="config:set web/default_layouts/default_category_layout category-full-width" stepKey="setPageBuilderDefaultCategoryLayout"/>
2020
<magentoCLI command="config:set web/default_layouts/default_product_layout product-full-width" stepKey="setPageBuilderDefaultProductLayout"/>
21-
<magentoCLI command="cache:clean config" stepKey="flushCache"/>
21+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
22+
<argument name="tags" value="config"/>
23+
</actionGroup>
2224
</before>
2325
<after>
2426
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
@@ -28,7 +30,9 @@
2830
</actionGroup>
2931
<magentoCLI command="config:set cms/wysiwyg/enabled disabled" stepKey="disableWYSIWYG"/>
3032
<magentoCLI command="config:set cms/pagebuilder/google_maps_api_key ''" stepKey="setEmptyGoogleMapsAPIKey"/>
31-
<magentoCLI command="cache:clean config" stepKey="flushCache"/>
33+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
34+
<argument name="tags" value="config"/>
35+
</actionGroup>
3236
</after>
3337
<include>
3438
<group name="remote_storage_aws_s3_pagebuilder"/>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ImageAddImageContentTypeToCMSPageTest
2+
ImageAddImageIntoPageBuilderStageTest
3+
ImageInvalidFileTypeValidationTest
4+
ImageRemoveImageFromStageTest
5+
PageBuilderCreateTemplateOnCMSBlockForPageAndApplyTemplateToCatalogCategory
6+
PageBuilderDeleteTemplate
7+
PageBuilderVerifySaveContentAsTemplateModalAndApplyTemplateSlideOut
8+
CanAddVideoToColumnTest
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderImageTest/AwsS3ImageAddImageContentTypeToCMSPageTest.xml"
3+
contains entity references that violate dependency constraints:
4+
5+
ImageAddImageContentTypeToCMSPageTest from module(s): magento/module-page-builder
6+
7+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderImageTest/AwsS3ImageAddImageIntoPageBuilderStageTest.xml"
8+
contains entity references that violate dependency constraints:
9+
10+
ImageAddImageIntoPageBuilderStageTest from module(s): magento/module-page-builder
11+
12+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderImageTest/AwsS3ImageInvalidFileTypeValidationTest.xml"
13+
contains entity references that violate dependency constraints:
14+
15+
ImageInvalidFileTypeValidationTest from module(s): magento/module-page-builder
16+
17+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderImageTest/AwsS3ImageRemoveImageFromStageTest.xml"
18+
contains entity references that violate dependency constraints:
19+
20+
ImageRemoveImageFromStageTest from module(s): magento/module-page-builder
21+
22+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderTemplateTests/AwsS3PageBuilderCreateTemplateOnCMSBlockForPageAndApplyTemplateToCatalogCategory.xml"
23+
contains entity references that violate dependency constraints:
24+
25+
PageBuilderCreateTemplateOnCMSBlockForPageAndApplyTemplateToCatalogCategory from module(s): magento/module-page-builder
26+
27+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderTemplateTests/AwsS3PageBuilderDeleteTemplate.xml"
28+
contains entity references that violate dependency constraints:
29+
30+
PageBuilderDeleteTemplate from module(s): magento/module-page-builder
31+
32+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderTemplateTests/AwsS3PageBuilderVerifySaveContentAsTemplateModalAndApplyTemplateSlideOut.xml"
33+
contains entity references that violate dependency constraints:
34+
35+
PageBuilderVerifySaveContentAsTemplateModalAndApplyTemplateSlideOut from module(s): magento/module-banner-page-builder, magento/module-page-builder
36+
37+
File "/var/www/html/app/code/Magento/AwsS3PageBuilder/Test/Mftf/Test/AdminPageBuilderVideoTest/AwsS3CanAddVideoToColumnTest.xml"
38+
contains entity references that violate dependency constraints:
39+
40+
CanAddVideoToColumnTest from module(s): magento/module-page-builder

app/code/Magento/PageBuilder/Model/Catalog/ProductTotals.php

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1515
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
1616
use Magento\CatalogWidget\Model\Rule;
17+
use Magento\Framework\App\ObjectManager;
18+
use Magento\Framework\App\ResourceConnection;
19+
use Magento\Framework\EntityManager\MetadataPool;
1720
use Magento\Framework\Exception\LocalizedException;
1821
use Magento\Framework\Exception\NoSuchEntityException;
1922
use Magento\Rule\Model\Condition\Combine;
@@ -53,25 +56,41 @@ class ProductTotals
5356
*/
5457
private $categoryRepository;
5558

59+
/**
60+
* @var MetadataPool
61+
*/
62+
private MetadataPool $metadataPool;
63+
64+
/**
65+
* @var ResourceConnection
66+
*/
67+
private ResourceConnection $resource;
68+
5669
/**
5770
* @param CollectionFactory $productCollectionFactory
5871
* @param Builder $sqlBuilder
5972
* @param Rule $rule
6073
* @param Conditions $conditionsHelper
6174
* @param CategoryRepositoryInterface $categoryRepository
75+
* @param MetadataPool|null $metadataPool
76+
* @param ResourceConnection|null $resource
6277
*/
6378
public function __construct(
6479
CollectionFactory $productCollectionFactory,
6580
Builder $sqlBuilder,
6681
Rule $rule,
6782
Conditions $conditionsHelper,
68-
CategoryRepositoryInterface $categoryRepository
83+
CategoryRepositoryInterface $categoryRepository,
84+
?MetadataPool $metadataPool = null,
85+
?ResourceConnection $resource = null
6986
) {
7087
$this->productCollectionFactory = $productCollectionFactory;
7188
$this->sqlBuilder = $sqlBuilder;
7289
$this->rule = $rule;
7390
$this->conditionsHelper = $conditionsHelper;
7491
$this->categoryRepository = $categoryRepository;
92+
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
93+
$this->resource = $resource ?: ObjectManager::getInstance()->get(ResourceConnection::class);
7594
}
7695

7796
/**
@@ -159,37 +178,85 @@ private function getProductCollection(string $conditions, bool $usePriceIndex =
159178
return $collection;
160179
}
161180

181+
/**
182+
* Get parent products that don't have stand-alone properties (e.g. price or special price)
183+
*
184+
* @param Collection $collection
185+
* @return Collection|null
186+
* @throws \Exception
187+
*/
188+
private function getParentProductsCollection(Collection $collection): ?Collection
189+
{
190+
$parentProducts = $this->productCollectionFactory->create();
191+
$linkField = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
192+
->getLinkField();
193+
$connection = $this->resource->getConnection();
194+
$productIds = $connection->fetchCol(
195+
$connection
196+
->select()
197+
->from(['e' => $collection->getTable('catalog_product_entity')], ['link_table.parent_id'])
198+
->joinInner(
199+
['link_table' => $collection->getTable('catalog_product_super_link')],
200+
'link_table.product_id = e.' . $linkField,
201+
[]
202+
)
203+
->where('link_table.product_id IN (?)', $collection->getAllIds())
204+
);
205+
if ($productIds) {
206+
$parentProducts->addIdFilter($productIds);
207+
return $parentProducts;
208+
}
209+
210+
return null;
211+
}
212+
162213
/**
163214
* Retrieve count of all enabled products
164215
*
165216
* @param string $conditions
166217
* @return int number of enabled products
218+
* @throws LocalizedException
219+
* @throws \Exception
167220
*/
168221
private function getEnabledCount(string $conditions): int
169222
{
170223
$collection = $this->getProductCollection($conditions, true);
171224
$collection->addAttributeToFilter('status', Status::STATUS_ENABLED);
172-
return $collection->getSize();
225+
$count = $collection->getSize();
226+
if ($collection->getSize() && $parentProducts = $this->getParentProductsCollection($collection)) {
227+
$parentProducts->addAttributeToFilter('status', Status::STATUS_ENABLED);
228+
$count += $parentProducts->getSize();
229+
}
230+
231+
return $count;
173232
}
174233

175234
/**
176235
* Retrieve count of all disabled products
177236
*
178237
* @param string $conditions
179238
* @return int number of disabled products
239+
* @throws \Exception
180240
*/
181241
private function getDisabledCount(string $conditions): int
182242
{
183243
$collection = $this->getProductCollection($conditions, false);
184244
$collection->addAttributeToFilter('status', Status::STATUS_DISABLED);
185-
return $collection->getSize();
245+
$count = $collection->getSize();
246+
if ($count && $parentProducts = $this->getParentProductsCollection($collection)) {
247+
$parentProducts->addAttributeToFilter('status', Status::STATUS_DISABLED);
248+
$count += $parentProducts->getSize();
249+
}
250+
251+
return $count;
186252
}
187253

188254
/**
189255
* Retrieve count of all not visible individually products
190256
*
191257
* @param string $conditions
192258
* @return int number of products not visible individually
259+
* @throws \Exception
193260
*/
194261
private function getNotVisibleCount(string $conditions): int
195262
{
@@ -202,7 +269,20 @@ private function getNotVisibleCount(string $conditions): int
202269
Visibility::VISIBILITY_IN_SEARCH
203270
]
204271
);
205-
return $collection->getSize();
272+
$count = $collection->getSize();
273+
if ($count && $parentProducts = $this->getParentProductsCollection($collection)) {
274+
$parentProducts->addAttributeToFilter('status', Status::STATUS_ENABLED);
275+
$parentProducts->addAttributeToFilter(
276+
'visibility',
277+
[
278+
Visibility::VISIBILITY_NOT_VISIBLE,
279+
Visibility::VISIBILITY_IN_SEARCH
280+
]
281+
);
282+
$count += $parentProducts->getSize();
283+
}
284+
285+
return $count;
206286
}
207287

208288
/**

app/code/Magento/PageBuilder/Model/ResourceModel/Template/Grid/Collection.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class Collection extends TemplateCollection implements SearchResultInterface
3131
*/
3232
private $aggregations;
3333

34+
/** @var string */
35+
private $model;
36+
37+
/** @var string */
38+
private $resourceModel;
39+
3440
/**
3541
* @param EntityFactoryInterface $entityFactory
3642
* @param LoggerInterface $logger
@@ -58,6 +64,8 @@ public function __construct(
5864
$connection = null,
5965
AbstractDb $resource = null
6066
) {
67+
$this->resourceModel = $resourceModel;
68+
$this->model = $model;
6169
parent::__construct(
6270
$entityFactory,
6371
$logger,
@@ -68,10 +76,19 @@ public function __construct(
6876
);
6977
$this->_eventPrefix = $eventPrefix;
7078
$this->_eventObject = $eventObject;
71-
$this->_init($model, $resourceModel);
79+
$this->_init($this->model, $this->resourceModel);
7280
$this->setMainTable($mainTable);
7381
}
7482

83+
/**
84+
* @inheritDoc
85+
*/
86+
public function _resetState(): void
87+
{
88+
parent::_resetState();
89+
$this->_init($this->model, $this->resourceModel);
90+
}
91+
7592
/**
7693
* Get aggregations
7794
*

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminActionGroup/SwitchToPageBuilderStageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<argument name="editButtonSelector" defaultValue="{{PageBuilderStage.editButtonSelector}}" type="string"/>
1616
<argument name="rowIndex" defaultValue="1" type="string"/>
1717
</arguments>
18-
<waitForElementVisible time="30" selector="{{sectionSelector}}" stepKey="waitForSection"/>
18+
<waitForElementClickable selector="{{sectionSelector}}" stepKey="waitForSection"/>
1919
<conditionalClick selector="{{sectionSelector}}" dependentSelector="{{sectionDependentSelector}}" visible="false" stepKey="expandSection"/>
2020
<waitForPageLoad time="30" stepKey="waitForStageToLoad"/>
2121
<waitForElementVisible time="30" selector="{{snapshotSelector}}" stepKey="waitForSnapshot"/>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminActionGroup/VerifyFullWidthLayoutActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<argument name="index" defaultValue="0" type="string"/>
1313
</arguments>
1414
<executeJS function="return document.querySelectorAll('[data-content-type=row]')[{{index}}].clientWidth" stepKey="rowWidth"/>
15-
<executeJS function="return document.querySelector('[class=page-wrapper]').clientWidth" stepKey="pageWidth"/>
15+
<executeJS function="return document.querySelector('main#maincontent').clientWidth" stepKey="pageWidth"/>
1616
<assertEquals stepKey="assertRowWidth100Percent">
1717
<expectedResult type="variable">pageWidth</expectedResult>
1818
<actualResult type="variable">rowWidth</actualResult>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/BackgroundConfigurationActionGroup/ValidateBackgroundMobileImageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
</assertRegExp>
2929
<resizeWindow width="767" height="1000" stepKey="resizeWindowToMobile"/>
3030
<waitForElementVisible selector="{{section.backgroundMobileImage(index, backgroundMobileImage.fileName)}}" stepKey="waitForBackgroundMobileImageVisible"/>
31-
<resizeWindow width="1280" height="1024" stepKey="resizeWindowToDesktop"/>
31+
<resizeWindow width="1920" height="1080" stepKey="resizeWindowToDesktop"/>
3232
</actionGroup>
3333
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/ContentTypeProductsActionGroup/StorefrontClickProductAddToCartValidateAsyncActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
<waitForElementVisible selector="{{ProductsOnStorefront.productImageByProductName(product)}}" stepKey="waitForProductImage"/>
1515
<moveMouseOver selector="{{ProductsOnStorefront.productImageByProductName(product)}}" stepKey="moveMouseOverProduct"/>
1616
<click selector="{{ProductsOnStorefront.productAddToCartByProductName(product)}}" stepKey="clickProductAddToCart"/>
17-
<seeElement selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="seeAddingButtonLabel"/>
17+
<seeElement selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddingOrAdded}}" stepKey="seeAddingButtonLabel"/>
1818
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForAddedButtonLabel"/>
1919
<seeElement selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="seeAddedButtonLabel"/>
2020
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
21-
<see userInput="You added {{product}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
21+
<waitForText userInput="You added {{product}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
2222
</actionGroup>
2323
</actionGroups>

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/ContentTypeRowActionGroup/ValidateContainedRowAppearanceActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<argument name="index" defaultValue="1" type="string"/>
1515
</arguments>
1616
<comment userInput="Increase window size to see varying widths for rows" stepKey="commentResizeWindow"/>
17-
<resizeWindow width="1920" height="1024" stepKey="resizeWindow"/>
17+
<resizeWindow width="2560" height="1440" stepKey="resizeWindow"/>
1818
<executeJS function="return {{pageOrStageWidthJS}}" stepKey="pageOrStageWidth"/>
1919
<executeJS function="return {{section.rowWidthJS(index)}}" stepKey="rowWidth"/>
2020
<assertGreaterThan stepKey="assertRowWidthGreaterThanZero">
@@ -25,6 +25,6 @@
2525
<expectedResult type="variable">pageOrStageWidth</expectedResult>
2626
<actualResult type="variable">rowWidth</actualResult>
2727
</assertLessThan>
28-
<resizeWindow width="1280" height="1024" stepKey="resizeWindowToDesktop"/>
28+
<resizeWindow width="1920" height="1080" stepKey="resizeWindowToDesktop"/>
2929
</actionGroup>
3030
</actionGroups>

0 commit comments

Comments
 (0)