Skip to content

Commit b5bce0b

Browse files
Merge branch '2.4-develop' into 2.4-develop-issue-27866
2 parents 2b2acee + b87f1df commit b5bce0b

File tree

156 files changed

+4943
-1249
lines changed

Some content is hidden

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

156 files changed

+4943
-1249
lines changed
Lines changed: 19 additions & 0 deletions
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminOpenConfigGeneralAnalyticsPageActionGroup">
12+
<annotations>
13+
<description>Open Config General Analytics Page.</description>
14+
</annotations>
15+
16+
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
17+
<waitForPageLoad stepKey="waitPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AssertAdminAdvancedReportingPageUrlActionGroup">
12+
<annotations>
13+
<description>Assert admin advanced reporting page url.</description>
14+
</annotations>
15+
16+
<switchToNextTab stepKey="switchToNewTab"/>
17+
<waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/>
18+
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
<amOnPage url="{{AdminDashboardPage.url}}" stepKey="amOnDashboardPage"/>
3333
<waitForPageLoad stepKey="waitForDashboardPageLoad"/>
3434
<click selector="{{AdminAdvancedReportingSection.goToAdvancedReporting}}" stepKey="clickGoToAdvancedReporting"/>
35-
<switchToNextTab stepKey="switchToNewTab"/>
36-
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
35+
<actionGroup ref="AssertAdminAdvancedReportingPageUrlActionGroup" stepKey="assertAdvancedReportingPageUrl"/>
3736
</test>
3837
</tests>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
<argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/>
3030
<argument name="submenuUiId" value="{{AdminMenuReportsBusinessIntelligenceAdvancedReporting.dataUiId}}"/>
3131
</actionGroup>
32-
<switchToNextTab stepKey="switchToNewTab"/>
33-
<waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/>
34-
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
32+
<actionGroup ref="AssertAdminAdvancedReportingPageUrlActionGroup" stepKey="assertAdvancedReportingPageUrl"/>
3533
</test>
3634
</tests>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
<testCaseId value="MAGETWO-63981"/>
1818
<group value="analytics"/>
1919
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
2023
<after>
2124
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
2225
</after>
23-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24-
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
26+
<actionGroup ref="AdminOpenConfigGeneralAnalyticsPageActionGroup" stepKey="amOnAdminConfig"/>
2527
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
2628
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustryLabel}}" userInput="Industry" stepKey="seeAdvancedReportingIndustryLabel"/>
2729
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustry}}" userInput="--Please Select--" stepKey="selectAdvancedReportingIndustry"/>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
<testCaseId value="MAGETWO-66465"/>
1818
<group value="analytics"/>
1919
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
2023
<after>
2124
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
2225
</after>
23-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24-
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
26+
<actionGroup ref="AdminOpenConfigGeneralAnalyticsPageActionGroup" stepKey="amOnAdminConfig"/>
2527
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service" stepKey="seeAdvancedReportingServiceLabelEnabled"/>
2628
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
2729
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustryLabel}}" userInput="Industry" stepKey="seeAdvancedReportingIndustryLabel"/>

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
<testCaseId value="MAGETWO-63898"/>
1919
<group value="analytics"/>
2020
</annotations>
21-
22-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23-
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
26+
</after>
27+
<actionGroup ref="AdminOpenConfigGeneralAnalyticsPageActionGroup" stepKey="amOnAdminConfig"/>
2428
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
2529
<see selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustryLabel}}" userInput="Industry" stepKey="seeAdvancedReportingIndustryLabel"/>
2630
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustry}}" userInput="Apps and Games" stepKey="selectAdvancedReportingIndustry"/>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
<testCaseId value="MAGETWO-66464"/>
1919
<group value="analytics"/>
2020
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
2124
<after>
2225
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
2326
</after>
24-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25-
<amOnPage url="{{AdminConfigGeneralAnalyticsPage.url}}" stepKey="amOnAdminConfig"/>
27+
<actionGroup ref="AdminOpenConfigGeneralAnalyticsPageActionGroup" stepKey="amOnAdminConfig"/>
2628
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingService}}" userInput="Enable" stepKey="selectAdvancedReportingServiceEnabled"/>
2729
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingIndustry}}" userInput="Apps and Games" stepKey="selectAdvancedReportingIndustry"/>
2830
<selectOption selector="{{AdminConfigAdvancedReportingSection.advancedReportingHour}}" userInput="23" stepKey="selectAdvancedReportingHour"/>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
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\Bundle\Helper\Catalog\Product\Configuration;
11+
use Magento\Bundle\Model\Option;
12+
use Magento\Catalog\Model\Product;
13+
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
14+
use Magento\Framework\Pricing\Helper\Data;
15+
use Magento\Framework\Serialize\SerializerInterface;
16+
17+
/**
18+
* Data provider for bundled product options
19+
*/
20+
class BundleOptionDataProvider
21+
{
22+
/**
23+
* @var Data
24+
*/
25+
private $pricingHelper;
26+
27+
/**
28+
* @var SerializerInterface
29+
*/
30+
private $serializer;
31+
32+
/**
33+
* @var Configuration
34+
*/
35+
private $configuration;
36+
37+
/**
38+
* @param Data $pricingHelper
39+
* @param SerializerInterface $serializer
40+
* @param Configuration $configuration
41+
*/
42+
public function __construct(
43+
Data $pricingHelper,
44+
SerializerInterface $serializer,
45+
Configuration $configuration
46+
) {
47+
$this->pricingHelper = $pricingHelper;
48+
$this->serializer = $serializer;
49+
$this->configuration = $configuration;
50+
}
51+
52+
/**
53+
* Extract data for a bundled item
54+
*
55+
* @param ItemInterface $item
56+
*
57+
* @return array
58+
*/
59+
public function getData(ItemInterface $item): array
60+
{
61+
$options = [];
62+
$product = $item->getProduct();
63+
$optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
64+
$bundleOptionsIds = $optionsQuoteItemOption
65+
? $this->serializer->unserialize($optionsQuoteItemOption->getValue())
66+
: [];
67+
68+
/** @var Type $typeInstance */
69+
$typeInstance = $product->getTypeInstance();
70+
71+
if ($bundleOptionsIds) {
72+
$selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');
73+
$optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product);
74+
$bundleSelectionIds = $this->serializer->unserialize($selectionsQuoteItemOption->getValue());
75+
76+
if (!empty($bundleSelectionIds)) {
77+
$selectionsCollection = $typeInstance->getSelectionsByIds($bundleSelectionIds, $product);
78+
$bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
79+
80+
$options = $this->buildBundleOptions($bundleOptions, $item);
81+
}
82+
}
83+
84+
return $options;
85+
}
86+
87+
/**
88+
* Build bundle product options based on current selection
89+
*
90+
* @param Option[] $bundleOptions
91+
* @param ItemInterface $item
92+
*
93+
* @return array
94+
*/
95+
private function buildBundleOptions(array $bundleOptions, ItemInterface $item): array
96+
{
97+
$options = [];
98+
foreach ($bundleOptions as $bundleOption) {
99+
if (!$bundleOption->getSelections()) {
100+
continue;
101+
}
102+
103+
$options[] = [
104+
'id' => $bundleOption->getId(),
105+
'label' => $bundleOption->getTitle(),
106+
'type' => $bundleOption->getType(),
107+
'values' => $this->buildBundleOptionValues($bundleOption->getSelections(), $item),
108+
];
109+
}
110+
111+
return $options;
112+
}
113+
114+
/**
115+
* Build bundle product option values based on current selection
116+
*
117+
* @param Product[] $selections
118+
* @param ItemInterface $item
119+
*
120+
* @return array
121+
*/
122+
private function buildBundleOptionValues(array $selections, ItemInterface $item): array
123+
{
124+
$product = $item->getProduct();
125+
$values = [];
126+
127+
foreach ($selections as $selection) {
128+
$qty = (float) $this->configuration->getSelectionQty($product, $selection->getSelectionId());
129+
if (!$qty) {
130+
continue;
131+
}
132+
133+
$selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
134+
$values[] = [
135+
'label' => $selection->getName(),
136+
'id' => $selection->getSelectionId(),
137+
'quantity' => $qty,
138+
'price' => $this->pricingHelper->currency($selectionPrice, false, false),
139+
];
140+
}
141+
142+
return $values;
143+
}
144+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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\BundleGraphQl\Model\Wishlist;
9+
10+
use Magento\Bundle\Model\Product\BundleOptionDataProvider;
11+
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\GraphQl\Config\Element\Field;
14+
use Magento\Framework\GraphQl\Query\ResolverInterface;
15+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
16+
17+
/**
18+
* Fetches the selected bundle options
19+
*/
20+
class BundleOptions implements ResolverInterface
21+
{
22+
/**
23+
* @var BundleOptionDataProvider
24+
*/
25+
private $bundleOptionDataProvider;
26+
27+
/**
28+
* @param BundleOptionDataProvider $bundleOptionDataProvider
29+
*/
30+
public function __construct(
31+
BundleOptionDataProvider $bundleOptionDataProvider
32+
) {
33+
$this->bundleOptionDataProvider = $bundleOptionDataProvider;
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function resolve(
40+
Field $field,
41+
$context,
42+
ResolveInfo $info,
43+
array $value = null,
44+
array $args = null
45+
) {
46+
if (!$value['itemModel'] instanceof ItemInterface) {
47+
throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
48+
'instance' => ItemInterface::class
49+
]));
50+
}
51+
52+
return $this->bundleOptionDataProvider->getData($value['itemModel']);
53+
}
54+
}

app/code/Magento/BundleGraphQl/etc/graphql/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,11 @@
100100
</argument>
101101
</arguments>
102102
</type>
103+
<type name="Magento\WishlistGraphQl\Model\Resolver\Type\WishlistItemType">
104+
<arguments>
105+
<argument name="supportedTypes" xsi:type="array">
106+
<item name="bundle" xsi:type="string">BundleWishlistItem</item>
107+
</argument>
108+
</arguments>
109+
</type>
103110
</config>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,7 @@ type ItemSelectedBundleOptionValue @doc(description: "A list of values for the s
117117
quantity: Float! @doc(description: "Indicates how many of this bundle product were ordered")
118118
price: Money! @doc(description: "The price of the child bundle product")
119119
}
120+
121+
type BundleWishlistItem implements WishlistItemInterface {
122+
bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundle items") @resolver(class: "\\Magento\\BundleGraphQl\\Model\\Wishlist\\BundleOptions")
123+
}

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontForthLevelCategoryTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
<deleteData createDataKey="category3" stepKey="deleteCategory3"/>
3535
<deleteData createDataKey="category2" stepKey="deleteCategory2"/>
3636
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
37+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="cleanInvalidatedCaches">
38+
<argument name="tags" value="full_page"/>
39+
</actionGroup>
3740
</after>
3841
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnStorefrontPage"/>
3942
<moveMouseOver

app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
<argument name="categoryName" value="$$categoryN.name$$, $$categoryM.name$$"/>
5959
</actionGroup>
6060

61-
<wait stepKey="waitBeforeRunCronIndex" time="30"/>
61+
<wait stepKey="waitBeforeRunCronIndex" time="60"/>
6262
<magentoCLI stepKey="runCronIndex" command="cron:run --group=index"/>
63-
<wait stepKey="waitAfterRunCronIndex" time="60"/>
63+
<wait stepKey="waitAfterRunCronIndex" time="120"/>
6464
</before>
6565
<after>
6666
<!-- Change "Category Products" and "Product Categories" indexers to "Update on Save" mode -->
@@ -108,6 +108,8 @@
108108
<argument name="categoryName" value="$$categoryK.name$$"/>
109109
</actionGroup>
110110

111+
<wait stepKey="waitAfterAssignCategoryK" time="60"/>
112+
111113
<!-- Unassign category M from Product B -->
112114
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="amOnEditCategoryPageB">
113115
<argument name="productId" value="$$productB.id$$"/>
@@ -147,8 +149,9 @@
147149
<see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductInCategoryN"/>
148150

149151
<!-- Run cron -->
150-
<wait stepKey="waitBeforeRunMagentoCron" time="30"/>
152+
<wait stepKey="waitBeforeRunMagentoCron" time="60"/>
151153
<magentoCLI stepKey="runMagentoCron" command="cron:run --group=index"/>
154+
152155
<wait stepKey="waitAfterRunMagentoCron" time="90"/>
153156

154157
<!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied -->
@@ -213,8 +216,9 @@
213216
<see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="productCOnCategoryN"/>
214217

215218
<!-- Run Cron once to reindex product changes -->
216-
<wait stepKey="waitBeforeRunCronIndexAfterProductAssignToCategory" time="30"/>
219+
<wait stepKey="waitBeforeRunCronIndexAfterProductAssignToCategory" time="60"/>
217220
<magentoCLI stepKey="runCronIndexAfterProductAssignToCategory" command="cron:run --group=index"/>
221+
218222
<wait stepKey="waitAfterRunCronIndexAfterProductAssignToCategory" time="90"/>
219223

220224
<!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied -->

0 commit comments

Comments
 (0)