Skip to content

Commit 8311af5

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into HB-PR-delivery-Oct
2 parents 6fd1a30 + a7bde28 commit 8311af5

File tree

48 files changed

+1182
-79
lines changed

Some content is hidden

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

48 files changed

+1182
-79
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Relation.php

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,38 @@
55
*/
66
namespace Magento\Catalog\Model\ResourceModel\Product;
77

8+
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
10+
use Magento\Framework\Model\ResourceModel\Db\Context;
11+
use Magento\Framework\EntityManager\MetadataPool;
12+
use Magento\Catalog\Api\Data\ProductInterface;
13+
814
/**
915
* Catalog Product Relations Resource model
1016
*
1117
* @author Magento Core Team <[email protected]>
1218
*/
13-
class Relation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
19+
class Relation extends AbstractDb
1420
{
21+
/**
22+
* @var MetadataPool
23+
*/
24+
private $metadataPool;
25+
26+
/**
27+
* @param Context $context
28+
* @param string $connectionName
29+
* @param MetadataPool $metadataPool
30+
*/
31+
public function __construct(
32+
Context $context,
33+
$connectionName = null,
34+
MetadataPool $metadataPool = null
35+
) {
36+
parent::__construct($context, $connectionName);
37+
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
38+
}
39+
1540
/**
1641
* Initialize resource model and define main table
1742
*
@@ -109,4 +134,27 @@ public function removeRelations($parentId, $childIds)
109134
}
110135
return $this;
111136
}
137+
138+
/**
139+
* Finds parent relations by given children ids.
140+
*
141+
* @param array $childrenIds Child products entity ids.
142+
* @return array Parent products entity ids.
143+
*/
144+
public function getRelationsByChildren(array $childrenIds): array
145+
{
146+
$connection = $this->getConnection();
147+
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)
148+
->getLinkField();
149+
$select = $connection->select()
150+
->from(
151+
['cpe' => $this->getTable('catalog_product_entity')],
152+
'entity_id'
153+
)->join(
154+
['relation' => $this->getTable('catalog_product_relation')],
155+
'relation.parent_id = cpe.' . $linkField
156+
)->where('relation.child_id IN(?)', $childrenIds);
157+
158+
return $connection->fetchCol($select);
159+
}
112160
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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="AdminCmsPageFillOutBasicFieldsActionGroup">
12+
<annotations>
13+
<description>Fills out the Page details (Page Title, Content and URL Key) on the Admin Page creation/edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="title" type="string" defaultValue="{{_defaultCmsPage.title}}"/>
17+
<argument name="contentHeading" type="string" defaultValue="{{_defaultCmsPage.content_heading}}"/>
18+
<argument name="content" type="string" defaultValue="{{_defaultCmsPage.content}}"/>
19+
<argument name="urlKey" type="string" defaultValue="{{_defaultCmsPage.identifier}}"/>
20+
</arguments>
21+
22+
<fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{title}}" stepKey="fillTitle"/>
23+
<conditionalClick selector="{{CmsNewPagePageContentSection.header}}" dependentSelector="{{CmsNewPagePageContentSection.contentHeading}}" visible="false" stepKey="expandContentTabIfCollapsed"/>
24+
<fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{contentHeading}}" stepKey="fillContentHeading"/>
25+
<scrollTo selector="{{CmsNewPagePageContentSection.content}}" stepKey="scrollToPageContent"/>
26+
<fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{content}}" stepKey="fillContent"/>
27+
<conditionalClick selector="{{CmsNewPagePageSeoSection.header}}" dependentSelector="{{CmsNewPagePageSeoSection.urlKey}}" visible="false" stepKey="clickExpandSearchEngineOptimisationIfCollapsed"/>
28+
<fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{urlKey}}" stepKey="fillUrlKey"/>
29+
</actionGroup>
30+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableWYSIWYGActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<description>Runs bin/magento command to disable WYSIWYG</description>
1414
</annotations>
1515

16-
<magentoCLI stepKey="disableWYSIWYG" command="config:set cms/wysiwyg/enabled disabled"/>
16+
<magentoCLI command="config:set {{WysiwygDisabledByDefault.path}} {{WysiwygDisabledByDefault.value}}" stepKey="disableWYSIWYG"/>
1717
</actionGroup>
1818
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminEnableWYSIWYGActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<description>Runs bin/magento command to enable WYSIWYG</description>
1414
</annotations>
1515

16-
<magentoCLI stepKey="enableWYSIWYG" command="config:set cms/wysiwyg/enabled enabled"/>
16+
<magentoCLI command="config:set {{WysiwygEnabledByDefault.path}} {{WysiwygEnabledByDefault.value}}" stepKey="enableWYSIWYG"/>
1717
</actionGroup>
1818
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AdminSaveAndContinueEditCmsPageActionGroup">
12+
<annotations>
13+
<description>Clicks on the Save and Continue button and see success message.</description>
14+
</annotations>
15+
16+
<scrollToTopOfPage stepKey="scrollToTopOfThePage"/>
17+
<waitForElementVisible selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="waitForSaveAndContinueButton"/>
18+
<click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSaveAndContinueButton"/>
19+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
20+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the page." stepKey="seeSuccessMessage"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndContinueEditCmsPageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="SaveAndContinueEditCmsPageActionGroup">
1212
<annotations>
13-
<description>Clicks on the Save and Continue button.</description>
13+
<description>DEPRECATED. Use AdminSaveAndContinueEditCmsPageActionGroup instead. Clicks on the Save and Continue button.</description>
1414
</annotations>
1515

1616
<waitForElementVisible time="10" selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="waitForSaveAndContinueVisibility"/>

app/code/Magento/Cms/Test/Mftf/Data/WysiwygConfigData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<entity name="WysiwygDisabledByDefault">
1717
<data key="path">cms/wysiwyg/enabled</data>
1818
<data key="scope_id">0</data>
19-
<data key="value">hidden</data>
19+
<data key="value">disabled</data>
2020
</entity>
2121
<entity name="WysiwygTinyMCE3Enable" deprecated="Use WysiwygTinyMCE4Enable instead">
2222
<data key="path">cms/wysiwyg/editor</data>

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/MediaGallerySection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
<element name="checkIfWysiwygArrowExpand" type="button" selector="//li[@id='d3lzaXd5Zw--' and contains(@class,'jstree-closed')]"/>
3737
<element name="confirmDelete" type="button" selector=".action-primary.action-accept"/>
3838
<element name="imageBlockByName" type="block" selector="//div[@data-row='file'][contains(., '{{imageName}}')]" parameterized="true"/>
39+
<element name="insertEditImageModalWindow" type="block" selector=".mce-floatpanel.mce-window[aria-label='Insert/edit image']"/>
3940
</section>
4041
</sections>

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<argument name="filterPlaceholder" type="string"/>
1616
</arguments>
1717

18+
<waitForPageLoad stepKey="waitVisibleFilter"/>
19+
<waitForElementVisible selector="{{AdminProductGridFilterSection.enabledFilters}}" stepKey="waitForRequest"/>
1820
<see selector="{{AdminProductGridFilterSection.enabledFilters}}" userInput="{{filterPlaceholder}}" stepKey="seeFilter"/>
1921
</actionGroup>
2022
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminMediaGalleryCatalogUiUsedInProductFilterOnTest">
11+
<annotations>
12+
<features value="MediaGalleryCatalogUi"/>
13+
<stories value="Story 58 - User sees entities where asset is used in" />
14+
<title value="User can open the product entity the asset is associated"/>
15+
<description value="User filters assets used in products"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/943908/scenarios/4523889"/>
18+
<useCaseId value="https://github.com/magento/adobe-stock-integration/issues/1503"/>
19+
<group value="media_gallery_ui"/>
20+
</annotations>
21+
22+
<before>
23+
<magentoCLI command="config:set {{WysiwygEnabledByDefault.path}} {{WysiwygEnabledByDefault.value}}" stepKey="enableWYSIWYG"/>
24+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
</before>
27+
28+
<after>
29+
<magentoCLI command="config:set {{WysiwygDisabledByDefault.path}} {{WysiwygDisabledByDefault.value}}" stepKey="disableWYSIWYG"/>
30+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
31+
<actionGroup ref="AdminOpenStandaloneMediaGalleryActionGroup" stepKey="openMediaGallery"/>
32+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/>
33+
<actionGroup ref="AdminEnhancedMediaGalleryViewImageDetails" stepKey="openViewImageDetailsToAssertEmptyUsedIn"/>
34+
<actionGroup ref="AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup" stepKey="assertThereIsNoUsedInSection"/>
35+
<actionGroup ref="AdminEnhancedMediaGalleryCloseViewDetailsActionGroup" stepKey="closeDetails"/>
36+
37+
<actionGroup ref="AdminEnhancedMediaGalleryEnableMassActionModeActionGroup" stepKey="enableMassActionToDeleteImages"/>
38+
<actionGroup ref="AdminEnhancedMediaGallerySelectImageForMassActionActionGroup" stepKey="selectFirstImageToDelete">
39+
<argument name="imageName" value="{{ImageMetadata.title}}"/>
40+
</actionGroup>
41+
<actionGroup ref="AdminEnhancedMediaGalleryClickDeleteImagesButtonActionGroup" stepKey="clickDeleteSelectedButton"/>
42+
<actionGroup ref="AdminEnhancedMediaGalleryConfirmDeleteImagesActionGroup" stepKey="deleteImages"/>
43+
44+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersAfterDeleteImages"/>
45+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
46+
</after>
47+
48+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
49+
<argument name="productId" value="$createProduct.id$"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminOpenMediaGalleryTinyMce4ActionGroup" stepKey="openMediaGalleryFromWysiwyg"/>
52+
<actionGroup ref="AdminEnhancedMediaGalleryUploadImageActionGroup" stepKey="uploadImage">
53+
<argument name="image" value="ImageUpload3"/>
54+
</actionGroup>
55+
<actionGroup ref="AdminMediaGalleryClickImageInGridActionGroup" stepKey="selectContentImageInGrid">
56+
<argument name="imageName" value="{{ImageMetadata.title}}"/>
57+
</actionGroup>
58+
<actionGroup ref="AdminMediaGalleryClickAddSelectedActionGroup" stepKey="clickAddSelectedContentImage"/>
59+
<actionGroup ref="AdminMediaGalleryClickOkButtonTinyMce4ActionGroup" stepKey="clickOkButton"/>
60+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
61+
<actionGroup ref="AdminOpenStandaloneMediaGalleryActionGroup" stepKey="openStandaloneMediaGallery"/>
62+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/>
63+
<actionGroup ref="AdminEnhancedMediaGalleryExpandFilterActionGroup" stepKey="expandFilters"/>
64+
<actionGroup ref="AdminEnhancedMediaGallerySelectUsedInFilterActionGroup" stepKey="setUsedInFilter">
65+
<argument name="filterName" value="Used in Products"/>
66+
<argument name="optionName" value="$createProduct.name$"/>
67+
</actionGroup>
68+
<actionGroup ref="AdminEnhancedMediaGalleryApplyFiltersActionGroup" stepKey="applyFilters"/>
69+
<actionGroup ref="AdminEnhancedMediaGalleryViewImageDetails" stepKey="openViewImageDetails"/>
70+
<actionGroup ref="AdminEnhancedMediaGalleryClickEntityUsedInActionGroup" stepKey="clickUsedInProducts">
71+
<argument name="entityName" value="Products"/>
72+
</actionGroup>
73+
<actionGroup ref="AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup" stepKey="assertFilterApplied">
74+
<argument name="filterPlaceholder" value="{{ImageMetadata.title}}"/>
75+
</actionGroup>
76+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersOnProductGrid"/>
77+
78+
</test>
79+
</tests>

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="AdminMediaGalleryCatalogUiUsedInProductFilterTest">
10+
<test name="AdminMediaGalleryCatalogUiUsedInProductFilterTest" deprecated="Use AdminMediaGalleryCatalogUiUsedInProductFilterOnTest instead">
1111
<annotations>
1212
<features value="AdminMediaGalleryUsedInProductsFilter"/>
1313
<useCaseId value="https://github.com/magento/adobe-stock-integration/issues/1503"/>
14-
<title value="User can open product entity the asset is associated"/>
14+
<title value="Deprecated. User can open product entity the asset is associated"/>
1515
<stories value="Story 58: User sees entities where asset is used in" />
1616
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/943908/scenarios/4523889"/>
1717
<description value="User filters assets used in products"/>
1818
<severity value="CRITICAL"/>
1919
<group value="media_gallery_ui"/>
20+
<skip>
21+
<issueId value="DEPRECATED">Use AdminMediaGalleryCatalogUiUsedInProductFilterOnTest instead</issueId>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<magentoCLI command="config:set cms/wysiwyg/enabled enabled" stepKey="enableWYSIWYG"/>

app/code/Magento/MediaGalleryCmsUi/Test/Mftf/ActionGroup/FillOutCustomCMSPageContentActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="FillOutCustomCMSPageContentActionGroup">
1212
<annotations>
13-
<description>Fills out the Page details (Page Title, Content and URL Key)</description>
13+
<description>DEPRECATED. Use AdminCmsPageFillOutBasicFieldsActionGroup and other AGs from CMS module. Fills out the Page details (Page Title, Content and URL Key)</description>
1414
</annotations>
1515

1616
<arguments>

0 commit comments

Comments
 (0)