Skip to content

Commit 41409a8

Browse files
Merge remote-tracking branch 'remotes/github/2.3-develop' into EPAM-PR-65
2 parents dc01d8a + 50209dd commit 41409a8

File tree

97 files changed

+1837
-473
lines changed

Some content is hidden

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

97 files changed

+1837
-473
lines changed

app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ private function fetch() : array
117117
'price' => $link->getSelectionPriceValue(),
118118
'position' => $link->getPosition(),
119119
'id' => $link->getSelectionId(),
120-
'qty' => (int)$link->getSelectionQty(),
120+
'qty' => (float)$link->getSelectionQty(),
121+
'quantity' => (float)$link->getSelectionQty(),
121122
'is_default' => (bool)$link->getIsDefault(),
122123
'price_type' => $this->enumLookup->getEnumValueFromField(
123124
'PriceTypeEnum',

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ type BundleItem @doc(description: "BundleItem defines an individual item in a bu
1414
type BundleItemOption @doc(description: "BundleItemOption defines characteristics and options for a specific bundle item.") {
1515
id: Int @doc(description: "The ID assigned to the bundled item option.")
1616
label: String @doc(description: "The text that identifies the bundled item option.") @resolver(class: "Magento\\BundleGraphQl\\Model\\Resolver\\Options\\Label")
17-
qty: Float @doc(description: "Indicates the quantity of this specific bundle item.")
17+
qty: Float @deprecated(reason: "The `qty` is deprecated. Use `quantity` instead.") @doc(description: "Indicates the quantity of this specific bundle item.")
18+
quantity: Float @doc(description: "Indicates the quantity of this specific bundle item.")
1819
position: Int @doc(description: "When a bundle item contains multiple options, the relative position of this option compared to the other options.")
1920
is_default: Boolean @doc(description: "Indicates whether this option is the default option.")
2021
price: Float @doc(description: "The price of the selected option.")

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,14 @@
392392
<waitForPageLoad stepKey="waitForSave"/>
393393
</actionGroup>
394394

395+
<!-- Action group assign to one website and unassign from another -->
396+
<actionGroup name="AdminProcessProductWebsitesActionGroup" extends="CreatedProductConnectToWebsite">
397+
<arguments>
398+
<argument name="websiteToUnassign"/>
399+
</arguments>
400+
<uncheckOption selector="{{ProductInWebsitesSection.website(websiteToUnassign.name)}}" after="SelectWebsite" stepKey="uncheckWebsite"/>
401+
</actionGroup>
402+
395403
<!--Check tier price with a discount percentage on product-->
396404
<actionGroup name="AssertDiscountsPercentageOfProducts">
397405
<arguments>
@@ -542,4 +550,11 @@
542550
<remove keyForRemoval="seeCheckboxForWebsite"/>
543551
<seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/>
544552
</actionGroup>
553+
554+
<!-- You are on product Edit Page -->
555+
<!-- Assert checkbox is not checked for website in Product In Websites -->
556+
<actionGroup name="AssertProductIsNotAssignedToWebsite" extends="AssertWebsiteIsAvailableInProductWebsites">
557+
<remove keyForRemoval="seeCheckboxForWebsite"/>
558+
<dontSeeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsNotChecked"/>
559+
</actionGroup>
545560
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<!-- Assert 404 Page Not Found on product detail page -->
11+
<actionGroup name="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup">
12+
<arguments>
13+
<argument name="product"/>
14+
</arguments>
15+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="assert404Page"/>
16+
<dontSee selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="dontSeeProductName"/>
17+
<seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkProductUrl"/>
18+
</actionGroup>
19+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<!-- Action group opens product detail page from second website using Store code in URL option -->
10+
<actionGroup name="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup">
11+
<arguments>
12+
<argument name="product"/>
13+
<argument name="storeView"/>
14+
</arguments>
15+
<amOnPage url="/{{storeView.code}}/{{product.custom_attributes[url_key]}}.html" stepKey="openProductPageUsingStoreCodeInUrl"/>
16+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="assertProductName"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Edit products"/>
15+
<title value="Admin should be able to associate simple product to websites"/>
16+
<description value="Admin should be able to associate simple product to websites"/>
17+
<testCaseId value="MC-3483"/>
18+
<group value="catalog"/>
19+
<severity value="AVERAGE"/>
20+
</annotations>
21+
22+
<before>
23+
<magentoCLI command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToYes"/>
24+
<createData entity="secondCustomWebsite" stepKey="createCustomWebsite"/>
25+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<actionGroup ref="AdminStoreGroupCreateActionGroup" stepKey="createNewStore">
28+
<argument name="Website" value="secondCustomWebsite"/>
29+
<argument name="storeGroup" value="customStoreGroup"/>
30+
</actionGroup>
31+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
32+
<argument name="StoreGroup" value="customStoreGroup"/>
33+
<argument name="customStore" value="customStoreEN"/>
34+
</actionGroup>
35+
</before>
36+
37+
<after>
38+
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToNo"/>
39+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
40+
<!-- Delete second website -->
41+
<actionGroup ref="DeleteCustomWebsiteActionGroup" stepKey="deleteCustomWeWebsite">
42+
<argument name="websiteName" value="$createCustomWebsite.website[name]$"/>
43+
</actionGroup>
44+
<actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetFiltersOnStoresIndexPage"/>
45+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToResetFilters"/>
46+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersOnProductIndexPage"/>
47+
<actionGroup ref="logout" stepKey="logout"/>
48+
</after>
49+
50+
<!-- 1. Go to product page in admin panel to edit -->
51+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToAssociateToSecondWebsite"/>
52+
<actionGroup ref="filterProductGridByName2" stepKey="filterProductInGrid">
53+
<argument name="name" value="$$createSimpleProduct.name$$"/>
54+
</actionGroup>
55+
56+
<!-- 2. Go to Product in Websites tab, unassign product from Main website and assign it to Second website -->
57+
<actionGroup ref="AdminProcessProductWebsitesActionGroup" stepKey="processProductWebsites">
58+
<argument name="website" value="secondCustomWebsite"/>
59+
<argument name="websiteToUnassign" value="_defaultWebsite"/>
60+
<argument name="product" value="$$createSimpleProduct$$"/>
61+
</actionGroup>
62+
<actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked">
63+
<argument name="website" value="$createCustomWebsite.website[name]$"/>
64+
</actionGroup>
65+
<actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked">
66+
<argument name="website" value="{{_defaultWebsite.name}}"/>
67+
</actionGroup>
68+
69+
<!-- 3. Go to frontend and open Simple product on Main website and assert 404 page-->
70+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
71+
<argument name="productUrl" value="$createSimpleProduct.custom_attributes[url_key]$"/>
72+
</actionGroup>
73+
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="assertPageNotFoundErrorOnProductDetailPage">
74+
<argument name="product" value="$$createSimpleProduct$$"/>
75+
</actionGroup>
76+
77+
<!-- 4. Open Simple product on Second website and assert its name -->
78+
<actionGroup ref="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup" stepKey="openProductPageUsingStoreCodeInUrl">
79+
<argument name="product" value="$$createSimpleProduct$$"/>
80+
<argument name="storeView" value="customStoreEN"/>
81+
</actionGroup>
82+
</test>
83+
</tests>

app/code/Magento/Checkout/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductInfoMainSection">
1212
<element name="AddToCart" type="button" selector="#product-addtocart-button"/>
13+
<element name="updateCart" type="button" selector="#product-updatecart-button" timeout="30"/>
1314
</section>
1415
</sections>

app/code/Magento/Checkout/view/frontend/web/js/model/cart/totals-processor/default.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,7 @@ define([
8787
data.shippingCarrierCode = quote.shippingMethod()['carrier_code'];
8888
}
8989

90-
if (!cartCache.isChanged('cartVersion', customerData.get('cart')()['data_id']) &&
91-
!cartCache.isChanged('shippingMethodCode', data.shippingMethodCode) &&
92-
!cartCache.isChanged('shippingCarrierCode', data.shippingCarrierCode) &&
93-
!cartCache.isChanged('address', address) &&
94-
cartCache.get('totals') &&
95-
!cartCache.isChanged('subtotal', parseFloat(quote.totals().subtotal))
96-
) {
97-
quote.setTotals(cartCache.get('totals'));
98-
} else {
99-
return loadFromServer(address);
100-
}
90+
return loadFromServer(address);
10191
}
10292
};
10393
});

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ define([
102102
self.isLoading(true);
103103
});
104104

105-
if (cartData().website_id !== window.checkout.websiteId ||
106-
cartData().store_id !== window.checkout.storeId
105+
if (
106+
cartData().website_id !== window.checkout.websiteId &&
107+
cartData().website_id !== undefined
107108
) {
108109
customerData.reload(['cart'], false);
109110
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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\ConfigurableProductGraphQl\Model\Cart\BuyRequest;
9+
10+
use Magento\Framework\Stdlib\ArrayManager;
11+
use Magento\QuoteGraphQl\Model\Cart\BuyRequest\BuyRequestDataProviderInterface;
12+
13+
/**
14+
* DataProvider for building super attribute options in buy requests
15+
*/
16+
class SuperAttributeDataProvider implements BuyRequestDataProviderInterface
17+
{
18+
/**
19+
* @var ArrayManager
20+
*/
21+
private $arrayManager;
22+
23+
/**
24+
* @param ArrayManager $arrayManager
25+
*/
26+
public function __construct(
27+
ArrayManager $arrayManager
28+
) {
29+
$this->arrayManager = $arrayManager;
30+
}
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
public function execute(array $cartItemData): array
36+
{
37+
$superAttributes = $this->arrayManager->get('configurable_attributes', $cartItemData, []);
38+
39+
$superAttributesData = [];
40+
foreach ($superAttributes as $superAttribute) {
41+
$superAttributesData[$superAttribute['id']] = $superAttribute['value'];
42+
}
43+
44+
return ['super_attribute' => $superAttributesData];
45+
}
46+
}

0 commit comments

Comments
 (0)