Skip to content

Commit

Permalink
Merge branch '2.4-develop' into bugfix/issue-12584
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel da Gama committed Jan 11, 2021
2 parents ea54519 + 63434d2 commit 377e070
Show file tree
Hide file tree
Showing 85 changed files with 2,019 additions and 255 deletions.
8 changes: 7 additions & 1 deletion app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Magento\Bundle\Model\Product\Type;
use Magento\Bundle\Model\ResourceModel\BundleFactory;
use Magento\Bundle\Model\ResourceModel\Option\Collection;
use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor;
use Magento\Bundle\Model\ResourceModel\Selection\Collection as SelectionCollection;
use Magento\Bundle\Model\ResourceModel\Selection\CollectionFactory;
use Magento\Bundle\Model\Selection;
Expand All @@ -28,6 +27,7 @@
use Magento\CatalogInventory\Api\StockStateInterface;
use Magento\CatalogInventory\Model\StockRegistry;
use Magento\CatalogInventory\Model\StockState;
use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor;
use Magento\Framework\DataObject;
use Magento\Framework\EntityManager\EntityMetadataInterface;
use Magento\Framework\EntityManager\MetadataPool;
Expand Down Expand Up @@ -1548,6 +1548,10 @@ public function testPrepareForCartAdvancedSpecifyProductOptions()
->disableOriginalConstructor()
->getMock();

$buyRequest->method('getOptions')
->willReturn([333 => ['type' => 'image/jpeg']]);
$option->method('getId')
->willReturn(333);
$this->parentClass($group, $option, $buyRequest, $product);

$product->expects($this->any())
Expand All @@ -1556,6 +1560,8 @@ public function testPrepareForCartAdvancedSpecifyProductOptions()
$buyRequest->expects($this->once())
->method('getBundleOption')
->willReturn([0, '', 'str']);
$group->expects($this->once())
->method('validateUserValue');

$result = $this->model->prepareForCartAdvanced($buyRequest, $product);
$this->assertEquals('Please specify product option(s).', $result);
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/Catalog/Model/Product/Type/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Model\Product\Type;

Expand Down Expand Up @@ -605,7 +604,11 @@ protected function _prepareOptions(\Magento\Framework\DataObject $buyRequest, $p
if ($product->getSkipCheckRequiredOption() !== true) {
$group->validateUserValue($optionsFromRequest);
} elseif ($optionsFromRequest !== null && isset($optionsFromRequest[$option->getId()])) {
$transport->options[$option->getId()] = $optionsFromRequest[$option->getId()];
if (is_array($optionsFromRequest[$option->getId()])) {
$group->validateUserValue($optionsFromRequest);
} else {
$transport->options[$option->getId()] = $optionsFromRequest[$option->getId()];
}
}

} catch (LocalizedException $e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminChangeWebSiteAssignedToProductActionGroup" extends="AddWebsiteToProductActionGroup">
<annotations>
<description>Extends AddWebsiteToProductActionGroup. Changes website assigned to product from websiteToDeselect to website</description>
</annotations>
<arguments>
<argument name="websiteToDeselect" type="string"/>
</arguments>

<uncheckOption selector="{{ProductInWebsitesSection.website(websiteToDeselect)}}" stepKey="uncheckWebsite" after="checkWebsite"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
<annotations>
<description>Check the checkbox for the product on the Product Grid</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
</arguments>
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCheckProductOnProductGridActionGroup">
<annotations>
<description>Check the checkbox for the product on the Product Grid</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
</arguments>

<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/>

</actionGroup>
</actionGroups>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSetPriceForMassUpdateActionGroup">
<annotations>
<description>Click the "Change" checkbox for the "Price" field. Set new price.</description>
</annotations>
<arguments>
<argument name="price" type="string"/>
</arguments>

<scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/>
<click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/>
<fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/>

</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSortProductsGridByActionGroup">
<annotations>
<description>Sorts the Product Grid by field</description>
</annotations>
<arguments>
<argument name="field" type="string"/>
</arguments>

<click selector="{{AdminProductGridSection.columnHeader(field)}}" stepKey="clickWebsitesHeaderToSort"/>
<waitForLoadingMaskToDisappear stepKey="waitForApplyingChanges"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup">
<annotations>
<description>Validate if Product price is updated on the Product creation/edit page</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
<argument name="price" type="string"/>
</arguments>

<waitForPageLoad stepKey="waitForProductToLoad"/>
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/>
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/>
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<comment userInput="Clear cache and reindex | Comment is kept to preserve the step key for backward compatibility" stepKey="cleanCache"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
<argument name="indices" value="catalog_product_price"/>
</actionGroup>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickOnDoneButton"/>
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
<!--Clear cache and reindex-->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
</createData>
<!-- Create simple product -->
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexCatalogSearch">
<argument name="indices" value="catalogsearch_fulltext"/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexCatalogSearch"/>
<!-- Login to Admin page -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,60 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>

<!--Open Product Index Page-->
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>

<!--Search products using keyword -->
<actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword">
<argument name="keyword" value="Testp"/>
</actionGroup>
<actionGroup ref="ClearFiltersAdminProductGridActionGroup" stepKey="searchByKeyword"/>

<!--Sort Products by ID in descending order-->
<actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/>

<!--Select products-->
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct1.sku$$)}}" stepKey="selectFirstProduct"/>
<checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct2.sku$$)}}" stepKey="selectSecondProduct"/>
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct">
<argument name="product" value="$simpleProduct1$"/>
</actionGroup>
<actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct">
<argument name="product" value="$simpleProduct2$"/>
</actionGroup>

<actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/>

<!-- Update product price-->
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/>
<click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickChangeStatus"/>
<waitForPageLoad stepKey="waitForProductAttributePageToLoad"/>
<scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/>
<click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/>
<fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="90.99"/>
<click stepKey="clickOnSaveButton" selector="{{AdminEditProductAttributesSection.Save}}"/>
<waitForPageLoad stepKey="waitForUpdatedProductToSave" />
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="Message is added to queue" stepKey="seeAttributeUpateSuccessMsg"/>
<actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox">
<argument name="price" value="90.99"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/>

<actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/>

<!-- Start message queue -->
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer">
<argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/>
<argument name="maxMessages" value="{{AdminProductAttributeUpdateConsumerData.messageLimit}}"/>
</actionGroup>
<!-- Run cron -->

<magentoCLI command="cron:run --group=index" stepKey="runCron"/>

<!--Verify product name, sku and updated price-->
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/>
<waitForPageLoad stepKey="waitForFirstProductToLoad"/>
<seeInField stepKey="seeFirstProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct1.name$$"/>
<seeInField stepKey="seeFirstProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct1.sku$$"/>
<seeInField stepKey="seeFirstProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
<click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/>
<waitForPageLoad stepKey="waitForProductsToLoad"/>
<click stepKey="openSecondProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct2.sku$$)}}"/>
<waitForPageLoad stepKey="waitForSecondProductToLoad"/>
<seeInField stepKey="seeSecondProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct2.name$$"/>
<seeInField stepKey="seeSecondProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct2.sku$$"/>
<seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/>
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad">
<argument name="product" value="$$simpleProduct1$$"/>
<argument name="price" value="90.99"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/>

<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/>
<actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad">
<argument name="product" value="$$simpleProduct2$$"/>
<argument name="price" value="90.99"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/>

</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@

<!-- Save the second product -->
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct2"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand Down
Loading

0 comments on commit 377e070

Please sign in to comment.