Skip to content

Commit 1b2c345

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-3169
2 parents 27d191b + 11e7d89 commit 1b2c345

File tree

139 files changed

+2698
-606
lines changed

Some content is hidden

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

139 files changed

+2698
-606
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
22+
<actionGroup name="AdminFillCatalogProductsListWidgetSkuActionGroup">
23+
<annotations>
24+
<description>Fill catalog products list widget sku.</description>
25+
</annotations>
26+
27+
<arguments>
28+
<argument name="sku" type="string" defaultValue=""/>
29+
</arguments>
30+
31+
<waitForElementVisible selector="{{WidgetSection.AddParam}}" stepKey="waitForAddParamElement"/>
32+
<click selector="{{WidgetSection.AddParam}}" stepKey="clickOnAddParamElement"/>
33+
<waitForElementVisible selector="{{WidgetSection.ConditionsDropdown}}"
34+
stepKey="waitForConditionsDropdownVisible"/>
35+
<selectOption selector="{{WidgetSection.ConditionsDropdown}}" userInput="SKU" stepKey="selectSkuAsCondition"/>
36+
<waitForElementVisible selector="{{WidgetSection.RuleParam}}" stepKey="waitForRuleParamElementVisible"/>
37+
<click selector="{{WidgetSection.RuleParam}}" stepKey="clickToAddRuleParam"/>
38+
<fillField selector=".rule-param-edit input" userInput="{{sku}}" stepKey="fillSkuField"/>
39+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="clickApplyButton"/>
40+
</actionGroup>
41+
</actionGroups>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
22+
<test name="StorefrontBundleAddToCartFromWidget">
23+
<annotations>
24+
<features value="Bundle"/>
25+
<stories value="Bundle product details page"/>
26+
<title value="Customer should be able to add a bundle product to the cart from widget"/>
27+
<description value="Customer should be able to add a bundle product to the cart from widget"/>
28+
<severity value="CRITICAL"/>
29+
<testCaseId value="AC-10867"/>
30+
<useCaseId value="ACP2E-2615"/>
31+
<group value="WYSIWYGDisabled"/>
32+
<group value="Bundle"/>
33+
</annotations>
34+
<before>
35+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
36+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
37+
</before>
38+
<after>
39+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProductBySku">
40+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
41+
</actionGroup>
42+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
46+
<!-- Start creating a bundle product -->
47+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
48+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
49+
<argument name="product" value="BundleProduct"/>
50+
</actionGroup>
51+
<actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku">
52+
<argument name="product" value="BundleProductWithSlashSku"/>
53+
</actionGroup>
54+
55+
<!-- Add Option One, a "Drop-down" type option -->
56+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOptionWithOneProduct">
57+
<argument name="x" value="0"/>
58+
<argument name="n" value="1"/>
59+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
60+
<argument name="prodTwoSku" value=""/>
61+
<argument name="optionTitle" value="Option One"/>
62+
<argument name="inputType" value="select"/>
63+
</actionGroup>
64+
65+
<!-- Save product, edit Homepage CMS page and add products widget -->
66+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
67+
<amOnPage url="{{AdminCmsPageEditPage.url(CmsHomePageContent.page_id)}}" stepKey="navigateToEditCmsHomePage"/>
68+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
69+
<actionGroup ref="AdminInsertWidgetToCmsPageContentActionGroup" stepKey="insertWidgetToCmsPageContentActionGroup">
70+
<argument name="widgetType" value="Catalog Products List"/>
71+
</actionGroup>
72+
<actionGroup ref="AdminFillCatalogProductsListWidgetSkuActionGroup" stepKey="selectProductForListing">
73+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
74+
</actionGroup>
75+
<actionGroup ref="AdminClickInsertWidgetActionGroup" stepKey="clickInsertWidgetButton2"/>
76+
<actionGroup ref="SaveCmsPageActionGroup" stepKey="clickSaveButton"/>
77+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the page." stepKey="seeSuccess"/>
78+
79+
<!-- Go to storefront homepage and add to cart -->
80+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomePage"/>
81+
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
82+
<actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/>
83+
<waitForPageLoad stepKey="waitForProductAdded"/>
84+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/>
85+
</test>
86+
</tests>

app/code/Magento/BundleGraphQl/Model/Cart/BundleOptionDataProvider.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Quote\Model\Quote\Item;
1515
use Magento\Framework\Pricing\Helper\Data;
1616
use Magento\Framework\Serialize\SerializerInterface;
17+
use Magento\Bundle\Model\Product\OriginalPrice;
1718

1819
/**
1920
* Data provider for bundled product options
@@ -25,39 +26,23 @@ class BundleOptionDataProvider
2526
*/
2627
private const OPTION_TYPE = 'bundle';
2728

28-
/**
29-
* @var Data
30-
*/
31-
private $pricingHelper;
32-
33-
/**
34-
* @var SerializerInterface
35-
*/
36-
private $serializer;
37-
38-
/**
39-
* @var Configuration
40-
*/
41-
private $configuration;
42-
4329
/** @var Uid */
4430
private $uidEncoder;
4531

4632
/**
4733
* @param Data $pricingHelper
4834
* @param SerializerInterface $serializer
4935
* @param Configuration $configuration
36+
* @param OriginalPrice $originalPrice
5037
* @param Uid|null $uidEncoder
5138
*/
5239
public function __construct(
53-
Data $pricingHelper,
54-
SerializerInterface $serializer,
55-
Configuration $configuration,
40+
private readonly Data $pricingHelper,
41+
private readonly SerializerInterface $serializer,
42+
private readonly Configuration $configuration,
43+
private readonly OriginalPrice $originalPrice,
5644
Uid $uidEncoder = null
5745
) {
58-
$this->pricingHelper = $pricingHelper;
59-
$this->serializer = $serializer;
60-
$this->configuration = $configuration;
6146
$this->uidEncoder = $uidEncoder ?: ObjectManager::getInstance()
6247
->get(Uid::class);
6348
}
@@ -139,28 +124,34 @@ private function buildBundleOptionValues(array $selections, Item $item): array
139124
$values = [];
140125

141126
$product = $item->getProduct();
127+
$currencyCode = $item->getQuote()->getQuoteCurrencyCode();
142128
foreach ($selections as $selection) {
143129
$qty = (float) $this->configuration->getSelectionQty($product, $selection->getSelectionId());
144130
if (!$qty) {
145131
continue;
146132
}
147-
148133
$selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
149134
$optionDetails = [
150135
self::OPTION_TYPE,
151136
$selection->getData('option_id'),
152137
$selection->getData('selection_id'),
153138
(int) $selection->getData('selection_qty')
154139
];
140+
$price = $this->pricingHelper->currency($selectionPrice, false, false);
155141
$values[] = [
156142
'id' => $selection->getSelectionId(),
157143
'uid' => $this->uidEncoder->encode(implode('/', $optionDetails)),
158144
'label' => $selection->getName(),
159145
'quantity' => $qty,
160-
'price' => $this->pricingHelper->currency($selectionPrice, false, false),
146+
'price' => $price,
147+
'priceV2' => ['currency' => $currencyCode, 'value' => $price],
148+
'original_price' => [
149+
'currency' => $currencyCode,
150+
'value' => $this->originalPrice
151+
->getSelectionOriginalPrice($item->getProduct(), $selection)
152+
],
161153
];
162154
}
163-
164155
return $values;
165156
}
166157
}

app/code/Magento/BundleGraphQl/etc/schema.graphqls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ type SelectedBundleOptionValue @doc(description: "Contains details about a value
4444
uid: ID! @doc(description: "The unique ID for a `SelectedBundleOptionValue` object")
4545
label: String! @doc(description: "The display name of the value for the selected bundle product option.")
4646
quantity: Float! @doc(description: "The quantity of the value for the selected bundle product option.")
47-
price: Float! @doc(description: "The price of the value for the selected bundle product option.")
47+
price: Float! @deprecated(reason: "Use priceV2 instead.") @doc(description: "The price of the value for the selected bundle product option.")
48+
priceV2: Money! @doc(description: "The price of the value for the selected bundle product option.")
49+
original_price: Money! @doc(description: "The original price of the value for the selected bundle product option.")
4850
}
4951

5052
type PriceDetails @doc(description: "Can be used to retrieve the main price details in case of bundle product") {

app/code/Magento/Catalog/Model/Product.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,8 +1877,10 @@ public function toArray(array $arrAttributes = [])
18771877
{
18781878
$data = parent::toArray($arrAttributes);
18791879
$stock = $this->getStockItem();
1880-
if ($stock) {
1880+
if (is_object($stock) && method_exists($stock, 'toArray')) {
18811881
$data['stock_item'] = $stock->toArray();
1882+
} elseif (is_array($stock)) {
1883+
$data['stock_item'] = $stock;
18821884
}
18831885
unset($data['stock_item']['product']);
18841886
return $data;
Lines changed: 22 additions & 0 deletions
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="AdminChangeProductNameAsPerStoreViewScopeActionGroup">
12+
<annotations>
13+
<description>Admin change product name having store view scope</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string"/>
17+
</arguments>
18+
<waitForElementClickable selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="waitForDefaultNameCheckBox"/>
19+
<uncheckOption selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="unCheckDefaultNameCheckbox"/>
20+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="changeProductName"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/CatalogAttributeSetData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313
<data key="attributeGroupId">7</data>
1414
<data key="skeletonId">4</data>
1515
</entity>
16+
<entity name="CatalogAdditionalAttributeSet" type="CatalogAttributeSet">
17+
<data key="attribute_set_name" unique="suffix">additional_set_</data>
18+
<data key="attributeGroupId">7</data>
19+
<data key="skeletonId">4</data>
20+
</entity>
1621
</entities>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection/AdminProductFormRelatedUpSellCrossSellSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
<element name="removeCrossSellProduct" type="button" selector="//span[text()='Cross-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2424
<element name="removeUpsellProduct" type="button" selector="//span[text()='Up-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2525
<element name="relatedUpSellCrossSellProductStagingSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='{{catalogStagingSection}}']" parameterized="true"/>
26+
<element name="relatedProductStatus" type="text" selector="//div[@class='admin__field-control']//div[@class='control-table-text']//span[@data-index='status']"/>
2627
</section>
2728
</sections>

0 commit comments

Comments
 (0)