Skip to content

Commit 63150a4

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-96760
2 parents 3a38958 + 21c719e commit 63150a4

File tree

72 files changed

+2403
-69
lines changed

Some content is hidden

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

72 files changed

+2403
-69
lines changed

app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminOrderBraintreeFillActionGroup.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@
1111
<actionGroup name="AdminOrderBraintreeFillActionGroup">
1212
<!--Select Braintree Payment method on Admin Order Create Page-->
1313
<click stepKey="chooseBraintree" selector="{{NewOrderSection.creditCardBraintree}}"/>
14-
<waitForPageLoad stepKey="waitForBraintreeConfigs" time="5"/>
14+
<waitForPageLoad stepKey="waitForBraintreeConfigs"/>
1515
<click stepKey="openCardTypes" selector="{{NewOrderSection.openCardTypes}}"/>
16-
<waitForPageLoad stepKey="waitForCardTypes" time="3"/>
16+
<waitForPageLoad stepKey="waitForCardTypes"/>
1717
<click stepKey="chooseCardType" selector="{{NewOrderSection.masterCard}}"/>
18-
<waitForPageLoad stepKey="waitForCardSelected" time="3"/>
18+
<waitForPageLoad stepKey="waitForCardSelected"/>
1919

2020
<!--Choose Master Card from drop-down list-->
2121
<switchToIFrame stepKey="switchToCardNumber" selector="{{NewOrderSection.cardFrame}}"/>
2222
<fillField stepKey="fillCardNumber" selector="{{NewOrderSection.creditCardNumber}}" userInput="{{PaymentAndShippingInfo.cardNumber}}"/>
23-
<waitForPageLoad stepKey="waitForFillCardNumber" time="1"/>
23+
<waitForPageLoad stepKey="waitForFillCardNumber"/>
2424
<switchToIFrame stepKey="switchBackFromCard"/>
2525

2626
<!--Fill expire date-->
2727
<switchToIFrame stepKey="switchToExpirationMonth" selector="{{NewOrderSection.monthFrame}}"/>
2828
<fillField stepKey="fillMonth" selector="{{NewOrderSection.expirationMonth}}" userInput="{{PaymentAndShippingInfo.month}}"/>
29-
<waitForPageLoad stepKey="waitForFillMonth" time="1"/>
29+
<waitForPageLoad stepKey="waitForFillMonth"/>
3030
<switchToIFrame stepKey="switchBackFromMonth"/>
3131
<switchToIFrame stepKey="switchToExpirationYear" selector="{{NewOrderSection.yearFrame}}"/>
3232
<fillField stepKey="fillYear" selector="{{NewOrderSection.expirationYear}}" userInput="{{PaymentAndShippingInfo.year}}"/>
33-
<waitForPageLoad stepKey="waitForFillYear" time="1"/>
33+
<waitForPageLoad stepKey="waitForFillYear"/>
3434
<switchToIFrame stepKey="switchBackFromYear"/>
3535

3636
<!--Fill CVW code-->

app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272

7373
<!-- Create a cart price rule with 10% discount for whole cart -->
7474
<click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing" />
75-
<waitForPageLoad stepKey="waitForMarketing" time="3"/>
75+
<waitForPageLoad stepKey="waitForMarketing"/>
7676
<click selector="{{CartPriceRulesSubmenuSection.cartPriceRules}}" stepKey="clickOnCartPriceRules"/>
77-
<waitForPageLoad stepKey="waitForCartPriceRules" time="3"/>
77+
<waitForPageLoad stepKey="waitForCartPriceRules"/>
7878
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
7979
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/>
8080
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
@@ -83,7 +83,7 @@
8383
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Percent of product price discount" stepKey="selectActionType"/>
8484
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/>
8585
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
86-
<waitForPageLoad stepKey="waitForCartRuleLoad" time="3"/>
86+
<waitForPageLoad stepKey="waitForCartRuleLoad"/>
8787
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
8888

8989
<!--Set Taxable Goods for Shipping Tax Class-->
@@ -112,15 +112,15 @@
112112

113113
<!--Submit Order-->
114114
<click stepKey="submitOrder" selector="{{NewOrderSection.submitOrder}}"/>
115-
<waitForPageLoad stepKey="waitForSubmitOrder" time="5"/>
115+
<waitForPageLoad stepKey="waitForSubmitOrder"/>
116116
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeOrderSuccessMessage" after="waitForSubmitOrder"/>
117117

118118
<!-- Create New invoice-->
119119
<actionGroup ref="adminFastCreateInvoice" stepKey="createInvoice"/>
120120

121121
<!--Get access to Credit Memo page from Invoice page-->
122122
<click selector="{{AdminInvoiceMainActionsSection.openNewCreditMemoFromInvoice}}" stepKey="clickCreateNewCreditMemo"/>
123-
<waitForPageLoad stepKey="waitForLoadNewCreditMemoPage" time="5"/>
123+
<waitForPageLoad stepKey="waitForLoadNewCreditMemoPage"/>
124124
<see selector="{{AdminCreditMemoOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeNewCreditMemo"/>
125125
</test>
126126
</tests>

app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function __construct(
9797
}
9898

9999
/**
100-
* {@inheritdoc}
100+
* @inheritdoc
101101
*/
102102
public function get(array $skus)
103103
{
@@ -107,7 +107,7 @@ public function get(array $skus)
107107
}
108108

109109
/**
110-
* {@inheritdoc}
110+
* @inheritdoc
111111
*/
112112
public function update(array $prices)
113113
{
@@ -128,7 +128,7 @@ public function update(array $prices)
128128
}
129129

130130
/**
131-
* {@inheritdoc}
131+
* @inheritdoc
132132
*/
133133
public function replace(array $prices)
134134
{
@@ -144,7 +144,7 @@ public function replace(array $prices)
144144
}
145145

146146
/**
147-
* {@inheritdoc}
147+
* @inheritdoc
148148
*/
149149
public function delete(array $prices)
150150
{
@@ -171,16 +171,17 @@ private function getExistingPrices(array $skus, $groupBySku = false)
171171
$ids = $this->retrieveAffectedIds($skus);
172172
$rawPrices = $this->tierPricePersistence->get($ids);
173173
$prices = [];
174-
175-
$linkField = $this->tierPricePersistence->getEntityLinkField();
176-
$skuByIdLookup = $this->buildSkuByIdLookup($skus);
177-
foreach ($rawPrices as $rawPrice) {
178-
$sku = $skuByIdLookup[$rawPrice[$linkField]];
179-
$price = $this->tierPriceFactory->create($rawPrice, $sku);
180-
if ($groupBySku) {
181-
$prices[$sku][] = $price;
182-
} else {
183-
$prices[] = $price;
174+
if ($rawPrices) {
175+
$linkField = $this->tierPricePersistence->getEntityLinkField();
176+
$skuByIdLookup = $this->buildSkuByIdLookup($skus);
177+
foreach ($rawPrices as $rawPrice) {
178+
$sku = $skuByIdLookup[$rawPrice[$linkField]];
179+
$price = $this->tierPriceFactory->create($rawPrice, $sku);
180+
if ($groupBySku) {
181+
$prices[$sku][] = $price;
182+
} else {
183+
$prices[] = $price;
184+
}
184185
}
185186
}
186187

app/code/Magento/Catalog/Model/ProductIdLocator.php

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,43 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa
3737
*/
3838
private $idsBySku = [];
3939

40+
/**
41+
* Batch size to iterate collection
42+
*
43+
* @var int
44+
*/
45+
private $batchSize;
46+
4047
/**
4148
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
4249
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory
43-
* @param string $limitIdsBySkuValues
50+
* @param string $idsLimit
51+
* @param int $batchSize defines how many items can be processed by one iteration
4452
*/
4553
public function __construct(
4654
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
4755
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
48-
$idsLimit
56+
$idsLimit,
57+
int $batchSize = 5000
4958
) {
5059
$this->metadataPool = $metadataPool;
5160
$this->collectionFactory = $collectionFactory;
5261
$this->idsLimit = (int)$idsLimit;
62+
$this->batchSize = $batchSize;
5363
}
5464

5565
/**
56-
* {@inheritdoc}
66+
* @inheritdoc
67+
*
68+
* Load product items by provided products SKUs.
69+
* Products collection will be iterated by pages with the $this->batchSize as a page size (for a cases when to many
70+
* products SKUs were provided in parameters.
71+
* Loaded products will be chached in the $this->idsBySku variable, but in the end of the method these storage will
72+
* be truncated to $idsLimit quantity.
73+
* As a result array with the products data will be returned with the following scheme:
74+
* $data['product_sku']['link_field_value' => 'product_type']
75+
*
76+
* @throws \Exception
5777
*/
5878
public function retrieveProductIdsBySkus(array $skus)
5979
{
@@ -72,8 +92,16 @@ public function retrieveProductIdsBySkus(array $skus)
7292
$linkField = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
7393
->getLinkField();
7494

75-
foreach ($collection as $item) {
76-
$this->idsBySku[strtolower(trim($item->getSku()))][$item->getData($linkField)] = $item->getTypeId();
95+
$collection->setPageSize($this->batchSize);
96+
$pages = $collection->getLastPageNumber();
97+
for ($currentPage = 1; $currentPage <= $pages; $currentPage++) {
98+
$collection->setCurPage($currentPage);
99+
foreach ($collection->getItems() as $item) {
100+
$sku = strtolower(trim($item->getSku()));
101+
$itemIdentifier = $item->getData($linkField);
102+
$this->idsBySku[$sku][$itemIdentifier] = $item->getTypeId();
103+
}
104+
$collection->clear();
77105
}
78106
}
79107

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
290290
*/
291291
private $dimensionFactory;
292292

293+
/**
294+
* @var \Magento\Framework\DataObject
295+
*/
296+
private $emptyItem;
297+
293298
/**
294299
* Collection constructor
295300
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
@@ -550,7 +555,10 @@ protected function _prepareStaticFields()
550555
*/
551556
public function getNewEmptyItem()
552557
{
553-
$object = parent::getNewEmptyItem();
558+
if (null === $this->emptyItem) {
559+
$this->emptyItem = parent::getNewEmptyItem();
560+
}
561+
$object = clone $this->emptyItem;
554562
if ($this->isEnabledFlat()) {
555563
$object->setIdFieldName($this->getEntity()->getIdFieldName());
556564
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<arguments>
1212
<argument name="product" defaultValue="product"/>
1313
</arguments>
14-
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductRow"/>
14+
<click selector="{{AdminProductGridSection.productRowBySku(product.sku)}}" stepKey="clickOnProductRow"/>
1515
<waitForPageLoad time="30" stepKey="waitForProductPageLoad"/>
1616
<seeInField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeProductSkuOnEditProductPage"/>
1717
</actionGroup>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,24 @@
4242
<data key="is_active">true</data>
4343
<var key="parent_id" entityType="category" entityKey="id" />
4444
</entity>
45+
<entity name="FirstLevelSubCat" type="category">
46+
<data key="name" unique="suffix">FirstLevelSubCategory</data>
47+
<data key="name_lwr" unique="suffix">subcategory</data>
48+
</entity>
49+
<entity name="SecondLevelSubCat" type="category">
50+
<data key="name" unique="suffix">SecondLevelSubCategory</data>
51+
<data key="name_lwr" unique="suffix">subcategory</data>
52+
</entity>
53+
<entity name="ThirdLevelSubCat" type="category">
54+
<data key="name" unique="suffix">ThirdLevelSubCategory</data>
55+
<data key="name_lwr" unique="suffix">subcategory</data>
56+
</entity>
57+
<entity name="FourthLevelSubCat" type="category">
58+
<data key="name" unique="suffix">FourthLevelSubCategory</data>
59+
<data key="name_lwr" unique="suffix">subcategory</data>
60+
</entity>
61+
<entity name="FifthLevelCat" type="category">
62+
<data key="name" unique="suffix">FifthLevelCategory</data>
63+
<data key="name_lwr" unique="suffix">category</data>
64+
</entity>
4565
</entities>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,19 @@
480480
<requiredEntity type="product_extension_attribute">EavStock1</requiredEntity>
481481
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
482482
</entity>
483+
<entity name="defaultSimpleProduct" type="product">
484+
<data key="name" unique="suffix">Test </data>
485+
<data key="sku" unique="suffix">testsku</data>
486+
<data key="type_id">simple</data>
487+
<data key="attribute_set_id">4</data>
488+
<data key="visibility">4</data>
489+
<data key="price">560.00</data>
490+
<data key="urlKey" unique="suffix">testurl-</data>
491+
<data key="status">1</data>
492+
<data key="quantity">25</data>
493+
<data key="weight">1</data>
494+
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
495+
</entity>
483496
<entity name="ProductWithLongNameSku" extends="ApiSimpleProduct">
484497
<data key="name" unique="suffix">Product With Long Name And Sku - But not too long</data>
485498
<data key="sku" unique="suffix">Product With Long Name And Sku - But not too long</data>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<element name="ContentTab" type="input" selector="input[name='name']"/>
2323
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
2424
<element name="panelFieldControl" type="input" selector='//aside//div[@data-index="{{arg1}}"]/descendant::*[@name="{{arg2}}"]' parameterized="true"/>
25+
<element name="productsInCategory" type="input" selector="div[data-index='assign_products']"/>
2526
</section>
2627
<section name="CategoryContentSection">
2728
<element name="SelectFromGalleryBtn" type="button" selector="//label[text()='Select from Gallery']"/>
@@ -38,6 +39,13 @@
3839
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
3940
<element name="filterPriceRangeUseConfig" type="checkbox" selector="input[name='use_config[filter_price_range]']"/>
4041
<element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index={{arg1}}]&gt;.admin__field-label span'), ':after').getPropertyValue('content');" parameterized="true"/>
42+
<element name="displayMode" type="button" selector="select[name='display_mode']"/>
43+
<element name="anchor" type="checkbox" selector="input[name='is_anchor']"/>
44+
<element name="productListCheckBox" type="checkbox" selector="input[name='use_config[available_sort_by]']" />
45+
<element name="productList" type="text" selector="select[name='available_sort_by']"/>
46+
<element name="defaultProductLisCheckBox" type="checkbox" selector="input[name='use_config[default_sort_by]']"/>
47+
<element name="defaultProductList" type="text" selector="select[name='default_sort_by']"/>
48+
<element name="layeredNavigationPriceCheckBox" type="checkbox" selector="input[name='use_config[filter_price_range]']"/>
4149
</section>
4250
<section name="CatalogWYSIWYGSection">
4351
<element name="ShowHideBtn" type="button" selector="#togglecategory_form_description"/>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,13 @@
1616
<element name="imageFileName" type="text" selector=".file-uploader-filename"/>
1717
<element name="removeImageButton" type="button" selector=".file-uploader-summary .action-remove"/>
1818
<element name="AddCMSBlock" type="select" selector="//*[@name='landing_page']"/>
19+
<element name="description" type="input" selector="//*[@name='description']"/>
20+
<element name="content" type="button" selector="div[data-index='content'"/>
21+
<element name="categoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'no-active-category')]" parameterized="true" />
22+
<element name="categoryPageTitle" type="text" selector="h1.page-title" />
23+
<element name="activeCategoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'active-category')]" parameterized="true" />
24+
<element name="productTableColumnName" type="input" selector="#catalog_category_products_filter_name"/>
25+
<element name="productTableRow" type="button" selector="#catalog_category_products_table tbody tr"/>
26+
<element name="productSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/>
1927
</section>
2028
</sections>

0 commit comments

Comments
 (0)