Skip to content

Commit

Permalink
Merge branch '2.4-develop' into add-AdminSetSTockStatusActionGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Charlie authored Dec 2, 2020
2 parents 8626a36 + 297728f commit f95ed51
Show file tree
Hide file tree
Showing 143 changed files with 3,446 additions and 396 deletions.
32 changes: 9 additions & 23 deletions app/code/Magento/Authorization/Model/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,30 @@
class Rules extends \Magento\Framework\Model\AbstractModel
{
/**
* Class constructor
*
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Authorization\Model\ResourceModel\Rules $resource
* @param \Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Authorization\Model\ResourceModel\Rules $resource,
\Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection,
array $data = []
) {
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}

/**
* Class constructor
*
* @return void
* @inheritdoc
*/
protected function _construct()
{
$this->_init(\Magento\Authorization\Model\ResourceModel\Rules::class);
}

/**
* Obsolete method of update
*
* @return $this
* @deprecated Method was never implemented and used.
*/
public function update()
{
$this->getResource()->update($this);
// phpcs:disable Magento2.Functions.DiscouragedFunction
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);

return $this;
}

/**
* Save authorization rule relation
*
* @return $this
*/
public function saveRel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

namespace Magento\Catalog\Block\Product\View\Options;

use Magento\Catalog\Pricing\Price\BasePrice;
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;

/**
* Product options section abstract block.
Expand Down Expand Up @@ -55,24 +56,42 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
*/
private $calculateCustomOptionCatalogRule;

/**
* @var CalculatorInterface
*/
private $calculator;

/**
* @var PriceCurrencyInterface
*/
private $priceCurrency;

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
* @param \Magento\Catalog\Helper\Data $catalogData
* @param array $data
* @param CalculateCustomOptionCatalogRule|null $calculateCustomOptionCatalogRule
* @param CalculatorInterface|null $calculator
* @param PriceCurrencyInterface|null $priceCurrency
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
\Magento\Catalog\Helper\Data $catalogData,
array $data = [],
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null,
CalculatorInterface $calculator = null,
PriceCurrencyInterface $priceCurrency = null
) {
$this->pricingHelper = $pricingHelper;
$this->_catalogHelper = $catalogData;
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
$this->calculator = $calculator
?? ObjectManager::getInstance()->get(CalculatorInterface::class);
$this->priceCurrency = $priceCurrency
?? ObjectManager::getInstance()->get(PriceCurrencyInterface::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -188,7 +207,13 @@ protected function _formatPrice($value, $flag = true)
}

$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
$optionAmount = $isPercent
? $this->calculator->getAmount(
$this->priceCurrency->roundPrice($value['pricing_value']),
$this->getProduct(),
null,
$context
) : $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
$optionAmount,
$customOptionPrice,
Expand Down
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="AssertStorefrontCustomOptionCheckboxByPriceActionGroup">
<annotations>
<description>Validates that the provided price for Custom Option Checkbox is present on the Storefront Product page.</description>
</annotations>
<arguments>
<argument name="optionTitle" type="string" defaultValue="{{ProductOptionCheckbox.title}}"/>
<argument name="price" type="string" defaultValue="10"/>
</arguments>

<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptionsCheckbox(optionTitle, price)}}" stepKey="checkPriceProductOptionCheckbox"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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="AssertStorefrontProductPageGalleryChangingFullscreenImageByRibbonActionGroup">
<annotations>
<description>On the product page change main image by clicking on the images in the ribbon. Fullscreen</description>
</annotations>
<arguments>
<argument name="startImage" type="string" />
<argument name="expectedImage" type="string" />
</arguments>
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartFullscreenImage"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageInThumbnail"/>
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="clickOnExpectedImage"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(expectedImage)}}" stepKey="seeExpectedImageAfterClick"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageActiveInThumbnailAfterChange"/>
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="clickOnStartImageInRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartImageAfterSecondChange"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageActiveInThumbnailAfterSecondChange"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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="AssertStorefrontProductPageGalleryChangingMainImageByRibbonActionGroup">
<annotations>
<description>Changing main image on product page media gallery by clicking on the images in the fotorama ribbon</description>
</annotations>
<arguments>
<argument name="startImage" type="string" />
<argument name="expectedImage" type="string" />
</arguments>
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="waitActiveImageDefault"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageThumbnail"/>
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="firstClickOnImageInRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageSelectedInRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(expectedImage)}}" stepKey="seeChangedImageAfterFirstClick"/>
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="secondClickOnImageInRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageSelectedInRibbonAfterSecondClick"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeChangedImageAfterSecondClick"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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="AssertStorefrontProductPageGalleryFullscreenThumbnailDragActionGroup">
<annotations>
<description>On the product page check functional of drag actions in the fotorama ribbon during fullscreen</description>
</annotations>
<arguments>
<argument name="dragPointImage" type="string" />
<argument name="currentImage" type="string"/>
<argument name="firstImage" type="string" />
</arguments>
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImage"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbon"/>
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="-300" y="0" stepKey="dragRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImageAfterDrag"/>
<dontSeeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="dontSeeFirstImageInRibbonAfterDrag"/>
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="300" y="0" stepKey="dragBackRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeMainImageAfterBackDrag"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbonAfterBackDrag"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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="AssertStorefrontProductPageGalleryImageDimensionsActionGroup">
<annotations>
<description>On the product page grab dimensions of the displayed product image, and image section. Assert that image is less or equals</description>
</annotations>
<arguments>
<argument name="imageSource" defaultValue="{{StorefrontProductMediaSection.mainImageForJsActions}}" type="string"/>
</arguments>
<executeJS function="var img=document.querySelector('{{imageSource}}');
return img.clientHeight;" stepKey="getImageHeight"/>
<executeJS function="var img=document.querySelector('{{imageSource}}');
return img.clientWidth;" stepKey="getImageWidth"/>
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
return img.clientHeight;" stepKey="getSectionHeight"/>
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
return img.clientWidth;" stepKey="getSectionWidth"/>
<assertLessThanOrEqual stepKey="checkHeightIsCorrect">
<actualResult type="variable">getImageHeight</actualResult>
<expectedResult type="variable">getSectionHeight</expectedResult>
</assertLessThanOrEqual>
<assertLessThanOrEqual stepKey="checkWidthIsCorrect">
<actualResult type="variable">getImageWidth</actualResult>
<expectedResult type="variable">getSectionWidth</expectedResult>
</assertLessThanOrEqual>
</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="AssertStorefrontProductPageGalleryImagePositionInThumbnailRibbonActionGroup">
<annotations>
<description>Check the expected image position in the fotorama ribbon on the product page</description>
</annotations>
<arguments>
<argument name="image" defaultValue="Magento2.filename" type="string"/>
<argument name="extension" defaultValue="Magento2.file_extension" type="string"/>
<argument name="position" defaultValue="0" type="string" />
</arguments>
<grabAttributeFrom userInput="src" selector="{{StorefrontProductMediaSection.fotoramaImageThumbnailImgByNumber(position)}}" stepKey="grabSrcFromThumbnailImageByPosition"/>
<assertRegExp stepKey="checkImagePositionInThumbnail">
<actualResult type="variable">$grabSrcFromThumbnailImageByPosition</actualResult>
<expectedResult type="string">|{{image}}[_\d]*.{{extension}}|</expectedResult>
</assertRegExp>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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="AssertStorefrontProductPageGalleryMainImageButtonsActionGroup">
<annotations>
<description>Assert the buttons functionality "change image" on the product media gallery on the product page</description>
</annotations>
<arguments>
<argument name="startImage" type="string" />
<argument name="expectedImage" type="string" />
</arguments>
<moveMouseOver selector="{{StorefrontProductMediaSection.mainImageForJsActions}}" stepKey="hoverOverImage"/>
<waitForElementVisible selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="waitForButtons"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeProductImageBeforeActions"/>
<click selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="clickOnNextImageButton"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageSelectedInRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(expectedImage)}}" stepKey="seeExpectedImageOnPreview"/>
<click selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="clickOnPrevImageButton"/>
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageSelectedInRibbonAfterSecondChange"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeMainProductImageAfterSecondChange"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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="AssertStorefrontProductPageGalleryThumbnailDragActionGroup">
<annotations>
<description>Check functional of drag actions in the thumbnail ribbon on the product page</description>
</annotations>
<arguments>
<argument name="dragPointImage" type="string" />
<argument name="currentImage" type="string"/>
<argument name="firstImage" type="string" />
</arguments>
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageBeforeDragActions"/>
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButtonBeforeDragActions"/>
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="-300" y="0" stepKey="dragRibbonForward"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageDontChangeAfterDrag"/>
<waitForElementVisible selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="waitPrevButton"/>
<seeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="seePrevButton"/>
<dontSeeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="dontSeeFirstImageInRibbonAfterDrag"/>
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="300" y="0" stepKey="dragBackRibbon"/>
<seeElement selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageDontChangeAfterBackDrag"/>
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbonAfterBackDrag"/>
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButtonAfterBackDrag"/>
</actionGroup>
</actionGroups>
Loading

0 comments on commit f95ed51

Please sign in to comment.