Skip to content

Commit 190dd48

Browse files
committed
Merge remote-tracking branch 'github-magento/MAGETWO-91697' into EPAM-PR-8
# Conflicts: # app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml
2 parents 9b2500a + e33476f commit 190dd48

File tree

14 files changed

+555
-27
lines changed

14 files changed

+555
-27
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ protected function _construct()
151151
*/
152152
public function _afterLoad()
153153
{
154-
parent::_afterLoad();
155-
if ($this->getStoreId() && $this->_items) {
156-
foreach ($this->_items as $item) {
157-
$item->setStoreId($this->getStoreId());
158-
}
159-
}
160-
return $this;
154+
return parent::_afterLoad();
161155
}
162156

163157
/**
@@ -356,7 +350,10 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
356350
}
357351

358352
/**
353+
* Get Catalog Rule Processor.
354+
*
359355
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
356+
*
360357
* @deprecated 100.2.0
361358
*/
362359
private function getCatalogRuleProcessor()

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

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,7 @@ public function getFlatState()
474474
}
475475

476476
/**
477-
* Retrieve is flat enabled flag
478-
* Return always false if magento run admin
477+
* Retrieve is flat enabled. Return always false if magento run admin.
479478
*
480479
* @return bool
481480
*/
@@ -506,8 +505,7 @@ protected function _construct()
506505
}
507506

508507
/**
509-
* Standard resource collection initialization
510-
* Needed for child classes
508+
* Standard resource collection initialization. Needed for child classes.
511509
*
512510
* @param string $model
513511
* @param string $entityModel
@@ -546,8 +544,7 @@ protected function _prepareStaticFields()
546544
}
547545

548546
/**
549-
* Retrieve collection empty item
550-
* Redeclared for specifying id field name without getting resource model inside model
547+
* Get collection empty item. Redeclared for specifying id field name without getting resource model inside model.
551548
*
552549
* @return \Magento\Framework\DataObject
553550
*/
@@ -633,8 +630,7 @@ public function _loadAttributes($printQuery = false, $logQuery = false)
633630
}
634631

635632
/**
636-
* Add attribute to entities in collection
637-
* If $attribute=='*' select all attributes
633+
* Add attribute to entities in collection. If $attribute=='*' select all attributes.
638634
*
639635
* @param array|string|integer|\Magento\Framework\App\Config\Element $attribute
640636
* @param bool|string $joinType
@@ -670,8 +666,7 @@ public function addAttributeToSelect($attribute, $joinType = false)
670666
}
671667

672668
/**
673-
* Processing collection items after loading
674-
* Adding url rewrites, minimal prices, final prices, tax percents
669+
* Processing collection items after loading. Adding url rewrites, minimal prices, final prices, tax percents.
675670
*
676671
* @return $this
677672
*/
@@ -682,6 +677,7 @@ protected function _afterLoad()
682677
}
683678

684679
$this->_prepareUrlDataObject();
680+
$this->prepareStoreId();
685681

686682
if (count($this)) {
687683
$this->_eventManager->dispatch('catalog_product_collection_load_after', ['collection' => $this]);
@@ -690,6 +686,23 @@ protected function _afterLoad()
690686
return $this;
691687
}
692688

689+
/**
690+
* Add Store ID to products from collection.
691+
*
692+
* @return $this
693+
*/
694+
protected function prepareStoreId()
695+
{
696+
if ($this->getStoreId() !== null) {
697+
/** @var $item \Magento\Catalog\Model\Product */
698+
foreach ($this->_items as $item) {
699+
$item->setStoreId($this->getStoreId());
700+
}
701+
}
702+
703+
return $this;
704+
}
705+
693706
/**
694707
* Prepare Url Data object
695708
*
@@ -756,8 +769,7 @@ public function addIdFilter($productId, $exclude = false)
756769
}
757770

758771
/**
759-
* Adding product website names to result collection
760-
* Add for each product websites information
772+
* Adding product website names to result collection. Add for each product websites information.
761773
*
762774
* @return $this
763775
*/
@@ -768,7 +780,7 @@ public function addWebsiteNamesToResult()
768780
}
769781

770782
/**
771-
* {@inheritdoc}
783+
* @inheritdoc
772784
*/
773785
public function load($printQuery = false, $logQuery = false)
774786
{
@@ -825,8 +837,7 @@ protected function doAddWebsiteNamesToResult()
825837
}
826838

827839
/**
828-
* Add store availability filter. Include availability product
829-
* for store website
840+
* Add store availability filter. Include availability product for store website.
830841
*
831842
* @param null|string|bool|int|Store $store
832843
* @return $this
@@ -1115,7 +1126,7 @@ public function getSelectCountSql()
11151126
/**
11161127
* Get SQL for get record count
11171128
*
1118-
* @param null $select
1129+
* @param \Magento\Framework\DB\Select $select
11191130
* @param bool $resetLeftJoins
11201131
* @return \Magento\Framework\DB\Select
11211132
*/
@@ -1357,8 +1368,7 @@ public function joinUrlRewrite()
13571368
}
13581369

13591370
/**
1360-
* Add URL rewrites data to product
1361-
* If collection loadded - run processing else set flag
1371+
* Add URL rewrites data to product. If collection loadded - run processing else set flag.
13621372
*
13631373
* @param int|string $categoryId
13641374
* @return $this
@@ -1581,7 +1591,8 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType =
15811591
}
15821592

15831593
/**
1584-
* {@inheritdoc}
1594+
* @inheritdoc
1595+
*
15851596
* @since 101.0.0
15861597
*/
15871598
protected function getEntityPkName(\Magento\Eav\Model\Entity\AbstractEntity $entity)
@@ -2343,7 +2354,10 @@ private function getGalleryReadHandler()
23432354
}
23442355

23452356
/**
2357+
* Retrieve Media gallery resource.
2358+
*
23462359
* @deprecated 101.0.1
2360+
*
23472361
* @return \Magento\Catalog\Model\ResourceModel\Product\Gallery
23482362
*/
23492363
private function getMediaGalleryResource()

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,42 @@
174174
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
175175
</actionGroup>
176176

177+
<actionGroup name="ProductSetWebsite">
178+
<arguments>
179+
<argument name="website" type="string"/>
180+
</arguments>
181+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="ScrollToWebsites"/>
182+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="ClickTpOpenProductInWebsite"/>
183+
<waitForPageLoad stepKey="waitForPageOpened"/>
184+
<click selector="{{ProductInWebsitesSection.website(website)}}" stepKey="SelectWebsite"/>
185+
<click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/>
186+
<waitForPageLoad time='60' stepKey="waitForPageOpened1"/>
187+
</actionGroup>
188+
189+
<actionGroup name="ProductSetAdvancedPricing">
190+
<arguments>
191+
<argument name="website" type="string" defaultValue=""/>
192+
<argument name="group" type="string" defaultValue="Retailer"/>
193+
<argument name="quantity" type="string" defaultValue="1"/>
194+
<argument name="price" type="string" defaultValue="Discount"/>
195+
<argument name="amount" type="string" defaultValue="45"/>
196+
</arguments>
197+
<click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/>
198+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/>
199+
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAnd10percent"/>
200+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" stepKey="waitForSelectCustomerGroupNameAttribute2"/>
201+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceWebsiteSelect('0')}}" userInput="{{website}}" stepKey="selectProductWebsiteValue"/>
202+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{group}}" stepKey="selectProductCustomGroupValue"/>
203+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="{{quantity}}" stepKey="fillProductTierPriceQtyInput"/>
204+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="{{price}}" stepKey="selectProductTierPriceValueType"/>
205+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput"/>
206+
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/>
207+
<waitForPageLoad stepKey="WaitForProductSave"/>
208+
<click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct1"/>
209+
<waitForPageLoad time="60" stepKey="WaitForProductSave1"/>
210+
<see userInput="You saved the product." stepKey="seeSaveConfirmation"/>
211+
</actionGroup>
212+
177213
<!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page-->
178214
<actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection">
179215
<arguments>
@@ -215,4 +251,30 @@
215251
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/>
216252
<waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/>
217253
</actionGroup>
254+
255+
<!--Select Product In Websites-->
256+
<actionGroup name="SelectProductInWebsitesActionGroup">
257+
<arguments>
258+
<argument name="website" type="string"/>
259+
</arguments>
260+
<scrollTo selector="{{CreateProductSection.productInWebsite}}" stepKey="ScrollToWebsites"/>
261+
<click selector="{{CreateProductSection.productInWebsite}}" stepKey="ClickTpOpenProductInWebsite"/>
262+
<waitForPageLoad stepKey="waitForPageOpened"/>
263+
<click selector="{{CreateProductSection.isSelected(website)}}" stepKey="SelectWebsite"/>
264+
<click selector="{{CreateProductSection.saveButton}}" stepKey="clickSaveProduct"/>
265+
</actionGroup>
266+
267+
<!--Switch to New Store view-->
268+
<actionGroup name="SwitchToTheNewStoreView">
269+
<arguments>
270+
<argument name="storeViewName" type="string"/>
271+
</arguments>
272+
<scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/>
273+
<waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/>
274+
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
275+
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/>
276+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
277+
<waitForPageLoad stepKey="waitForPageLoad"/>
278+
</actionGroup>
279+
218280
</actionGroups>

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
<argument name="product" defaultValue="product"/>
1313
</arguments>
1414
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
15-
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
15+
<waitForPageLoad time="60" stepKey="waitForProductsPageToLoad"/>
1616
<click selector="{{AdminProductFiltersSection.filtersButton}}" stepKey="openFiltersSectionOnProductsPage"/>
1717
<conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
1818
<fillField userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.skuInput}}" stepKey="fillSkuFieldOnFiltersSection"/>
1919
<click selector="{{AdminProductFiltersSection.apply}}" stepKey="clickApplyFiltersButton"/>
2020
</actionGroup>
21+
22+
<actionGroup name="ClearProductsFilterActionGroup">
23+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
24+
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
25+
<conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
26+
</actionGroup>
2127
</actionGroups>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CatalogPriceScopeWebsite" type="catalog_price_config_state">
12+
<requiredEntity type="scope">scopeWebsite</requiredEntity>
13+
<requiredEntity type="default_product_price">defaultProductPrice</requiredEntity>
14+
</entity>
15+
<entity name="scopeWebsite" type="scope">
16+
<data key="value">1</data>
17+
</entity>
18+
<entity name="defaultProductPrice" type="default_product_price">
19+
<data key="value">0</data>
20+
</entity>
21+
22+
<entity name="DefaultConfigCatalogPrice" type="catalog_price_config_state">
23+
<requiredEntity type="scope">scopeGlobal</requiredEntity>
24+
<requiredEntity type="default_product_price">defaultProductPrice</requiredEntity>
25+
</entity>
26+
<entity name="scopeGlobal" type="scope">
27+
<data key="value">0</data>
28+
</entity>
29+
<entity name="defaultProductPrice" type="default_product_price">
30+
<data key="value"/>
31+
</entity>
32+
33+
</entities>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="testDataTierPrice" type="data">
12+
<data key="goldenPrice1">$676.50</data>
13+
<data key="goldenPrice2">$615.00</data>
14+
</entity>
15+
<entity name="customStoreTierPrice" type="data">
16+
<data key="name">secondStore</data>
17+
<data key="code">second_store</data>
18+
</entity>
19+
<entity name="customStoreView" type="data">
20+
<data key="name">secondStoreView</data>
21+
<data key="code">second_store_view</data>
22+
</entity>
23+
</entities>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
10+
<operation name="CatalogPriceConfigState" dataType="catalog_price_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/catalog/" method="POST">
11+
<object key="groups" dataType="catalog_price_config_state">
12+
<object key="price" dataType="catalog_price_config_state">
13+
<object key="fields" dataType="catalog_price_config_state">
14+
<object key="scope" dataType="scope">
15+
<field key="value">string</field>
16+
</object>
17+
<object key="default_product_price" dataType="default_product_price">
18+
<field key="value">string</field>
19+
</object>
20+
</object>
21+
</object>
22+
</object>
23+
</operation>
24+
</operations>

0 commit comments

Comments
 (0)