Skip to content

Commit a3a3b7c

Browse files
authored
Merge branch '2.4-develop' into ASI-1830-stabilize-failing-mftf-tests-in-media-gallery-catalog-ui
2 parents 5a7fc3b + 7ddd47e commit a3a3b7c

File tree

27 files changed

+410
-66
lines changed

27 files changed

+410
-66
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,52 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
7+
use Magento\Framework\Escaper;
8+
use Magento\Framework\View\Helper\SecureHtmlRenderer;
9+
10+
/**
11+
* @var SecureHtmlRenderer $secureRenderer
12+
* @var Escaper $escaper
13+
*/
814
?>
9-
<!-- <?php if ($block->getTitle()): ?>
10-
<h3><?= $block->escapeHtml($block->getTitle()) ?></h3>
11-
<?php endif ?> -->
1215
<?php if (!empty($tabs)): ?>
13-
<div id="<?= $block->escapeHtmlAttr($block->getId()) ?>">
16+
<?php $blockId = $block->getId() ?>
17+
<div id="<?= $escaper->escapeHtmlAttr($blockId) ?>" class="hidden">
1418
<ul class="tabs-horiz">
1519
<?php foreach ($tabs as $_tab): ?>
20+
<?php $tabId = $block->getTabId($_tab) ?>
1621
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
1722
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
1823
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
1924
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
20-
'#' . $block->getTabId($_tab) . '_content' :
25+
'#' . $tabId . '_content' :
2126
$block->getTabUrl($_tab) ?>
2227
<li>
23-
<a href="<?= $block->escapeUrl($_tabHref) ?>"
24-
id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>"
25-
title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>"
26-
class="<?= $block->escapeHtmlAttr($_tabClass) ?>"
27-
data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>">
28+
<a href="<?= $escaper->escapeUrl($_tabHref) ?>"
29+
id="<?= $escaper->escapeHtmlAttr($tabId) ?>"
30+
title="<?= $escaper->escapeHtmlAttr($block->getTabTitle($_tab)) ?>"
31+
class="<?= $escaper->escapeHtmlAttr($_tabClass) ?>"
32+
data-tab-type="<?= $escaper->escapeHtmlAttr($_tabType) ?>">
2833
<span>
2934
<span class="changed"
30-
title="<?= $block->escapeHtmlAttr(__('The information in this tab has been changed.')) ?>"></span>
35+
title="<?= $escaper->escapeHtmlAttr(__(
36+
'The information in this tab has been changed.'
37+
)) ?>"></span>
3138
<span class="error"
32-
title="<?= $block->escapeHtmlAttr(__(
39+
title="<?= $escaper->escapeHtmlAttr(__(
3340
'This tab contains invalid data. Please resolve this before saving.'
3441
)) ?>"></span>
3542
<span class="loader"
36-
title="<?= $block->escapeHtmlAttr(__('Loading...')) ?>"></span>
37-
<?= $block->escapeHtml($block->getTabLabel($_tab)) ?>
43+
title="<?= $escaper->escapeHtmlAttr(__('Loading...')) ?>"></span>
44+
<?= $escaper->escapeHtml($block->getTabLabel($_tab)) ?>
3845
</span>
3946
</a>
40-
<div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content">
47+
<div id="<?= $escaper->escapeHtmlAttr($tabId) ?>_content">
4148
<?= /* @noEscape */ $block->getTabContent($_tab) ?>
4249
</div>
4350
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
4451
'display:none',
45-
'#' . $block->escapeJs($block->getTabId($_tab)) . '_content'
52+
'#' . $escaper->escapeJs($tabId) . '_content'
4653
); ?>
4754
</li>
4855
<?php endforeach; ?>
@@ -51,11 +58,12 @@
5158
<?php $scriptString = <<<script
5259
require(["jquery","mage/backend/tabs"], function($){
5360
$(function() {
54-
$('#{$block->getId()}').tabs({
55-
active: '{$block->getActiveTabId()}',
56-
destination: '#{$block->getDestElementId()}',
61+
$('#{$escaper->escapeJs($blockId)}').tabs({
62+
active: '{$escaper->escapeJs($block->getActiveTabId())}',
63+
destination: '#{$escaper->escapeJs($block->getDestElementId())}',
5764
shadowTabs: {$block->getAllShadowTabs()}
5865
});
66+
$('#{$escaper->escapeJs($blockId)}').removeClass('hidden');
5967
});
6068
});
6169
script;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminDeleteBundleDynamicPriceProductTest">
11+
<annotations>
12+
<features value="Bundle"/>
13+
<stories value="Delete products"/>
14+
<title value="Delete Bundle Dynamic Product"/>
15+
<description value="Admin should be able to delete a bundle dynamic product"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-26056"/>
18+
<group value="mtf_migrated"/>
19+
<group value="bundle"/>
20+
</annotations>
21+
<before>
22+
<!-- Create category and simple product -->
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
25+
26+
<!-- Create bundle product -->
27+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createDynamicBundleProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<createData entity="DropDownBundleOption" stepKey="bundleOption">
31+
<requiredEntity createDataKey="createDynamicBundleProduct"/>
32+
</createData>
33+
<createData entity="ApiBundleLink" stepKey="createNewBundleLink">
34+
<requiredEntity createDataKey="createDynamicBundleProduct"/>
35+
<requiredEntity createDataKey="bundleOption"/>
36+
<requiredEntity createDataKey="createSimpleProduct"/>
37+
</createData>
38+
<!-- TODO: Remove this action when MC-37719 will be fixed -->
39+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
40+
<argument name="indices" value="cataloginventory_stock"/>
41+
</actionGroup>
42+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
43+
</before>
44+
<after>
45+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
46+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
47+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
48+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
49+
</after>
50+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProductBySku">
51+
<argument name="sku" value="$createDynamicBundleProduct.sku$"/>
52+
</actionGroup>
53+
<!-- Verify product on Product Page -->
54+
<amOnPage url="{{StorefrontProductPage.url($createDynamicBundleProduct.custom_attributes[url_key]$)}}" stepKey="openBundleProductPage"/>
55+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoopsMessage"/>
56+
<!-- Search for the product by sku -->
57+
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchBySku">
58+
<argument name="query" value="$createDynamicBundleProduct.sku$"/>
59+
</actionGroup>
60+
<!-- Should not see bundle product -->
61+
<dontSee userInput="$createDynamicBundleProduct.sku$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
62+
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="openCategoryPage"/>
63+
<!-- Should not see any products in category -->
64+
<dontSee userInput="$createDynamicBundleProduct.name$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/>
65+
<see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/>
66+
</test>
67+
</tests>

app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="AdminDeleteBundleDynamicProductTest">
10+
<test name="AdminDeleteBundleDynamicProductTest" deprecated="Use AdminDeleteBundleDynamicPriceProductTest instead">
1111
<annotations>
1212
<features value="Bundle"/>
1313
<stories value="Delete products"/>
14-
<title value="Delete Bundle Dynamic Product"/>
15-
<description value="Admin should be able to delete a bundle dynamic product"/>
14+
<title value="Deprecated. Delete Bundle Dynamic Product"/>
15+
<description value="Deprecated. Admin should be able to delete a bundle dynamic product"/>
1616
<severity value="CRITICAL"/>
1717
<testCaseId value="MC-11016"/>
1818
<group value="mtf_migrated"/>
1919
<skip>
20-
<issueId value="MC-16393"/>
20+
<issueId value="DEPRECATED">Use AdminDeleteBundleDynamicPriceProductTest instead</issueId>
2121
</skip>
2222
</annotations>
2323
<before>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="AdminOpenAttributeSetGridPageActionGroup">
11+
<annotations>
12+
<description>Open the Attribute Sets grid page.</description>
13+
</annotations>
14+
1115
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
1216
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
1317
</actionGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="GoToAttributeGridPageActionGroup">
11+
<actionGroup name="GoToAttributeGridPageActionGroup" deprecated="Use AdminOpenAttributeSetGridPageActionGroup instead.">
1212
<annotations>
1313
<description>Goes to the Attribute Sets grid page.</description>
1414
</annotations>

app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<!-- Assign attribute to set -->
3434
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
35-
<actionGroup ref="GoToAttributeGridPageActionGroup" stepKey="goToAttributeSetPage"/>
35+
<actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="goToAttributeSetPage"/>
3636
<actionGroup ref="GoToAttributeSetByNameActionGroup" stepKey="openAttributeSetByName">
3737
<argument name="name" value="$createAttributeSet.attribute_set_name$"/>
3838
</actionGroup>

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* @SuppressWarnings(PHPMD.TooManyFields)
2323
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2424
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
25+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2526
*
2627
* @api
2728
* @since 100.0.2
@@ -152,6 +153,11 @@ class Storage extends \Magento\Framework\DataObject
152153
*/
153154
private $ioFile;
154155

156+
/**
157+
* @var \Magento\Framework\File\Mime|null
158+
*/
159+
private $mime;
160+
155161
/**
156162
* Construct
157163
*
@@ -174,6 +180,7 @@ class Storage extends \Magento\Framework\DataObject
174180
* @param \Magento\Framework\Filesystem\DriverInterface $file
175181
* @param \Magento\Framework\Filesystem\Io\File|null $ioFile
176182
* @param \Psr\Log\LoggerInterface|null $logger
183+
* @param \Magento\Framework\File\Mime $mime
177184
*
178185
* @throws \Magento\Framework\Exception\FileSystemException
179186
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -197,7 +204,8 @@ public function __construct(
197204
array $data = [],
198205
\Magento\Framework\Filesystem\DriverInterface $file = null,
199206
\Magento\Framework\Filesystem\Io\File $ioFile = null,
200-
\Psr\Log\LoggerInterface $logger = null
207+
\Psr\Log\LoggerInterface $logger = null,
208+
\Magento\Framework\File\Mime $mime = null
201209
) {
202210
$this->_session = $session;
203211
$this->_backendUrl = $backendUrl;
@@ -217,6 +225,7 @@ public function __construct(
217225
$this->_dirs = $dirs;
218226
$this->file = $file ?: ObjectManager::getInstance()->get(\Magento\Framework\Filesystem\Driver\File::class);
219227
$this->ioFile = $ioFile ?: ObjectManager::getInstance()->get(\Magento\Framework\Filesystem\Io\File::class);
228+
$this->mime = $mime ?: ObjectManager::getInstance()->get(\Magento\Framework\File\Mime::class);
220229
parent::__construct($data);
221230
}
222231

@@ -362,7 +371,7 @@ public function getFilesCollection($path, $type = null)
362371
$item->setUrl($this->_cmsWysiwygImages->getCurrentUrl() . $item->getBasename());
363372
$itemStats = $this->file->stat($item->getFilename());
364373
$item->setSize($itemStats['size']);
365-
$item->setMimeType(\mime_content_type($item->getFilename()));
374+
$item->setMimeType($this->mime->getMimeType($item->getFilename()));
366375

367376
if ($this->isImage($item->getBasename())) {
368377
$thumbUrl = $this->getThumbnailUrl($item->getFilename(), true);
@@ -647,7 +656,7 @@ public function resizeFile($source, $keepRatio = true)
647656
$image->keepAspectRatio($keepRatio);
648657

649658
list($imageWidth, $imageHeight) = $this->getResizedParams($source);
650-
659+
651660
$image->resize($imageWidth, $imageHeight);
652661
$dest = $targetDir . '/' . $this->ioFile->getPathInfo($source)['basename'];
653662
$image->save($dest);
@@ -670,7 +679,7 @@ private function getResizedParams(string $source): array
670679

671680
//phpcs:ignore Generic.PHP.NoSilencedErrors
672681
list($imageWidth, $imageHeight) = @getimagesize($source);
673-
682+
674683
if ($imageWidth && $imageHeight) {
675684
$imageWidth = $configWidth > $imageWidth ? $imageWidth : $configWidth;
676685
$imageHeight = $configHeight > $imageHeight ? $imageHeight : $configHeight;
@@ -679,7 +688,7 @@ private function getResizedParams(string $source): array
679688
}
680689
return [$configWidth, $configHeight];
681690
}
682-
691+
683692
/**
684693
* Resize images on the fly in controller action
685694
*

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerGridMainActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<section name="AdminCustomerGridMainActionsSection">
1212
<element name="addNewCustomer" type="button" selector="#add" timeout="30"/>
1313
<element name="multicheck" type="checkbox" selector="#container>div>div.admin__data-grid-wrap>table>thead>tr>th.data-grid-multicheck-cell>div>label"/>
14+
<element name="multicheckTick" type="checkbox" selector="#container>div>div.admin__data-grid-wrap>table>thead>tr>th.data-grid-multicheck-cell>div>input"/>
1415
<element name="delete" type="button" selector="//*[contains(@class, 'admin__data-grid-header')]//span[contains(@class,'action-menu-item') and text()='Delete']"/>
1516
<element name="actions" type="text" selector=".action-select"/>
1617
<element name="customerCheckbox" type="button" selector="//*[contains(text(),'{{arg}}')]/parent::td/preceding-sibling::td/label[@class='data-grid-checkbox-cell-inner']//input" parameterized="true"/>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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="AdminGridSearchSelectAllTest">
11+
<annotations>
12+
<stories value="Selection should be removed during search."/>
13+
<title value="Selection should be removed during search."/>
14+
<description value="Empty selected before and after search, like it works for filter"/>
15+
<testCaseId value="MC-37659"/>
16+
<severity value="CRITICAL"/>
17+
<group value="uI"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<!--Create three customers-->
22+
<createData entity="Simple_US_Customer" stepKey="firstCustomer"/>
23+
<createData entity="Simple_US_Customer" stepKey="secondCustomer"/>
24+
<createData entity="Simple_US_Customer" stepKey="thirdCustomer"/>
25+
</before>
26+
<after>
27+
<!--Remove two created customers, third already deleted-->
28+
<deleteData createDataKey="firstCustomer" stepKey="deleteFirstCustomer"/>
29+
<deleteData createDataKey="secondCustomer" stepKey="deleteSecondCustomer"/>
30+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
31+
</after>
32+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomerPage"/>
33+
<!-- search Admin Data Grid By Keyword -->
34+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
35+
<fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="$$secondCustomer.email$$" stepKey="fillKeywordSearchFieldWithSecondCustomerEmail"/>
36+
<click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickKeywordSearch"/>
37+
<waitForPageLoad stepKey="waitForPageLoad"/>
38+
<!-- Select all from dropdown -->
39+
<actionGroup ref="AdminGridSelectAllActionGroup" stepKey="selectAllCustomers"/>
40+
<!-- Clear searching By Keyword-->
41+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFiltersAfterSearch"/>
42+
<waitForPageLoad stepKey="waitForPageLoadAfterSearchRemoved"/>
43+
<!-- Check if selection has bee removed -->
44+
<dontSeeCheckboxIsChecked selector="{{AdminCustomerGridMainActionsSection.customerCheckbox($$secondCustomer.email$$)}}" stepKey="checkSecondCustomerCheckboxIsUnchecked"/>
45+
<!-- Check delete action -->
46+
<click selector="{{AdminCustomerGridMainActionsSection.customerCheckbox(($$thirdCustomer.email$$)}}" stepKey="selectThirdCustomer"/>
47+
<seeCheckboxIsChecked selector="{{AdminCustomerGridMainActionsSection.customerCheckbox($$thirdCustomer.email$$)}}" stepKey="checkThirdCustomerIsChecked"/>
48+
<!-- Use delete action for selected -->
49+
<click selector="{{AdminCustomerGridMainActionsSection.actions}}" stepKey="clickActions"/>
50+
<click selector="{{AdminCustomerGridMainActionsSection.delete}}" stepKey="clickDelete"/>
51+
<waitForAjaxLoad stepKey="waitForLoadConfirmation"/>
52+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/>
53+
<!-- Check if only one record record has been deleted -->
54+
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) were deleted" stepKey="seeSuccess"/>
55+
</test>
56+
</tests>

0 commit comments

Comments
 (0)