Skip to content

Commit 8eb9deb

Browse files
authored
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop daily delivery
Accepted Community Pull Requests: - #26784: [Forward Port PR-14344] Fix generating product URL rewrites for anchor categories (by @hostep) - #27261: 20472 added product list price modifier (by @sergiy-v) - #27284: Fix static test failures for class annotaions (by @ihor-sviziev) - #27274: MFTF: Create Account tests (Success & Failure) with `extend` (by @lbajsarowicz) - #27281: TYPO: Fix annoying typo in Quantity word (by @lbajsarowicz) - #27277: MFTF: Rename and rewrite Test that fake expired session (by @lbajsarowicz) - #26348: Fixed #26345 Reorder in Admin panel leads to report page in case of changed product custom option max characters (by @cedmudit) - #26746: In System/Export controlers use MessageManager instead of throwing exceptions (by @pmarki) - #27249: Update Frontend Development Workflow type's comment to be clearer (by @navarr) Fixed GitHub Issues: - #4112: Wrong parent category url_key in URL (reported by @bh-ref) has been fixed in #26784 by @hostep in 2.4-develop branch Related commits: 1. cb685d1 2. acb8642 3. 97258e1 4. 6cf26dc 5. 0b94121 6. b0c0c59 7. 28fa345 8. bf514b0 - #11615: URL Rewrites vs multiple storeviews - a never ending battle (reported by @hostep) has been fixed in #26784 by @hostep in 2.4-develop branch Related commits: 1. cb685d1 2. acb8642 3. 97258e1 4. 6cf26dc 5. 0b94121 6. b0c0c59 7. 28fa345 8. bf514b0 - #11616: URL Rewrites vs multiple storeviews - too many rewrites are being generated (reported by @hostep) has been fixed in #26784 by @hostep in 2.4-develop branch Related commits: 1. cb685d1 2. acb8642 3. 97258e1 4. 6cf26dc 5. 0b94121 6. b0c0c59 7. 28fa345 8. bf514b0 - #25124: Magento 2.3 Wrong product url for anchor categories for multiple storeviews (reported by @juharintanen) has been fixed in #26784 by @hostep in 2.4-develop branch Related commits: 1. cb685d1 2. acb8642 3. 97258e1 4. 6cf26dc 5. 0b94121 6. b0c0c59 7. 28fa345 8. bf514b0 - #26393: Product category url rewrite missing storeview specific url_key (reported by @juhanihaapala) has been fixed in #26784 by @hostep in 2.4-develop branch Related commits: 1. cb685d1 2. acb8642 3. 97258e1 4. 6cf26dc 5. 0b94121 6. b0c0c59 7. 28fa345 8. bf514b0 - #20472: Special Price shown without currency symbol in magento backoffice (reported by @XxXgeoXxX) has been fixed in #27261 by @sergiy-v in 2.4-develop branch Related commits: 1. d81d1d4 - #20906: Magento backend catalog "Cost" without currency symbol (reported by @mage2pratik) has been fixed in #27261 by @sergiy-v in 2.4-develop branch Related commits: 1. d81d1d4 - #21910: Magento backend catalog "MSRP" without currency symbol (reported by @mage2pratik) has been fixed in #27261 by @sergiy-v in 2.4-develop branch Related commits: 1. d81d1d4 - #26345: Reorder in Admin panel leads to report page in case of changed product custom option max characters (reported by @oleksii-lisovyi) has been fixed in #26348 by @cedmudit in 2.4-develop branch Related commits: 1. 16079d9 2. 86dc12d 3. a21b246 4. 43f9e2b 5. 7ba11b8 6. 6c5fbcb 7. f7819a6
2 parents ba89f12 + a67e6bf commit 8eb9deb

File tree

59 files changed

+1584
-469
lines changed

Some content is hidden

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

59 files changed

+1584
-469
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddSimpleProductToCartActionGroup.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="AddSimpleProductToCartActionGroup">
11+
<actionGroup name="AddSimpleProductToCartActionGroup" deprecated="Avoid using super-ActionGroups. Use StorefrontOpenProductEntityPageActionGroup, StorefrontAddSimpleProductToCartActionGroup and StorefrontAssertProductAddedToCartResultMessageActionGroup">
1212
<annotations>
1313
<description>Navigates to the Storefront Product page. Then adds the Product to the Cart. Validates that the Success Message is present and correct.</description>
1414
</annotations>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" extends="ChangeSeoUrlKeyForSubCategoryActionGroup">
12+
<annotations>
13+
<description>Requires navigation to subcategory creation/edit. Updates the Search Engine Optimization with uncheck Redirect Checkbox .</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string"/>
17+
</arguments>
18+
19+
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckRedirectCheckbox" after="enterURLKey"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AssertAdminProductGridCellActionGroup">
12+
<annotations>
13+
<description>Checks value for Admin Product Grid cell by provided row and column.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="row" type="string" defaultValue="1"/>
17+
<argument name="column" type="string" defaultValue="Name"/>
18+
<argument name="value" type="string" defaultValue="1"/>
19+
</arguments>
20+
21+
<see selector="{{AdminProductGridSection.productGridCell(row,column)}}" userInput="{{value}}" stepKey="seeProductGridCellWithProvidedValue"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="CheckAdminProductGridColumnOptionActionGroup">
12+
<annotations>
13+
<description>Checks Admin Product Grid 'Columns' option.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="optionName" type="string" defaultValue="Name"/>
17+
</arguments>
18+
19+
<checkOption selector="{{AdminProductGridFilterSection.viewColumnOption(optionName)}}" stepKey="checkColumn"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="ClearFiltersAdminProductGridActionGroup">
12+
<annotations>
13+
<description>Clicks on 'Clear Filters'.</description>
14+
</annotations>
15+
16+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
17+
<waitForPageLoad stepKey="waitForGridLoad"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="ResetAdminProductGridColumnsActionGroup">
12+
<annotations>
13+
<description>Clicks 'reset' for Admin Product Grid 'Columns' dropdown.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminProductGridFilterSection.resetGridColumns}}" stepKey="resetProductGridColumns"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontOpenProductEntityPageActionGroup">
11+
<annotations>
12+
<description>Opens Storefront Product page for the provided Product Entity</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="product" type="entity"/>
16+
</arguments>
17+
18+
<amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/>
19+
<waitForPageLoad stepKey="waitForProductPageLoaded"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="ToggleAdminProductGridColumnsDropdownActionGroup">
12+
<annotations>
13+
<description>Toggles Admin Product Grid 'Columns' dropdown.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminProductGridFilterSection.columnsDropdown}}" stepKey="toggleColumnsDropdown"/>
17+
</actionGroup>
18+
</actionGroups>

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@
110110
<data key="is_active">false</data>
111111
<data key="include_in_menu">false</data>
112112
</entity>
113+
<entity name="_defaultCategoryDifferentUrlStore" type="category">
114+
<data key="name" unique="suffix">SimpleCategory</data>
115+
<data key="name_lwr" unique="suffix">simplecategory</data>
116+
<data key="is_active">true</data>
117+
<data key="url_key_default_store" unique="suffix">default-simplecategory</data>
118+
<data key="url_key_custom_store" unique="suffix">custom-simplecategory</data>
119+
</entity>
120+
<entity name="SimpleSubCategoryDifferentUrlStore" type="category">
121+
<data key="name" unique="suffix">SimpleSubCategory</data>
122+
<data key="name_lwr" unique="suffix">simplesubcategory</data>
123+
<data key="is_active">true</data>
124+
<data key="url_key_default_store" unique="suffix">default-simplesubcategory</data>
125+
<data key="url_key_custom_store" unique="suffix">custom-simplesubcategory</data>
126+
<data key="include_in_menu">true</data>
127+
<var key="parent_id" entityType="category" entityKey="id" />
128+
</entity>
113129
<!-- Category from file "prepared-for-sample-data.csv"-->
114130
<entity name="Gear" type="category">
115131
<data key="name">Gear</data>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
<data key="attribute_code">short_description</data>
3232
<data key="value" unique="suffix">API Product Short Description</data>
3333
</entity>
34+
<entity name="ApiProductSpecialPrice" type="custom_attribute">
35+
<data key="attribute_code">special_price</data>
36+
<data key="value">51.51</data>
37+
</entity>
38+
<entity name="ApiProductCost" type="custom_attribute">
39+
<data key="attribute_code">cost</data>
40+
<data key="value">50.05</data>
41+
</entity>
3442
<entity name="ApiProductNewsFromDate" type="custom_attribute">
3543
<data key="attribute_code">news_from_date</data>
3644
<data key="value">2018-05-17 00:00:00</data>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175
<data key="status">1</data>
176176
<data key="quantity">0</data>
177177
</entity>
178+
<entity name="SimpleOutOfStockProductWithSpecialPriceAndCost" type="product" extends="SimpleOutOfStockProduct">
179+
<requiredEntity type="custom_attribute_array">ApiProductSpecialPrice</requiredEntity>
180+
<requiredEntity type="custom_attribute_array">ApiProductCost</requiredEntity>
181+
</entity>
178182
<entity name="SimpleProductInStockQuantityZero" type="product">
179183
<data key="name" unique="suffix">SimpleProductInStockQuantityZero</data>
180184
<data key="sku" unique="suffix">testSku</data>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<element name="firstProductRowEditButton" type="button" selector="table.data-grid tr.data-row td .action-menu-item:first-of-type"/>
2222
<element name="productThumbnail" type="text" selector="table.data-grid tr:nth-child({{row}}) td.data-grid-thumbnail-cell > img" parameterized="true"/>
2323
<element name="productThumbnailBySrc" type="text" selector="img.admin__control-thumbnail[src*='{{pattern}}']" parameterized="true"/>
24-
<element name="productGridCell" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
24+
<element name="productGridCell" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[normalize-space(.)='{{column}}']/preceding-sibling::th) +1 ]" parameterized="true"/>
2525
<element name="productGridHeaderCell" type="text" selector="//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]" parameterized="true"/>
2626
<element name="multicheckDropdown" type="button" selector="div[data-role='grid-wrapper'] th.data-grid-multicheck-cell button.action-multicheck-toggle"/>
2727
<element name="multicheckOption" type="button" selector="//div[@data-role='grid-wrapper']//th[contains(@class, data-grid-multicheck-cell)]//li//span[text() = '{{label}}']" parameterized="true"/>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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="AdminCheckProductListPriceAttributesTest">
12+
<annotations>
13+
<stories value="Check price attributes values on Admin Product List"/>
14+
<title value="Check price attributes values on Admin Product List."/>
15+
<description value="Login as admin, create simple product, add cost, special price. Go to Admin
16+
Product List page filter grid by created product, add mentioned columns to grid, check values."/>
17+
<group value="catalog"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
21+
<createData entity="SimpleOutOfStockProductWithSpecialPriceAndCost" stepKey="createSimpleProduct"/>
22+
23+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="adminOpenProductIndexPage"/>
24+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridByCreatedSimpleProductSku">
25+
<argument name="product" value="$$createSimpleProduct$$"/>
26+
</actionGroup>
27+
</before>
28+
<after>
29+
<actionGroup ref="ClearFiltersAdminProductGridActionGroup" stepKey="clearFiltersAdminProductGrid"/>
30+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openToResetColumnsDropdown"/>
31+
<actionGroup ref="ResetAdminProductGridColumnsActionGroup" stepKey="resetAdminProductGridColumns"/>
32+
33+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
34+
<actionGroup ref="logout" stepKey="logout"/>
35+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
36+
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
37+
</after>
38+
39+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdown"/>
40+
<actionGroup ref="CheckAdminProductGridColumnOptionActionGroup" stepKey="checkSpecialPriceOption">
41+
<argument name="optionName" value="Special Price"/>
42+
</actionGroup>
43+
<actionGroup ref="CheckAdminProductGridColumnOptionActionGroup" stepKey="checkCostOption">
44+
<argument name="optionName" value="Cost"/>
45+
</actionGroup>
46+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdown"/>
47+
48+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seePrice">
49+
<argument name="row" value="1"/>
50+
<argument name="column" value="Price"/>
51+
<argument name="value" value="${{SimpleOutOfStockProduct.price}}"/>
52+
</actionGroup>
53+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeCorrectSpecialPrice">
54+
<argument name="row" value="1"/>
55+
<argument name="column" value="Special Price"/>
56+
<argument name="value" value="${{ApiProductSpecialPrice.value}}"/>
57+
</actionGroup>
58+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeCorrectCost">
59+
<argument name="row" value="1"/>
60+
<argument name="column" value="Cost"/>
61+
<argument name="value" value="${{ApiProductCost.value}}"/>
62+
</actionGroup>
63+
</test>
64+
</tests>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Ui\DataProvider\Product\Modifier;
9+
10+
use Magento\Framework\Currency;
11+
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Magento\Framework\Locale\CurrencyInterface;
13+
use Magento\Store\Api\Data\StoreInterface;
14+
use Magento\Store\Model\StoreManagerInterface;
15+
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
16+
17+
/**
18+
* Modify product listing price attributes
19+
*/
20+
class PriceAttributes implements ModifierInterface
21+
{
22+
/**
23+
* @var array
24+
*/
25+
private $priceAttributeList;
26+
27+
/**
28+
* @var StoreManagerInterface
29+
*/
30+
private $storeManager;
31+
32+
/**
33+
* @var CurrencyInterface
34+
*/
35+
private $localeCurrency;
36+
37+
/**
38+
* PriceAttributes constructor.
39+
*
40+
* @param StoreManagerInterface $storeManager
41+
* @param CurrencyInterface $localeCurrency
42+
* @param array $priceAttributeList
43+
*/
44+
public function __construct(
45+
StoreManagerInterface $storeManager,
46+
CurrencyInterface $localeCurrency,
47+
array $priceAttributeList = []
48+
) {
49+
$this->storeManager = $storeManager;
50+
$this->localeCurrency = $localeCurrency;
51+
$this->priceAttributeList = $priceAttributeList;
52+
}
53+
54+
/**
55+
* @inheritdoc
56+
*/
57+
public function modifyData(array $data): array
58+
{
59+
if (empty($data) || empty($this->priceAttributeList)) {
60+
return $data;
61+
}
62+
63+
foreach ($data['items'] as &$item) {
64+
foreach ($this->priceAttributeList as $priceAttribute) {
65+
if (isset($item[$priceAttribute])) {
66+
$item[$priceAttribute] = $this->getCurrency()->toCurrency(sprintf("%f", $item[$priceAttribute]));
67+
}
68+
}
69+
}
70+
71+
return $data;
72+
}
73+
74+
/**
75+
* @inheritdoc
76+
*/
77+
public function modifyMeta(array $meta): array
78+
{
79+
return $meta;
80+
}
81+
82+
/**
83+
* Retrieve store
84+
*
85+
* @return StoreInterface
86+
* @throws NoSuchEntityException
87+
*/
88+
private function getStore(): StoreInterface
89+
{
90+
return $this->storeManager->getStore();
91+
}
92+
93+
/**
94+
* Retrieve currency
95+
*
96+
* @return Currency
97+
* @throws NoSuchEntityException
98+
*/
99+
private function getCurrency(): Currency
100+
{
101+
$baseCurrencyCode = $this->getStore()->getBaseCurrencyCode();
102+
103+
return $this->localeCurrency->getCurrency($baseCurrencyCode);
104+
}
105+
}

0 commit comments

Comments
 (0)