Skip to content

Commit a913cb9

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-73342' into 2.2-develop-pr39
2 parents 45d00ce + 9d3f6b6 commit a913cb9

File tree

179 files changed

+2454
-642
lines changed

Some content is hidden

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

179 files changed

+2454
-642
lines changed

app/code/Magento/Bundle/Test/Mftf/ActionGroup/BundleProductsOnAdminActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<!-- Select First Simple -->
2626
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickOnFiltersButton"/>
2727
<conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clearFilters"/>
28-
<fillField selector="{{AdminProductGridFilterSection.name}}" userInput="{{simpleProductFirst.name}}" stepKey="fillNameFilter"/>
28+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{simpleProductFirst.name}}" stepKey="fillNameFilter"/>
2929
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="applyFilters"/>
3030
<click selector="{{AdminProductFormBundleSection.firstRowCheckbox}}" stepKey="selectFirstSimple"/>
3131

3232
<!-- Select Second Simple -->
3333
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickOnFiltersButton2"/>
3434
<conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clearFilters2"/>
35-
<fillField selector="{{AdminProductGridFilterSection.name}}" userInput="{{simpleProductSecond.name}}" stepKey="fillNameFilter2"/>
35+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{simpleProductSecond.name}}" stepKey="fillNameFilter2"/>
3636
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="applyFilters2"/>
3737
<click selector="{{AdminProductFormBundleSection.firstRowCheckbox}}" stepKey="selectSecondSimple"/>
3838

app/code/Magento/Catalog/Block/Product/ImageBuilder.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@ protected function getRatio(\Magento\Catalog\Helper\Image $helper)
121121
*/
122122
public function create()
123123
{
124-
/** @var \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface $simpleOption */
125-
$simpleOption = $this->product->getOptionById('simple_product');
126-
127-
if ($simpleOption !== null) {
128-
$optionProduct = $simpleOption->getProduct();
129-
$this->setProduct($optionProduct);
130-
}
131-
132124
/** @var \Magento\Catalog\Helper\Image $helper */
133125
$helper = $this->helperFactory->create()
134126
->init($this->product, $this->imageId);
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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\Model\Product\Configuration\Item;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Framework\App\ObjectManager;
12+
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
class ItemResolverComposite implements ItemResolverInterface
17+
{
18+
/**
19+
* @var string[]
20+
*/
21+
private $itemResolvers = [];
22+
23+
/**
24+
* @var ItemResolverInterface[]
25+
*/
26+
private $itemResolversInstances = [];
27+
28+
/**
29+
* @param string[] $itemResolvers
30+
*/
31+
public function __construct(array $itemResolvers)
32+
{
33+
$this->itemResolvers = $itemResolvers;
34+
}
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
public function getFinalProduct(ItemInterface $item): ProductInterface
40+
{
41+
$finalProduct = $item->getProduct();
42+
43+
foreach ($this->itemResolvers as $resolver) {
44+
$resolvedProduct = $this->getItemResolverInstance($resolver)->getFinalProduct($item);
45+
if ($resolvedProduct !== $finalProduct) {
46+
$finalProduct = $resolvedProduct;
47+
break;
48+
}
49+
}
50+
51+
return $finalProduct;
52+
}
53+
54+
/**
55+
* Get the instance of the item resolver by class name.
56+
*
57+
* @param string $className
58+
* @return ItemResolverInterface
59+
*/
60+
private function getItemResolverInstance(string $className): ItemResolverInterface
61+
{
62+
if (!isset($this->itemResolversInstances[$className])) {
63+
$this->itemResolversInstances[$className] = ObjectManager::getInstance()->get($className);
64+
}
65+
66+
return $this->itemResolversInstances[$className];
67+
}
68+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\Model\Product\Configuration\Item;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
12+
/**
13+
* Resolves the product from a configured item.
14+
*
15+
* @api
16+
*/
17+
interface ItemResolverInterface
18+
{
19+
/**
20+
* Get the final product from a configured item by product type and selection.
21+
*
22+
* @param ItemInterface $item
23+
* @return ProductInterface
24+
*/
25+
public function getFinalProduct(ItemInterface $item): ProductInterface;
26+
}

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,7 @@ public function attributesCompare($attributeOne, $attributeTwo)
291291
$sortOne = $attributeOne->getGroupSortPath() * 1000 + $attributeOne->getSortPath() * 0.0001;
292292
$sortTwo = $attributeTwo->getGroupSortPath() * 1000 + $attributeTwo->getSortPath() * 0.0001;
293293

294-
if ($sortOne > $sortTwo) {
295-
return 1;
296-
} elseif ($sortOne < $sortTwo) {
297-
return -1;
298-
}
299-
300-
return 0;
294+
return $sortOne <=> $sortTwo;
301295
}
302296

303297
/**

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<argument name="product" defaultValue="product"/>
1414
</arguments>
1515
<amOnPage stepKey="navigateProductPage" url="/{{product.name}}.html"/>
16-
<click stepKey="addToCart" selector="{{StorefrontProductPageSection.AddToCartBtn}}"/>
17-
<waitForElementVisible selector="{{StorefrontProductPageSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
16+
<click stepKey="addToCart" selector="{{StorefrontProductPageSection.addToCartBtn}}"/>
17+
<waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" time="30" stepKey="waitForProductAdded"/>
1818
</actionGroup>.
1919
<!--Click Add to Cart button in storefront product page-->
2020
<actionGroup name="addToCartFromStorefrontProductPage">
2121
<arguments>
2222
<argument name="productName"/>
2323
</arguments>
24-
<click selector="{{StorefrontProductPageSection.AddToCartBtn}}" stepKey="addToCart"/>
24+
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/>
2525
<waitForElementVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdding"/>
2626
<waitForElementNotVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
2727
<waitForElementVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdded"/>
@@ -30,4 +30,4 @@
3030
<waitForPageLoad stepKey="waitForPageLoad"/>
3131
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
3232
</actionGroup>
33-
</actionGroups>
33+
</actionGroups>

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11-
<!--Actions to delete category-->
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<!--Action to delete product attribute-->
1212
<actionGroup name="DeleteProductAttribute">
1313
<arguments>
1414
<argument name="productAttribute"/>
@@ -17,7 +17,7 @@
1717
<waitForPageLoad time="30" stepKey="waitForProductAttributesGridPageLoad"/>
1818
<click selector="{{AdminProductAttributeGridSection.resetFilter}}" stepKey="resetFilter"/>
1919
<fillField selector="{{AdminProductAttributeGridSection.gridFilterFrontEndLabel}}"
20-
userInput="{{productAttribute.default_label}}" stepKey="fillAttributeDefaultLabelInput"/>
20+
userInput="{{productAttribute.default_label}}" stepKey="fillAttributeDefaultLabelInput"/>
2121
<click selector="{{AdminProductAttributeGridSection.search}}" stepKey="searchForAttribute"/>
2222
<click selector="{{AdminProductAttributeGridSection.firstRow}}" stepKey="clickFirstRow"/>
2323
<waitForPageLoad time="30" stepKey="waitForPageLoad"/>

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@
3030
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
3131
</actionGroup>
3232

33+
<!--Fill main fields in create product form-->
34+
<actionGroup name="fillMainProductForm">
35+
<arguments>
36+
<argument name="product" defaultValue="_defaultProduct"/>
37+
</arguments>
38+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="fillProductName"/>
39+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="fillProductSku"/>
40+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="fillProductPrice"/>
41+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="fillProductQty"/>
42+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="selectStockStatus"/>
43+
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/>
44+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/>
45+
</actionGroup>
46+
3347
<!--Fill main fields in create product form with no weight, useful for virtual and downloadable products -->
3448
<actionGroup name="fillMainProductFormNoWeight">
3549
<arguments>
@@ -50,6 +64,19 @@
5064
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
5165
</actionGroup>
5266

67+
<!--Upload image for product-->
68+
<actionGroup name="addProductImage">
69+
<arguments>
70+
<argument name="image" defaultValue="ProductImage"/>
71+
</arguments>
72+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
73+
<waitForPageLoad time="30" stepKey="waitForPageRefresh"/>
74+
<waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/>
75+
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
76+
<waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/>
77+
<waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/>
78+
</actionGroup>
79+
5380
<!--Add special price to product in Admin product page-->
5481
<actionGroup name="AddSpecialPriceToProductActionGroup">
5582
<arguments>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<!--Add a custom option of type "file" to a product-->
12+
<actionGroup name="AddProductCustomOptionFile">
13+
<arguments>
14+
<argument name="option" defaultValue="ProductOptionFile"/>
15+
</arguments>
16+
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" visible="false" stepKey="openCustomOptionSection"/>
17+
<click selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" stepKey="clickAddOption"/>
18+
<waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" stepKey="waitForOption"/>
19+
<fillField selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{option.title}}" stepKey="fillTitle"/>
20+
<click selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" stepKey="openTypeSelect"/>
21+
<click selector="{{AdminProductCustomizableOptionsSection.optionType('File')}}" stepKey="selectTypeFile"/>
22+
<waitForElementVisible selector="{{AdminProductCustomizableOptionsSection.optionPrice}}" stepKey="waitForElements"/>
23+
<fillField selector="{{AdminProductCustomizableOptionsSection.optionPrice}}" userInput="{{option.price}}" stepKey="fillPrice"/>
24+
<selectOption selector="{{AdminProductCustomizableOptionsSection.optionPriceType}}" userInput="{{option.price_type}}" stepKey="selectPriceType"/>
25+
<fillField selector="{{AdminProductCustomizableOptionsSection.optionFileExtensions}}" userInput="{{option.file_extension}}" stepKey="fillCompatibleExtensions"/>
26+
</actionGroup>
27+
</actionGroups>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<waitForPageLoad stepKey="waitForPageLoad"/>
3636
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickOnFiltersButton"/>
3737
<conditionalClick selector="{{AdminProductGridFilterSection.clearAll}}" dependentSelector="{{AdminProductGridFilterSection.clearAll}}" visible="true" stepKey="clearFilters"/>
38-
<fillField selector="{{AdminProductGridFilterSection.name}}" userInput="{{product.name}}" stepKey="fillNameFieldInFilter"/>
38+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product.name}}" stepKey="fillNameFieldInFilter"/>
3939
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="applyFilters"/>
4040
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="clickMulticheckDropDown"/>
4141
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllFilteredProducts"/>

0 commit comments

Comments
 (0)