Skip to content

Commit 27c239f

Browse files
Roman HaninRoman Hanin
authored andcommitted
t puMerge branch '2.4-develop' of https://github.com/magento/magento2ce into B2B-2423
2 parents f7984c8 + ab999dd commit 27c239f

File tree

65 files changed

+2026
-62
lines changed

Some content is hidden

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

65 files changed

+2026
-62
lines changed

app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ define([
5353
formData: {
5454
'form_key': window.FORM_KEY
5555
},
56-
dropZone: '[data-tab-panel=image-management]',
56+
dropZone: this.element.find('input[type=file]').closest('[role="dialog"]'),
5757
sequentialUploads: true,
5858
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
5959
maxFileSize: this.options.maxFileSize,

app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
namespace Magento\Catalog\Test\Fixture;
99

10+
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
1011
use Magento\Catalog\Api\Data\ProductInterface;
1112
use Magento\Catalog\Api\ProductRepositoryInterface;
1213
use Magento\Catalog\Model\Product\Attribute\Source\Status;
1314
use Magento\Catalog\Model\Product\Type;
1415
use Magento\Catalog\Model\Product\Visibility;
1516
use Magento\Framework\DataObject;
17+
use Magento\Framework\Exception\NoSuchEntityException;
1618
use Magento\TestFramework\Fixture\Api\DataMerger;
1719
use Magento\TestFramework\Fixture\Api\ServiceFactory;
1820
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
@@ -137,6 +139,7 @@ private function prepareData(array $data): array
137139
}
138140

139141
$data['product_links'] = $this->prepareLinksData($data);
142+
$data['options'] = $this->prepareOptions($data);
140143

141144
return $this->dataProcessor->process($this, $data);
142145
}
@@ -146,6 +149,7 @@ private function prepareData(array $data): array
146149
*
147150
* @param array $data
148151
* @return array
152+
* @throws NoSuchEntityException
149153
*/
150154
private function prepareLinksData(array $data): array
151155
{
@@ -181,4 +185,33 @@ private function prepareLinksData(array $data): array
181185

182186
return $links;
183187
}
188+
189+
/**
190+
*
191+
* Prepare custom option fixtures
192+
*
193+
* @param array $data
194+
* @return array
195+
*/
196+
private function prepareOptions(array $data): array
197+
{
198+
$options = [];
199+
$default = [
200+
'product_sku' => $data['sku'],
201+
'title' => 'customoption%uniqid%',
202+
'type' => ProductCustomOptionInterface::OPTION_TYPE_FIELD,
203+
'is_require' => true,
204+
'price' => 10.0,
205+
'price_type' => 'fixed',
206+
'sku' => 'customoption%uniqid%',
207+
'max_characters' => null,
208+
'values' => null,
209+
];
210+
$sortOrder = 1;
211+
foreach ($data['options'] as $item) {
212+
$options[] = $item + ['sort_order' => $sortOrder++] + $default;
213+
}
214+
215+
return $options;
216+
}
184217
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="AdminAddCustomAttributeToSelectedProductActionGroup">
12+
<annotations>
13+
<description>Add the created attribute to the selected product</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeCode" type="string" defaultValue="test_attribute"/>
17+
<argument name="adminOption1" type="string" defaultValue="value 1 admin"/>
18+
</arguments>
19+
20+
<click selector="{{AdminProductFormActionSection.addAttributeButton}}" stepKey="clickOnAddAttributeButton" />
21+
<click selector="{{AdminProductAttributeSetGridSection.searchAttributeByFilter}}" stepKey="searchAttributeByFilter" />
22+
<fillField selector="{{AdminProductAttributeSetGridSection.setAttributeCode}}" userInput="{{attributeCode}}" stepKey="filterAttributeCode"/>
23+
<click selector="{{AdminProductAttributeSetGridSection.applyFilter}}" stepKey="applyFilter" />
24+
<waitForPageLoad stepKey="waitForResultsToBeDisplayed"/>
25+
<checkOption selector="{{AdminProductAttributeSetGridSection.selectFromAttributeResult(attributeCode)}}" stepKey="selectAttributeFromDisplayedResult"/>
26+
<click selector="{{AdminProductAttributeSetGridSection.addSelected}}" stepKey="clickAddSelectedButton" />
27+
<waitForPageLoad stepKey="waitForAttributesToBeAdded"/>
28+
<scrollTo selector="{{AdminProductFormSection.attributeTab}}" stepKey="scrollToAttributeTab" />
29+
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="expandAttributeTab" />
30+
<selectOption selector="{{AdminProductFormSection.customSelectField(attributeCode)}}" userInput="{{adminOption1}}" stepKey="selectAvalueFromDropdown"/>
31+
<click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct" />
32+
<waitForPageLoad stepKey="waitForProductsToBeSaved"/>
33+
</actionGroup>
34+
</actionGroups>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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="AdminVerifiesListAndGridModeActionGroup">
12+
<annotations>
13+
<description>Catalog Verifies List and Grid Modes.</description>
14+
</annotations>
15+
16+
<!-- verify changes in List mode -->
17+
18+
<seeElement selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInListView"/>
19+
<scrollTo selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="scrollToGridMode"/>
20+
<click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="clickGridMode"/>
21+
<waitForPageLoad stepKey="waitForGridMode"/>
22+
<seeElement selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInGridView"/>
23+
<click selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="clickListMode"/>
24+
<waitForPageLoad stepKey="waitForListMode"/>
25+
<seeNumberOfElements selector="{{StorefrontCategoryMainSection.productLink}}" userInput="1" stepKey="seeNumberOfProductsInPage1"/>
26+
<click selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="clickProductsPerPageButtonInListMode"/>
27+
<waitForPageLoad stepKey="waitForProductsPerPage"/>
28+
<click selector="{{AdminChecksListAndGridModeSection.allButton}}" stepKey="selectAllButton"/>
29+
<waitForPageLoad stepKey="waitForSelectAll"/>
30+
<seeElement selector="{{AdminChecksListAndGridModeSection.allProducts}}" stepKey="seeAllProducts"/>
31+
<click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="switchToGridMode"/>
32+
<seeElement selector="{{AdminChecksListAndGridModeSection.gridView}}" stepKey="seePageInGridView2"/>
33+
<click selector="{{StorefrontCategoryProductSection.categoryListView}}" stepKey="switchToListMode1"/>
34+
<seeElement selector="{{AdminChecksListAndGridModeSection.listView}}" stepKey="seePageInListView1"/>
35+
<click selector="{{AdminChecksListAndGridModeSection.gridMode}}" stepKey="switchToGridMode1"/>
36+
<click selector="{{AdminChecksListAndGridModeSection.productsPerPage}}" stepKey="clickProductsPerPageButtonInGridMode"/>
37+
<waitForPageLoad stepKey="waitForProductsPerPageOpen"/>
38+
<seeElement selector="{{AdminChecksListAndGridModeSection.pageOptions('1')}}" stepKey="seePageOptions1"/>
39+
<seeElement selector="{{AdminChecksListAndGridModeSection.pageOptions('2')}}" stepKey="seePageOptions2"/>
40+
<seeElement selector="{{AdminChecksListAndGridModeSection.pageOptions('3')}}" stepKey="seePageOptions3"/>
41+
<seeElement selector="{{AdminChecksListAndGridModeSection.pageOptions('4')}}" stepKey="seePageOptions4"/>
42+
<seeElement selector="{{AdminChecksListAndGridModeSection.pageOptions('5')}}" stepKey="seePageOptions5"/>
43+
44+
</actionGroup>
45+
</actionGroups>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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="CreateCustomAttributeActionGroup">
12+
<annotations>
13+
<description>Create a custom attribute to be added to any product from admin portal.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeLabel" type="string" defaultValue="Test Attribute"/>
17+
<argument name="attributeCode" type="string" defaultValue="test_attribute"/>
18+
<argument name="inputType" type="string" defaultValue="Dropdown"/>
19+
<argument name="valueRequired" type="string" defaultValue="Yes"/>
20+
<argument name="adminOption1" type="string" defaultValue="value 1 admin"/>
21+
<argument name="adminOption1Value" type="string" defaultValue="value1"/>
22+
<argument name="adminOption2" type="string" defaultValue="value 2 admin"/>
23+
<argument name="adminOption2Value" type="string" defaultValue="value2"/>
24+
<argument name="toBeUsedInSearch" type="string" defaultValue="Yes"/>
25+
<argument name="isComparableOnStoreFront" type="string" defaultValue="Yes"/>
26+
<argument name="usedInLayeredNavigation" type="string" defaultValue="Filterable (with results)"/>
27+
<argument name="isVisibleOnCatalogPagesOnStorefront" type="string" defaultValue="Yes"/>
28+
</arguments>
29+
30+
<!-- Navigate to Stores > Attributes > Products > Product Attribute-->
31+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
32+
33+
<!-- Click on Add new Attribute button -->
34+
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="clickAddNewAttributeButton"/>
35+
36+
<!-- Add details to Attribute Properties -->
37+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeLabel}}" stepKey="fillAttributeLabel"/>
38+
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{inputType}}" stepKey="selectDropdown"/>
39+
<selectOption selector="{{AttributePropertiesSection.ValueRequired}}" userInput="{{valueRequired}}" stepKey="selectRequiredAsYes"/>
40+
41+
<click selector="{{AttributePropertiesSection.dropdownAddOptions}}" stepKey="addOptions"/>
42+
<checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('1')}}" stepKey="selectIsDefaultForValue1"/>
43+
<fillField selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('1')}}" userInput="{{adminOption1}}" stepKey="fillAdmin1"/>
44+
<fillField selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('1')}}" userInput="{{adminOption1Value}}" stepKey="fillDefaultStoreView1"/>
45+
46+
<click selector="{{AttributePropertiesSection.dropdownAddOptions}}" stepKey="addOptionsAgain"/>
47+
<fillField selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('2')}}" userInput="{{adminOption2}}" stepKey="fillAdmin2"/>
48+
<fillField selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('2')}}" userInput="{{adminOption2Value}}" stepKey="fillDefaultStoreView2"/>
49+
50+
<!-- Add details to Advanced Attribute Properties -->
51+
<click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="clickAdvancedAttributeProperties"/>
52+
<waitForElementVisible selector="{{AttributePropertiesSection.AttributeCode}}" stepKey="waitForAttributeCodeToBeVisible"/>
53+
<fillField selector="{{AttributePropertiesSection.AttributeCode}}" userInput="{{attributeCode}}" stepKey="fillAttributeCode"/>
54+
55+
<!-- Navigate to Storefront Properties -->
56+
<scrollToTopOfPage stepKey="scrollToStoreFrontProperties"/>
57+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStoreFrontProperties"/>
58+
59+
<!-- Provide the Storefront Properties -->
60+
<selectOption selector="{{AdminNewAttributePanel.useInSearch}}" userInput="{{toBeUsedInSearch}}" stepKey="selectYesForUseInSearch"/>
61+
<selectOption selector="{{AdminNewAttributePanel.comparableOnStorefront}}" userInput="{{isComparableOnStoreFront}}" stepKey="selectYesForComparableOnStorefront"/>
62+
<selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" userInput="{{usedInLayeredNavigation}}" stepKey="selectLayeredNavigation"/>
63+
<selectOption selector="{{AdminNewAttributePanel.visibleOnCatalogPagesOnStorefront}}" userInput="{{isVisibleOnCatalogPagesOnStorefront}}" stepKey="selectYesForVisibleOnCatalogPagesForStoreFront"/>
64+
65+
<!-- Save the Attribute -->
66+
<click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="saveTheAttribute"/>
67+
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
68+
</actionGroup>
69+
</actionGroups>

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

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,52 @@
7777
<data key="path">catalog/frontend/grid_per_page</data>
7878
<data key="value">1</data>
7979
</entity>
80-
</entities>
80+
<entity name="CustomListMode">
81+
<data key="path">catalog/frontend/list_mode</data>
82+
<data key="value">list-grid</data>
83+
</entity>
84+
<entity name="CustomStoreFrontGridPerPageValuesConfigData">
85+
<data key="path">catalog/frontend/grid_per_page_values</data>
86+
<data key="value">1,10,50,100</data>
87+
</entity>
88+
<entity name="CustomStoreFrontGridPerPageConfigData">
89+
<data key="path">catalog/frontend/grid_per_page</data>
90+
<data key="value">10</data>
91+
</entity>
92+
<entity name="CustomStoreFrontListPerPageValuesConfigData">
93+
<data key="path">catalog/frontend/list_per_page_values</data>
94+
<data key="value">1,10,30</data>
95+
</entity>
96+
<entity name="CustomStoreFrontListPerPageConfigData">
97+
<data key="path">catalog/frontend/list_per_page</data>
98+
<data key="value">1</data>
99+
</entity>
100+
<entity name="CustomStoreFrontProductsSortBy">
101+
<data key="path">catalog/frontend/default_sort_by</data>
102+
<data key="value">price</data>
103+
</entity>
104+
<entity name="CustomStoreFrontAllProductsPerPage">
105+
<data key="path">catalog/frontend/list_allow_all</data>
106+
<data key="value">1</data>
107+
</entity>
108+
<entity name="DefaultListMode">
109+
<data key="path">catalog/frontend/list_mode</data>
110+
<data key="value">grid-list</data>
111+
</entity>
112+
<entity name="DefaultStoreFrontListPerPageValuesConfigData">
113+
<data key="path">catalog/frontend/list_per_page_values</data>
114+
<data key="value">5,10,15,20,25</data>
115+
</entity>
116+
<entity name="DefaultStoreFrontListPerPageConfigData">
117+
<data key="path">catalog/frontend/list_per_page</data>
118+
<data key="value">10</data>
119+
</entity>
120+
<entity name="DefaultStoreFrontProductsSortBy">
121+
<data key="path">catalog/frontend/default_sort_by</data>
122+
<data key="value">position</data>
123+
</entity>
124+
<entity name="DefaultStoreFrontAllProductsPerPage">
125+
<data key="path">catalog/frontend/list_allow_all</data>
126+
<data key="value">0</data>
127+
</entity>
128+
</entities>

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
<data key="name" unique="suffix">ApiCategory</data>
1919
<data key="is_active">true</data>
2020
</entity>
21+
<entity name="CategoryB" type="category">
22+
<data key="name" unique="suffix">CategoryB</data>
23+
<data key="name_lwr" unique="suffix">CategoryB</data>
24+
<data key="urlKey" unique="suffix">CategoryB</data>
25+
<data key="is_active">true</data>
26+
</entity>
2127
<entity name="SimpleSubCategory" type="category">
2228
<data key="name" unique="suffix">SimpleSubCategory</data>
2329
<data key="name_lwr" unique="suffix">simplesubcategory</data>
@@ -279,4 +285,4 @@
279285
<var key="category_id" entityKey="id" entityType="category"/>
280286
<var key="sku" entityKey="sku" entityType="product"/>
281287
</entity>
282-
</entities>
288+
</entities>

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
2323
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
2424
</entity>
25+
<entity name="productA" type="product">
26+
<data key="name" unique="suffix">productA</data>
27+
<data key="sku" unique="suffix">productAfortest</data>
28+
<data key="urlKey" unique="suffix">simple-product-for-producta</data>
29+
<data key="type_id">simple</data>
30+
<data key="attribute_set_id">4</data>
31+
<data key="visibility">4</data>
32+
<data key="price">123.00</data>
33+
<data key="status">1</data>
34+
<data key="quantity">100</data>
35+
<data key="weight">1</data>
36+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
37+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
38+
</entity>
2539
<entity name="SimpleProductQty100" type="product">
2640
<data key="name" unique="suffix">testProductName</data>
2741
<data key="sku" unique="suffix">testSku</data>
@@ -1471,4 +1485,4 @@
14711485
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
14721486
</entity>
14731487

1474-
</entities>
1488+
</entities>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<element name="expandAll" type="button" selector=".tree-actions a:last-child"/>
1414
<element name="categoryHighlighted" type="text" selector="//div[@id='store.menu']//span[contains(text(),'{{name}}')]/ancestor::li" parameterized="true" timeout="30"/>
1515
<element name="categoryNotHighlighted" type="text" selector="[id=\'store.menu\'] ul li.active" timeout="30"/>
16-
<element name="categoryTreeRoot" type="text" selector="div.x-tree-root-node>li.x-tree-node:first-of-type>div.x-tree-node-el:first-of-type" timeout="30"/>
16+
<element name="categoryTreeRoot" type="text" selector="li.x-tree-node:first-of-type > div.x-tree-node-el:first-of-type" timeout="30"/>
1717
<element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>
1818
<element name="categoryInTreeUnderRoot" type="text" selector="//li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/>
1919
<element name="childCategoryUnderParent" type="text" selector="//li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{parentCategoryName}}')]/../../../ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{childCategoryName}}')]" parameterized="true"/>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminChecksListAndGridModeSection">
12+
13+
<element name="listView" type="text" selector='//*[@id="maincontent"]//*[@data-value="list"]'/>
14+
<element name="gridMode" type="button" selector="//a[@class='modes-mode mode-grid']"/>
15+
<element name="gridView" type="text" selector='//*[@id="maincontent"]//*[@data-value="grid"]'/>
16+
<element name="listMode" type="button" selector='//*[@id="maincontent"]//*[@data-value="list]'/>
17+
<element name="pageProduct" type="text" selector='(//ol[@class="products list items product-items"]/li)[1]'/>
18+
<element name="sortByPrice" type="text" selector='.//*[@id="sorter"]//option[@value="price"]'/>
19+
<element name="productsPerPage" type="button" selector='//*[@class="field limiter"]//*[@id="limiter"]'/>
20+
<element name="allButton" type="button" selector='//*[@id="limiter"]/option[4]'/>
21+
<element name="allProducts" type="text" selector='//ol[@class="products list items product-items"]'/>
22+
<element name="pageOptions" type="text" selector='//*[@id="limiter"]/option[{{var1}}]' parameterized="true"/>
23+
<element name="productCount" type="text" selector='//span[@class="product-image-wrapper"]'/>
24+
25+
</section>
26+
</sections>

0 commit comments

Comments
 (0)