Skip to content

Commit 69b7475

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MQE-2631
2 parents 134d133 + ad08ccf commit 69b7475

File tree

102 files changed

+2797
-348
lines changed

Some content is hidden

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

102 files changed

+2797
-348
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="AdminAdvancedReportingButtonTest">
1111
<annotations>
12-
<stories value="AdvancedReporting"/>
13-
<title value="AdvancedReportingButtonTest"/>
14-
<description value="Test log in to AdvancedReporting and tests AdvancedReportingButtonTest"/>
15-
<testCaseId value="MC-14800"/>
16-
<skip>
17-
<issueId value="MC-14800" />
18-
</skip>
12+
<features value="Analytics"/>
13+
<stories value="Advanced Reporting"/>
14+
<title value="Assert the Advanced Reporting page is opened by dashboard link"/>
15+
<description value="Check the ability to navigate to the Advanced Reporting page through the Advanced Reporting button on the dashboard"/>
1916
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-28376"/>
2018
<group value="analytics"/>
2119
<group value="mtf_migrated"/>
2220
</annotations>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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\Bundle\Model\Product;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\Model\Product\Type as BundleType;
12+
13+
/**
14+
* Service to check is bundle product has single choice (no customization possible)
15+
*/
16+
class SingleChoiceProvider
17+
{
18+
/**
19+
* Single choice availability
20+
*
21+
* @param Product $product
22+
* @return bool
23+
*/
24+
public function isSingleChoiceAvailable(Product $product) : bool
25+
{
26+
$result = false;
27+
if ($product->getTypeId() === BundleType::TYPE_BUNDLE) {
28+
$typeInstance = $product->getTypeInstance();
29+
$typeInstance->setStoreFilter($product->getStoreId(), $product);
30+
31+
if ($typeInstance->hasRequiredOptions($product)) {
32+
$options = $typeInstance->getOptions($product);
33+
$isNoCustomizations = true;
34+
foreach ($options as $option) {
35+
$optionId = $option->getId();
36+
$required = $option->getRequired();
37+
if ($isNoCustomizations && (int) $required === 1) {
38+
$selectionsCollection = $typeInstance->getSelectionsCollection(
39+
[$optionId],
40+
$product
41+
);
42+
$selections = $selectionsCollection->exportToArray();
43+
if (count($selections) > 1) {
44+
foreach ($selections as $selection) {
45+
if ($isNoCustomizations) {
46+
$isNoCustomizations = (int)$selection['is_default'] === 1
47+
&& (int)$selection['selection_can_change_qty'] === 0;
48+
} else {
49+
break;
50+
}
51+
}
52+
}
53+
} else {
54+
$isNoCustomizations = false;
55+
break;
56+
}
57+
}
58+
59+
$result = $isNoCustomizations;
60+
}
61+
}
62+
return $result;
63+
}
64+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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\Bundle\Plugin\Catalog\Model\Product\Type;
9+
10+
use Magento\Catalog\Model\Product\Type\AbstractType as Subject;
11+
use Magento\Catalog\Model\Product;
12+
use Magento\Catalog\Model\Product\Type;
13+
use Magento\Bundle\Model\Product\SingleChoiceProvider;
14+
15+
/**
16+
* Plugin to add possibility to add bundle product with single option from list
17+
*/
18+
class AbstractType
19+
{
20+
/**
21+
* @var SingleChoiceProvider
22+
*/
23+
private $singleChoiceProvider;
24+
25+
/**
26+
* @param SingleChoiceProvider $singleChoiceProvider
27+
*/
28+
public function __construct(
29+
SingleChoiceProvider $singleChoiceProvider
30+
) {
31+
$this->singleChoiceProvider = $singleChoiceProvider;
32+
}
33+
34+
/**
35+
* Add possibility to add to cart from the list in case of one required option
36+
*
37+
* @param Subject $subject
38+
* @param bool $result
39+
* @param Product $product
40+
* @return bool
41+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
42+
*/
43+
public function afterIsPossibleBuyFromList(Subject $subject, $result, $product)
44+
{
45+
if ($product->getTypeId() === Type::TYPE_BUNDLE) {
46+
$isSingleChoice = $this->singleChoiceProvider->isSingleChoiceAvailable($product);
47+
if ($isSingleChoice === true) {
48+
$result = $isSingleChoice;
49+
}
50+
}
51+
return $result;
52+
}
53+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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\Bundle\Plugin\Catalog\ViewModel\Product;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\ViewModel\Product\OptionsData as Subject;
12+
use Magento\Catalog\Model\Product\Type;
13+
use Magento\Bundle\Model\Product\SingleChoiceProvider;
14+
15+
/**
16+
* Plugin to add bundle options data
17+
*/
18+
class AddBundleOptionsData
19+
{
20+
/**
21+
* @var SingleChoiceProvider
22+
*/
23+
private $singleChoiceProvider;
24+
25+
/**
26+
* @param SingleChoiceProvider $singleChoiceProvider
27+
*/
28+
public function __construct(
29+
SingleChoiceProvider $singleChoiceProvider
30+
) {
31+
$this->singleChoiceProvider = $singleChoiceProvider;
32+
}
33+
34+
public function afterGetOptionsData(Subject $subject, array $result, Product $product) : array
35+
{
36+
if ($product->getTypeId() === Type::TYPE_BUNDLE) {
37+
if ($this->singleChoiceProvider->isSingleChoiceAvailable($product) === true) {
38+
$typeInstance = $product->getTypeInstance();
39+
$typeInstance->setStoreFilter($product->getStoreId(), $product);
40+
$options = $typeInstance->getOptions($product);
41+
foreach ($options as $option) {
42+
$optionId = $option->getId();
43+
$selectionsCollection = $typeInstance->getSelectionsCollection(
44+
[$optionId],
45+
$product
46+
);
47+
$selections = $selectionsCollection->exportToArray();
48+
$countSelections = count($selections);
49+
foreach ($selections as $selection) {
50+
$name = 'bundle_option[' . $optionId . ']';
51+
if ($countSelections > 1) {
52+
$name .= '[]';
53+
}
54+
$result[] = [
55+
'name' => $name,
56+
'value' => $selection['selection_id']
57+
];
58+
}
59+
}
60+
}
61+
}
62+
return $result;
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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="StorefrontAddCategoryBundleProductWithSingleChoiceToCartActionGroup">
12+
<annotations>
13+
<description>Adds a Bundled Product with the single choice to the Cart from the Category page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="product"/>
17+
<argument name="quantity" defaultValue="1" type="string"/>
18+
</arguments>
19+
20+
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct"/>
21+
<click selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="clickAddToCart"/>
22+
<waitForPageLoad stepKey="waitForPageLoad1"/>
23+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
24+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
25+
26+
<!--Open minicart and change Qty-->
27+
<scrollToTopOfPage stepKey="scrollToTheTopOfThePage"/>
28+
<waitForElementVisible selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForElementToBeVisible"/>
29+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/>
30+
<waitForPageLoad stepKey="waitForPageToLoad2"/>
31+
<waitForElementVisible selector="{{StorefrontMinicartSection.quantity}}" stepKey="waitForElementQty"/>
32+
<pressKey selector="{{StorefrontMinicartSection.itemQuantity(product.name)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE]" stepKey="deleteFiled"/>
33+
<fillField selector="{{StorefrontMinicartSection.itemQuantity(product.name)}}" userInput="{{quantity}}" stepKey="changeQty"/>
34+
<conditionalClick selector="{{StorefrontMinicartSection.itemQuantityUpdate(product.name)}}" dependentSelector="{{StorefrontMinicartSection.itemQuantityUpdate(product.name)}}" visible="true" stepKey="updateQty"/>
35+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
36+
<waitForText userInput="{{quantity}}" selector="{{StorefrontMinicartSection.productCount}}" time="30" stepKey="assertProductCount"/>
37+
38+
<!-- Close minicart -->
39+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCartToClose"/>
40+
<waitForPageLoad stepKey="waitForPageToLoad3"/>
41+
</actionGroup>
42+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdvanceCatalogSearchBundleBySkuWithHyphenTest.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
<title value="Guest customer should be able to advance search Bundle product with product sku that contains hyphen"/>
1616
<description value="Guest customer should be able to advance search Bundle product with product sku that contains hyphen"/>
1717
<severity value="MAJOR"/>
18-
<testCaseId value="MC-20359"/>
18+
<testCaseId value="MC-28812"/>
1919
<group value="Bundle"/>
2020
<group value="SearchEngineElasticsearch"/>
21-
<skip>
22-
<issueId value="MC-34217"/>
23-
</skip>
2421
</annotations>
2522
<before>
26-
<createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/>
27-
<createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/>
23+
<createData entity="ApiProductWithDescription" before="simple2" stepKey="simple1"/>
24+
<createData entity="ApiProductWithDescription" before="product" stepKey="simple2"/>
2825
<createData entity="ApiBundleProduct" stepKey="product"/>
2926
<createData entity="DropDownBundleOption" stepKey="bundleOption">
3027
<requiredEntity createDataKey="product"/>
@@ -42,8 +39,8 @@
4239
<magentoCron stepKey="runCronReindex" groups="index"/>
4340
</before>
4441
<after>
45-
<deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/>
46-
<deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/>
42+
<deleteData createDataKey="simple1" before="deleteSimple2" stepKey="deleteSimple1"/>
43+
<deleteData createDataKey="simple2" before="delete" stepKey="deleteSimple2"/>
4744
</after>
4845
</test>
49-
</tests>
46+
</tests>

app/code/Magento/Bundle/etc/frontend/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@
1616
<type name="Magento\Catalog\Model\Product">
1717
<plugin name="add_bundle_child_identities" type="Magento\Bundle\Model\Plugin\Frontend\ProductIdentitiesExtender" sortOrder="100"/>
1818
</type>
19+
<type name="Magento\Catalog\Model\Product\Type\AbstractType">
20+
<plugin name="add_to_cart_single_option" type="Magento\Bundle\Plugin\Catalog\Model\Product\Type\AbstractType" />
21+
</type>
22+
<type name="Magento\Catalog\ViewModel\Product\OptionsData">
23+
<plugin name="add_bundle_options_data" type="Magento\Bundle\Plugin\Catalog\ViewModel\Product\AddBundleOptionsData" />
24+
</type>
1925
</config>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Captcha\Plugin;
7+
8+
use Magento\Captcha\Helper\Data as HelperCaptcha;
9+
use Magento\Captcha\Model\ResourceModel\LogFactory;
10+
use Magento\Sales\Api\Data\OrderInterface;
11+
use Magento\Sales\Api\OrderManagementInterface;
12+
13+
/**
14+
* Reset attempts for frontend checkout
15+
*/
16+
class ResetPaymentAttemptsAfterOrderIsPlacedPlugin
17+
{
18+
/**
19+
* Form ID
20+
*/
21+
private const FORM_ID = 'payment_processing_request';
22+
23+
/**
24+
* @var HelperCaptcha
25+
*/
26+
private $helper;
27+
28+
/**
29+
* @var LogFactory
30+
*/
31+
private $resLogFactory;
32+
33+
/**
34+
* ResetPaymentAttemptsAfterOrderIsPlacedPlugin constructor
35+
*
36+
* @param HelperCaptcha $helper
37+
* @param LogFactory $resLogFactory
38+
*/
39+
public function __construct(
40+
HelperCaptcha $helper,
41+
LogFactory $resLogFactory
42+
) {
43+
$this->helper = $helper;
44+
$this->resLogFactory = $resLogFactory;
45+
}
46+
47+
/**
48+
* Reset attempts for frontend checkout
49+
*
50+
* @param OrderManagementInterface $subject
51+
* @param OrderInterface $result
52+
* @param OrderInterface $order
53+
* @return OrderInterface
54+
*/
55+
public function afterPlace(
56+
OrderManagementInterface $subject,
57+
OrderInterface $result,
58+
OrderInterface $order
59+
): OrderInterface {
60+
$captchaModel = $this->helper->getCaptcha(self::FORM_ID);
61+
$captchaModel->setShowCaptchaInSession(false);
62+
$this->resLogFactory->create()->deleteUserAttempts($order->getCustomerEmail());
63+
return $result;
64+
}
65+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="StorefrontCheckoutPaymentsWithCaptchaActionGroup">
12+
<arguments>
13+
<argument name="captcha" type="string"/>
14+
</arguments>
15+
16+
<fillField selector="{{StorefrontCaptchaOnOnepageCheckoutPyamentSection.captchaField}}" userInput="{{captcha}}" stepKey="fillCaptchaField" />
17+
</actionGroup>
18+
</actionGroups>

0 commit comments

Comments
 (0)