Skip to content

Commit f95ed51

Browse files
Merge branch '2.4-develop' into add-AdminSetSTockStatusActionGroup
2 parents 8626a36 + 297728f commit f95ed51

File tree

143 files changed

+3446
-396
lines changed

Some content is hidden

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

143 files changed

+3446
-396
lines changed

app/code/Magento/Authorization/Model/Rules.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,30 @@
2525
class Rules extends \Magento\Framework\Model\AbstractModel
2626
{
2727
/**
28-
* Class constructor
29-
*
30-
* @param \Magento\Framework\Model\Context $context
31-
* @param \Magento\Framework\Registry $registry
32-
* @param \Magento\Authorization\Model\ResourceModel\Rules $resource
33-
* @param \Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection
34-
* @param array $data
35-
*/
36-
public function __construct(
37-
\Magento\Framework\Model\Context $context,
38-
\Magento\Framework\Registry $registry,
39-
\Magento\Authorization\Model\ResourceModel\Rules $resource,
40-
\Magento\Authorization\Model\ResourceModel\Rules\Collection $resourceCollection,
41-
array $data = []
42-
) {
43-
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
44-
}
45-
46-
/**
47-
* Class constructor
48-
*
49-
* @return void
28+
* @inheritdoc
5029
*/
5130
protected function _construct()
5231
{
5332
$this->_init(\Magento\Authorization\Model\ResourceModel\Rules::class);
5433
}
5534

5635
/**
36+
* Obsolete method of update
37+
*
5738
* @return $this
39+
* @deprecated Method was never implemented and used.
5840
*/
5941
public function update()
6042
{
61-
$this->getResource()->update($this);
43+
// phpcs:disable Magento2.Functions.DiscouragedFunction
44+
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);
45+
6246
return $this;
6347
}
6448

6549
/**
50+
* Save authorization rule relation
51+
*
6652
* @return $this
6753
*/
6854
public function saveRel()

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212

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

15-
use Magento\Catalog\Pricing\Price\BasePrice;
1615
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
1716
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
1817
use Magento\Framework\App\ObjectManager;
18+
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
19+
use Magento\Framework\Pricing\PriceCurrencyInterface;
1920

2021
/**
2122
* Product options section abstract block.
@@ -55,24 +56,42 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
5556
*/
5657
private $calculateCustomOptionCatalogRule;
5758

59+
/**
60+
* @var CalculatorInterface
61+
*/
62+
private $calculator;
63+
64+
/**
65+
* @var PriceCurrencyInterface
66+
*/
67+
private $priceCurrency;
68+
5869
/**
5970
* @param \Magento\Framework\View\Element\Template\Context $context
6071
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
6172
* @param \Magento\Catalog\Helper\Data $catalogData
6273
* @param array $data
6374
* @param CalculateCustomOptionCatalogRule|null $calculateCustomOptionCatalogRule
75+
* @param CalculatorInterface|null $calculator
76+
* @param PriceCurrencyInterface|null $priceCurrency
6477
*/
6578
public function __construct(
6679
\Magento\Framework\View\Element\Template\Context $context,
6780
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
6881
\Magento\Catalog\Helper\Data $catalogData,
6982
array $data = [],
70-
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
83+
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null,
84+
CalculatorInterface $calculator = null,
85+
PriceCurrencyInterface $priceCurrency = null
7186
) {
7287
$this->pricingHelper = $pricingHelper;
7388
$this->_catalogHelper = $catalogData;
7489
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
7590
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
91+
$this->calculator = $calculator
92+
?? ObjectManager::getInstance()->get(CalculatorInterface::class);
93+
$this->priceCurrency = $priceCurrency
94+
?? ObjectManager::getInstance()->get(PriceCurrencyInterface::class);
7695
parent::__construct($context, $data);
7796
}
7897

@@ -188,7 +207,13 @@ protected function _formatPrice($value, $flag = true)
188207
}
189208

190209
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
191-
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
210+
$optionAmount = $isPercent
211+
? $this->calculator->getAmount(
212+
$this->priceCurrency->roundPrice($value['pricing_value']),
213+
$this->getProduct(),
214+
null,
215+
$context
216+
) : $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
192217
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
193218
$optionAmount,
194219
$customOptionPrice,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontCustomOptionCheckboxByPriceActionGroup">
12+
<annotations>
13+
<description>Validates that the provided price for Custom Option Checkbox is present on the Storefront Product page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="optionTitle" type="string" defaultValue="{{ProductOptionCheckbox.title}}"/>
17+
<argument name="price" type="string" defaultValue="10"/>
18+
</arguments>
19+
20+
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptionsCheckbox(optionTitle, price)}}" stepKey="checkPriceProductOptionCheckbox"/>
21+
</actionGroup>
22+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductPageGalleryChangingFullscreenImageByRibbonActionGroup">
11+
<annotations>
12+
<description>On the product page change main image by clicking on the images in the ribbon. Fullscreen</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="startImage" type="string" />
16+
<argument name="expectedImage" type="string" />
17+
</arguments>
18+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartFullscreenImage"/>
19+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageInThumbnail"/>
20+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="clickOnExpectedImage"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(expectedImage)}}" stepKey="seeExpectedImageAfterClick"/>
22+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageActiveInThumbnailAfterChange"/>
23+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="clickOnStartImageInRibbon"/>
24+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(startImage)}}" stepKey="seeStartImageAfterSecondChange"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageActiveInThumbnailAfterSecondChange"/>
26+
</actionGroup>
27+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductPageGalleryChangingMainImageByRibbonActionGroup">
11+
<annotations>
12+
<description>Changing main image on product page media gallery by clicking on the images in the fotorama ribbon</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="startImage" type="string" />
16+
<argument name="expectedImage" type="string" />
17+
</arguments>
18+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="waitActiveImageDefault"/>
19+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageThumbnail"/>
20+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(expectedImage)}}" stepKey="firstClickOnImageInRibbon"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageSelectedInRibbon"/>
22+
<seeElement selector="{{StorefrontProductMediaSection.productImage(expectedImage)}}" stepKey="seeChangedImageAfterFirstClick"/>
23+
<click selector="{{StorefrontProductMediaSection.productImageInFotorama(startImage)}}" stepKey="secondClickOnImageInRibbon"/>
24+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeStartImageSelectedInRibbonAfterSecondClick"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeChangedImageAfterSecondClick"/>
26+
</actionGroup>
27+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontProductPageGalleryFullscreenThumbnailDragActionGroup">
12+
<annotations>
13+
<description>On the product page check functional of drag actions in the fotorama ribbon during fullscreen</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="dragPointImage" type="string" />
17+
<argument name="currentImage" type="string"/>
18+
<argument name="firstImage" type="string" />
19+
</arguments>
20+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImage"/>
21+
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbon"/>
22+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="-300" y="0" stepKey="dragRibbon"/>
23+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeFullscreenImageAfterDrag"/>
24+
<dontSeeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="dontSeeFirstImageInRibbonAfterDrag"/>
25+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="300" y="0" stepKey="dragBackRibbon"/>
26+
<seeElement selector="{{StorefrontProductMediaSection.productImageFullscreen(currentImage)}}" stepKey="seeMainImageAfterBackDrag"/>
27+
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbonAfterBackDrag"/>
28+
</actionGroup>
29+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductPageGalleryImageDimensionsActionGroup">
11+
<annotations>
12+
<description>On the product page grab dimensions of the displayed product image, and image section. Assert that image is less or equals</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="imageSource" defaultValue="{{StorefrontProductMediaSection.mainImageForJsActions}}" type="string"/>
16+
</arguments>
17+
<executeJS function="var img=document.querySelector('{{imageSource}}');
18+
return img.clientHeight;" stepKey="getImageHeight"/>
19+
<executeJS function="var img=document.querySelector('{{imageSource}}');
20+
return img.clientWidth;" stepKey="getImageWidth"/>
21+
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
22+
return img.clientHeight;" stepKey="getSectionHeight"/>
23+
<executeJS function="var img=document.querySelector('{{StorefrontProductMediaSection.imageSectionForJsActions}}');
24+
return img.clientWidth;" stepKey="getSectionWidth"/>
25+
<assertLessThanOrEqual stepKey="checkHeightIsCorrect">
26+
<actualResult type="variable">getImageHeight</actualResult>
27+
<expectedResult type="variable">getSectionHeight</expectedResult>
28+
</assertLessThanOrEqual>
29+
<assertLessThanOrEqual stepKey="checkWidthIsCorrect">
30+
<actualResult type="variable">getImageWidth</actualResult>
31+
<expectedResult type="variable">getSectionWidth</expectedResult>
32+
</assertLessThanOrEqual>
33+
</actionGroup>
34+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductPageGalleryImagePositionInThumbnailRibbonActionGroup">
11+
<annotations>
12+
<description>Check the expected image position in the fotorama ribbon on the product page</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="image" defaultValue="Magento2.filename" type="string"/>
16+
<argument name="extension" defaultValue="Magento2.file_extension" type="string"/>
17+
<argument name="position" defaultValue="0" type="string" />
18+
</arguments>
19+
<grabAttributeFrom userInput="src" selector="{{StorefrontProductMediaSection.fotoramaImageThumbnailImgByNumber(position)}}" stepKey="grabSrcFromThumbnailImageByPosition"/>
20+
<assertRegExp stepKey="checkImagePositionInThumbnail">
21+
<actualResult type="variable">$grabSrcFromThumbnailImageByPosition</actualResult>
22+
<expectedResult type="string">|{{image}}[_\d]*.{{extension}}|</expectedResult>
23+
</assertRegExp>
24+
</actionGroup>
25+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductPageGalleryMainImageButtonsActionGroup">
11+
<annotations>
12+
<description>Assert the buttons functionality "change image" on the product media gallery on the product page</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="startImage" type="string" />
16+
<argument name="expectedImage" type="string" />
17+
</arguments>
18+
<moveMouseOver selector="{{StorefrontProductMediaSection.mainImageForJsActions}}" stepKey="hoverOverImage"/>
19+
<waitForElementVisible selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="waitForButtons"/>
20+
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeProductImageBeforeActions"/>
21+
<click selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="clickOnNextImageButton"/>
22+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(expectedImage)}}" stepKey="seeExpectedImageSelectedInRibbon"/>
23+
<seeElement selector="{{StorefrontProductMediaSection.productImage(expectedImage)}}" stepKey="seeExpectedImageOnPreview"/>
24+
<click selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="clickOnPrevImageButton"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.imgSelectedInThumbnail(startImage)}}" stepKey="seeActiveImageSelectedInRibbonAfterSecondChange"/>
26+
<seeElement selector="{{StorefrontProductMediaSection.productImage(startImage)}}" stepKey="seeMainProductImageAfterSecondChange"/>
27+
</actionGroup>
28+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontProductPageGalleryThumbnailDragActionGroup">
12+
<annotations>
13+
<description>Check functional of drag actions in the thumbnail ribbon on the product page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="dragPointImage" type="string" />
17+
<argument name="currentImage" type="string"/>
18+
<argument name="firstImage" type="string" />
19+
</arguments>
20+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageBeforeDragActions"/>
21+
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButtonBeforeDragActions"/>
22+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="-300" y="0" stepKey="dragRibbonForward"/>
23+
<seeElement selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageDontChangeAfterDrag"/>
24+
<waitForElementVisible selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="waitPrevButton"/>
25+
<seeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="seePrevButton"/>
26+
<dontSeeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="dontSeeFirstImageInRibbonAfterDrag"/>
27+
<dragAndDrop selector1="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" selector2="{{StorefrontProductMediaSection.productImageInFotorama(dragPointImage)}}" x="300" y="0" stepKey="dragBackRibbon"/>
28+
<seeElement selector="{{StorefrontProductMediaSection.productImage(currentImage)}}" stepKey="seeMainImageDontChangeAfterBackDrag"/>
29+
<seeElement selector="{{StorefrontProductMediaSection.productImageInFotorama(firstImage)}}" stepKey="seeFirstImageInRibbonAfterBackDrag"/>
30+
<dontSeeElement selector="{{StorefrontProductMediaSection.fotoramaPrevButton}}" stepKey="dontSeePrevButtonAfterBackDrag"/>
31+
</actionGroup>
32+
</actionGroups>

0 commit comments

Comments
 (0)