Skip to content

Commit

Permalink
Merge pull request #7722 from magento-amigos/2.4-develop-prs
Browse files Browse the repository at this point in the history
[Amigos] Community Contributions - 2.4-develop
  • Loading branch information
ishakhsuvarov committed Jun 14, 2022
2 parents 0953fe7 + f7bd703 commit 28c1f28
Show file tree
Hide file tree
Showing 51 changed files with 422 additions and 70 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/AwsS3/Driver/AwsS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ public function getRealPath($path)
*/
public function rename($oldPath, $newPath, DriverInterface $targetDriver = null): bool
{
if ($oldPath === $newPath) {
return true;
}

try {
$this->adapter->move(
$this->normalizeRelativePath($oldPath, true),
Expand Down
17 changes: 17 additions & 0 deletions app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,4 +496,21 @@ public function testCreateDirectory(): void

self::assertTrue($this->driver->createDirectory(self::URL . 'test/test2/'));
}

public function testRename(): void
{
$this->adapterMock->expects(self::once())
->method('move')
->with('test/path', 'test/path2');

self::assertTrue($this->driver->rename('test/path', 'test/path2'));
}

public function testRenameSameDestination(): void
{
$this->adapterMock->expects(self::never())
->method('move');

self::assertTrue($this->driver->rename('test/path', 'test/path'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@

<!-- Go to new product page and see a default attribute -->
<!-- Switch from default attribute set to new attribute set -->
<amOnPage url="{{AdminProductCreatePage.url('4', 'bundle')}}" stepKey="goToNewProductPage"/>
<waitForPageLoad stepKey="wait2"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToNewProductPage">
<argument name="attributeSetId" value="4"/>
<argument name="productType" value="bundle"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="wait2"/>

<actionGroup ref="AdminSelectAttributeSetOnEditProductPageActionGroup" stepKey="startEditAttrSet">
<argument name="attributeSet" value="{{ProductAttributeFrontendLabel.label}}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
</actionGroup>

<!--Go to product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreationPage"/>

<!--Enable/Disable Toggle-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
</after>

<!--Create bundle product-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreationPage"/>
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
</after>

<!--Create bundle product-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreationPage"/>
<conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="conditionallyOpenSectionBundleItems"/>
<click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!-- Add two bundle items -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/>
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
</after>

<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
<click selector="{{AdminProductFormBundleSection.dynamicSkuToggle}}" stepKey="disableDynamicSku"/>
<click selector="{{AdminProductFormBundleSection.dynamicPrice}}" stepKey="clickDynamicPriceSwitcher"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
</after>
<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/>
<!-- Add Option, a "Radio Buttons" type option -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
</after>

<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!--Create bundle product-->
Expand Down Expand Up @@ -76,7 +79,10 @@

<!--Creating Second bundle product-->
<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage2"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage2">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad2"/>

<!--Create bundle product 2-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!--Add description-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@
</actionGroup>

<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!--Categories-->
<click selector="{{AdminProductFormBundleSection.categoriesDropDown}}" stepKey="dropDownCategories"/>
<fillField selector="{{AdminProductFormBundleSection.searchForCategory}}" userInput="{{SimpleSubCategory.name}}" stepKey="searchForCategory"/>
Expand All @@ -67,7 +70,7 @@
</actionGroup>
<actionGroup ref="AdminCheckFirstCheckboxInAddProductsToOptionPanelGridActionGroup" stepKey="selectFirstGridRow2"/>
<click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="clickAddSelectedBundleProducts"/>

<actionGroup ref="AdminFillBundleItemQtyActionGroup" stepKey="fillProductDefaultQty1">
<argument name="optionIndex" value="0"/>
<argument name="productIndex" value="0"/>
Expand All @@ -79,7 +82,7 @@
<argument name="productIndex" value="1"/>
<argument name="qty" value="{{BundleProduct.defaultQuantity}}"/>
</actionGroup>

<actionGroup ref="AncillaryPrepBundleProductActionGroup" stepKey="createBundledProductForTwoSimpleProducts"/>

<!--Save the product-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
</after>
<!--Go to bundle product creation page-->
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
<argument name="productType" value="{{BundleProduct.type}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>

<!--Categories-->
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Catalog/Model/Product/Type/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,10 @@ protected function _prepareOptions(\Magento\Framework\DataObject $buyRequest, $p

if ($product->getSkipCheckRequiredOption() !== true) {
$group->validateUserValue($optionsFromRequest);
} elseif ($optionsFromRequest !== null && isset($optionsFromRequest[$option->getId()])) {
} elseif ($optionsFromRequest !== null
&& isset($optionsFromRequest[$option->getId()])
&& $optionsFromRequest[$option->getId()] !== ''
) {
if (is_array($optionsFromRequest[$option->getId()])) {
$group->validateUserValue($optionsFromRequest);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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="AdminCreateAttributeTextSwatchNthValueActionGroup" >
<annotations>
<description>Fills in the Text swatch Field.</description>
</annotations>
<arguments>
<argument name="row" type="string"/>
<argument name="swatchNameStore" type="string"/>
<argument name="storeName" type="string"/>
<argument name="swatchNameAdmin" type="string"/>
<argument name="adminName" type="string"/>
</arguments>

<scrollTo selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="scrollToOption"/>
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddSwatch"/>
<waitForPageLoad stepKey="waitForNewTextSwatch"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOptionTextSwatch(row)}}" userInput="{{swatchNameAdmin}}" stepKey="fillAdminSwatchField"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOptionTextOption(row)}}" userInput="{{adminName}}" stepKey="fillAdminOptionField"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreViewTextSwatch(row)}}" userInput="{{swatchNameStore}}" stepKey="fillDefaultStoreViewSwatchField"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreViewTextOption(row)}}" userInput="{{storeName}}" stepKey="fillDefaultStoreViewOptionField"/>
</actionGroup>
</actionGroups>


Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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="AdminCreateAttributeVisualSwatchNthValueActionGroup" >
<annotations>
<description>Fills in the visual swatch Field.</description>
</annotations>
<arguments>
<argument name="row" type="string"/>
<argument name="adminName" type="string"/>
<argument name="storeName" type="string"/>
</arguments>

<scrollTo selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="scrollToOption"/>
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddSwatch"/>
<waitForPageLoad stepKey="waitForNewTextSwatch"/>
<waitForPageLoad stepKey="waitForNewVisualSwatch"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.visualSwatchAdmin(row)}}" userInput="{{adminName}}" stepKey="fillSwatchForAdmin"/>
<fillField selector="{{AdminCreateNewProductAttributeSection.visualSwatchStore(row)}}" userInput="{{storeName}}" stepKey="fillSwatchForStore"/>
</actionGroup>
</actionGroups>


16 changes: 16 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,22 @@
<data key="option3_admin" unique="suffix">opt3Admin</data>
<data key="option3_frontend" unique="suffix">opt3Front</data>
</entity>
<entity name="visualSwatchProductAttribute" extends="newProductAttribute" type="ProductAttribute">
<data key="frontend_input">swatch_visual</data>
<data key="frontend_input_admin">Visual Swatch</data>
<data key="is_required_admin">No</data>
<data key="option1_admin" unique="suffix">opt1Admin</data>
<data key="option1_store" unique="suffix">opt1Front</data>
</entity>
<entity name="textSwatchProductAttribute" extends="newProductAttribute" type="ProductAttribute">
<data key="frontend_input">text_visual</data>
<data key="frontend_input_admin">Text Swatch</data>
<data key="is_required_admin">No</data>
<data key="swatchStore" unique="suffix">opt1swatch</data>
<data key="store" unique="suffix">opt1store</data>
<data key="SwatchAdmin" unique="suffix">opt1SwatchAdmin</data>
<data key="admin" unique="suffix">opt1Admin</data>
</entity>
<entity name="dropdownProductAttributeWithQuote" extends="productAttributeWysiwyg" type="ProductAttribute">
<data key="frontend_input">select</data>
<data key="frontend_input_admin">Dropdown</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@
<element name="allowHtmlTags" type="checkbox" selector="//input[contains(@name, 'is_html_allowed_on_front')]/..//label"/>
<element name="visibleOnStorefront" type="checkbox" selector="//input[contains(@name, 'is_visible_on_front')]/..//label"/>
<element name="sortProductListing" type="checkbox" selector="//input[contains(@name, 'is_visible_on_front')]/..//label"/>
<element name="visualSwatchAdmin" type="input" selector="input[name='optionvisual[value][option_{{var}}][1]']" parameterized="true"/>
<element name="visualSwatchStore" type="input" selector="input[name='optionvisual[value][option_{{var}}][0]']" parameterized="true"/>
<element name="adminOptionTextOption" type="input" selector="input[name='swatchtext[value][option_{{var}}][0]']" parameterized="true"/>
<element name="adminOptionTextSwatch" type="input" selector="input[name='optiontext[value][option_{{var}}][0]']" parameterized="true"/>
<element name="defaultStoreViewTextSwatch" type="input" selector="input[name='swatchtext[value][option_{{var}}][1]']" parameterized="true"/>
<element name="defaultStoreViewTextOption" type="input" selector="input[name='optiontext[value][option_{{var}}][1]']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
<!-- Save attribute set -->
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="SaveAttributeSet"/>
<!-- Go to create new product page -->
<amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="navigateToNewProduct">
<argument name="attributeSetId" value="{{AddToDefaultSet.attributeSetId}}"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageLoad"/>
<!-- Assert attribute can be used in product creation -->
<seeElement selector="{{AdminProductFormSection.attributeLabelByText($$attribute.attribute[frontend_labels][0][label]$$)}}" stepKey="seeLabel"/>
</test>
Expand Down
Loading

0 comments on commit 28c1f28

Please sign in to comment.