Skip to content

Commit 3b2eb0f

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop
- merged latest code from mainline branch
2 parents 30ae9f2 + 711b09c commit 3b2eb0f

21 files changed

+576
-43
lines changed
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="AdminFillCatalogRuleConditionWithSelectAttributeActionGroup" extends="AdminFillCatalogRuleConditionActionGroup">
12+
<annotations>
13+
<description>EXTENDS: AdminFillCatalogRuleConditionActionGroup. Clicks on the Conditions tab. Fills in the provided condition with attribute type select.</description>
14+
</annotations>
15+
<selectOption selector="{{AdminNewCatalogPriceRuleConditions.activeValueInput}}" userInput="{{conditionValue}}" stepKey="fillConditionValue"/>
16+
<remove keyForRemoval="clickApply"/>
17+
<remove keyForRemoval="waitForApplyButtonInvisibility"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
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="AdminApplyCatalogPriceRuleByProductAttributeTest">
12+
<annotations>
13+
<features value="CatalogRule"/>
14+
<stories value="Catalog price rule"/>
15+
<title value="Admin should be able to apply the catalog price rule by product attribute"/>
16+
<description value="Admin should be able to apply the catalog price rule by product attribute"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-25351"/>
19+
<group value="catalogRule"/>
20+
</annotations>
21+
<before>
22+
<createData entity="productDropDownAttribute" stepKey="createDropdownAttribute"/>
23+
<!--Create attribute options-->
24+
<createData entity="ProductAttributeOption7" stepKey="createProductAttributeOptionGreen">
25+
<requiredEntity createDataKey="createDropdownAttribute"/>
26+
</createData>
27+
<createData entity="ProductAttributeOption8" stepKey="createProductAttributeOptionRed">
28+
<requiredEntity createDataKey="createDropdownAttribute"/>
29+
</createData>
30+
<!--Add attribute to default attribute set-->
31+
<createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet">
32+
<requiredEntity createDataKey="createDropdownAttribute"/>
33+
</createData>
34+
35+
<createData entity="ApiCategory" stepKey="createCategory"/>
36+
<createData entity="ApiSimpleProduct" stepKey="createFirstProduct">
37+
<field key="price">40.00</field>
38+
<requiredEntity createDataKey="createCategory"/>
39+
</createData>
40+
<createData entity="ApiSimpleProduct" stepKey="createSecondProduct">
41+
<field key="price">40.00</field>
42+
<requiredEntity createDataKey="createCategory"/>
43+
</createData>
44+
45+
<!-- Create the configurable product based on the data in the /data folder -->
46+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
47+
<requiredEntity createDataKey="createCategory"/>
48+
</createData>
49+
50+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
51+
<createData entity="productAttributeWithTwoOptionsNotVisible" stepKey="createConfigProductAttribute"/>
52+
<createData entity="productAttributeOption1" stepKey="createFirstConfigProductAttributeOption">
53+
<requiredEntity createDataKey="createConfigProductAttribute"/>
54+
</createData>
55+
<createData entity="productAttributeOption2" stepKey="createSecondConfigProductAttributeOption">
56+
<requiredEntity createDataKey="createConfigProductAttribute"/>
57+
</createData>
58+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
59+
<requiredEntity createDataKey="createConfigProductAttribute"/>
60+
</createData>
61+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getFirstConfigAttributeOption">
62+
<requiredEntity createDataKey="createConfigProductAttribute"/>
63+
</getData>
64+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getSecondConfigAttributeOption">
65+
<requiredEntity createDataKey="createConfigProductAttribute"/>
66+
</getData>
67+
68+
<!-- Create the 2 children that will be a part of the configurable product -->
69+
<createData entity="ApiSimpleOne" stepKey="createConfigFirstChildProduct">
70+
<field key="price">60.00</field>
71+
<requiredEntity createDataKey="createConfigProductAttribute"/>
72+
<requiredEntity createDataKey="getFirstConfigAttributeOption"/>
73+
</createData>
74+
<createData entity="ApiSimpleTwo" stepKey="createConfigSecondChildProduct">
75+
<field key="price">60.00</field>
76+
<requiredEntity createDataKey="createConfigProductAttribute"/>
77+
<requiredEntity createDataKey="getSecondConfigAttributeOption"/>
78+
</createData>
79+
80+
<!-- Assign the two products to the configurable product -->
81+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
82+
<requiredEntity createDataKey="createConfigProduct"/>
83+
<requiredEntity createDataKey="createConfigProductAttribute"/>
84+
<requiredEntity createDataKey="getFirstConfigAttributeOption"/>
85+
<requiredEntity createDataKey="getSecondConfigAttributeOption"/>
86+
</createData>
87+
<createData entity="ConfigurableProductAddChild" stepKey="createFirstConfigProductAddChild">
88+
<requiredEntity createDataKey="createConfigProduct"/>
89+
<requiredEntity createDataKey="createConfigFirstChildProduct"/>
90+
</createData>
91+
<createData entity="ConfigurableProductAddChild" stepKey="createSecondConfigProductAddChild">
92+
<requiredEntity createDataKey="createConfigProduct"/>
93+
<requiredEntity createDataKey="createConfigSecondChildProduct"/>
94+
</createData>
95+
96+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdmin"/>
97+
<!-- Update first simple product -->
98+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openFirstSimpleProductForEdit">
99+
<argument name="productId" value="$createFirstProduct.id$"/>
100+
</actionGroup>
101+
<selectOption selector="{{AdminProductFormSection.customSelectField($createDropdownAttribute.attribute[attribute_code]$)}}"
102+
userInput="$createProductAttributeOptionGreen.option[store_labels][0][label]$" stepKey="setAttributeValueForFirstSimple"/>
103+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstSimpleProduct"/>
104+
<!-- Update second simple product -->
105+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSecondSimpleProductForEdit">
106+
<argument name="productId" value="$createSecondProduct.id$"/>
107+
</actionGroup>
108+
<selectOption selector="{{AdminProductFormSection.customSelectField($createDropdownAttribute.attribute[attribute_code]$)}}"
109+
userInput="$createProductAttributeOptionRed.option[store_labels][0][label]$" stepKey="setAttributeValueForSecondSimple"/>
110+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondSimpleProduct"/>
111+
<!-- Update first child of configurable product -->
112+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openFirstChildProductForEdit">
113+
<argument name="productId" value="$createConfigFirstChildProduct.id$"/>
114+
</actionGroup>
115+
<selectOption selector="{{AdminProductFormSection.customSelectField($createDropdownAttribute.attribute[attribute_code]$)}}"
116+
userInput="$createProductAttributeOptionGreen.option[store_labels][0][label]$" stepKey="setAttributeValueForFirstChildProduct"/>
117+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveFirstChildProduct"/>
118+
<!-- Update second child of configurable product -->
119+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openSecondChildProductForEdit">
120+
<argument name="productId" value="$createConfigSecondChildProduct.id$"/>
121+
</actionGroup>
122+
<selectOption selector="{{AdminProductFormSection.customSelectField($createDropdownAttribute.attribute[attribute_code]$)}}"
123+
userInput="$createProductAttributeOptionGreen.option[store_labels][0][label]$" stepKey="setAttributeValueForSecondChildProduct"/>
124+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondChildProduct"/>
125+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/>
126+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
127+
</before>
128+
<after>
129+
<!-- Delete created data -->
130+
<deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/>
131+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
132+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
133+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
134+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
135+
<deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteConfigFirstChildProduct"/>
136+
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
137+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
138+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/>
139+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetCatalogRulesGridFilter"/>
140+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
141+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
142+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
143+
</after>
144+
<!-- Create Catalog Price Rule -->
145+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingFirstPriceRule"/>
146+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForFirstPriceRule">
147+
<argument name="groups" value="'NOT LOGGED IN'"/>
148+
</actionGroup>
149+
<actionGroup ref="AdminFillCatalogRuleConditionWithSelectAttributeActionGroup" stepKey="createCatalogPriceRule">
150+
<argument name="condition" value="$createDropdownAttribute.default_frontend_label$"/>
151+
<argument name="conditionValue" value="$createProductAttributeOptionGreen.option[store_labels][0][label]$"/>
152+
</actionGroup>
153+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
154+
<argument name="discountAmount" value="{{SimpleCatalogPriceRule.discount_amount}}"/>
155+
</actionGroup>
156+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
157+
<!-- Run cron -->
158+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
159+
<argument name="indices" value="catalogrule_rule"/>
160+
</actionGroup>
161+
<!-- Open first simple product page on storefront -->
162+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openFirstSimpleProductPage">
163+
<argument name="productUrlKey" value="$createFirstProduct.custom_attributes[url_key]$"/>
164+
</actionGroup>
165+
<!-- Verify price for simple product with attribute option green=$20 -->
166+
<actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertFirstSimpleProductPrices">
167+
<argument name="productPrice" value="$createFirstProduct.price$"/>
168+
<argument name="productFinalPrice" value="$20.00"/>
169+
</actionGroup>
170+
171+
<!-- Open the configurable product page on storefront -->
172+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openConfigurableProductPage">
173+
<argument name="productUrlKey" value="$createConfigProduct.custom_attributes[url_key]$"/>
174+
</actionGroup>
175+
<!-- Verify price for configurable product with attribute option green=$30 -->
176+
<selectOption selector="{{AdminCustomerActivitiesConfigureSection.addAttribute}}" userInput="option1" stepKey="selectFirstOptionOfConfigProduct"/>
177+
<actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertConfigProductWithFirstOptionPrices">
178+
<argument name="productPrice" value="$createConfigFirstChildProduct.price$"/>
179+
<argument name="productFinalPrice" value="$30.00"/>
180+
</actionGroup>
181+
<!-- Verify price for configurable product with attribute option green=$30 -->
182+
<selectOption selector="{{AdminCustomerActivitiesConfigureSection.addAttribute}}" userInput="option2" stepKey="selectSecondOptionOfConfigProduct"/>
183+
<actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertConfigProductWithSecondOptionPrices">
184+
<argument name="productPrice" value="$createConfigSecondChildProduct.price$"/>
185+
<argument name="productFinalPrice" value="$30.00"/>
186+
</actionGroup>
187+
188+
<!-- Open the second simple product page on storefront -->
189+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openSecondSimpleProductPage">
190+
<argument name="productUrlKey" value="$createSecondProduct.custom_attributes[url_key]$"/>
191+
</actionGroup>
192+
<!-- Verify Price for second simple product with specialColor red=$40 -->
193+
<actionGroup ref="AssertStorefrontProductPricesActionGroup" stepKey="assertSecondSimpleProductPrices">
194+
<argument name="productPrice" value="$createSecondProduct.price$"/>
195+
<argument name="productFinalPrice" value="$createSecondProduct.price$"/>
196+
</actionGroup>
197+
</test>
198+
</tests>

app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="ApplyCatalogPriceRuleByProductAttributeTest">
11+
<test name="ApplyCatalogPriceRuleByProductAttributeTest" deprecated="Use AdminApplyCatalogPriceRuleByProductAttributeTest">
1212
<annotations>
1313
<stories value="Catalog price rule"/>
14-
<title value="Admin should be able to apply the catalog price rule by product attribute"/>
14+
<title value="DEPRECATED. Admin should be able to apply the catalog price rule by product attribute"/>
1515
<description value="Admin should be able to apply the catalog price rule by product attribute"/>
1616
<severity value="CRITICAL"/>
1717
<testCaseId value="MC-148"/>
1818
<group value="CatalogRule"/>
1919
<skip>
20-
<issueId value="MC-22577"/>
20+
<issueId value="DEPRECATED">Use AdminApplyCatalogPriceRuleByProductAttributeTest instead.</issueId>
2121
</skip>
2222
</annotations>
2323
<before>

app/code/Magento/Checkout/Model/ShippingInformationManagement.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,11 @@ public function saveAddressInformation(
209209
if (!$quote->getIsVirtual()
210210
&& !$shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod())
211211
) {
212-
throw new NoSuchEntityException(
212+
$errorMessage = $methodCode ?
213213
__('Carrier with such method not found: %1, %2', $carrierCode, $methodCode)
214+
: __('The shipping method is missing. Select the shipping method and try again.');
215+
throw new NoSuchEntityException(
216+
$errorMessage
214217
);
215218
}
216219

app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
<data key="label">All Allowed Countries</data>
8282
<data key="value">0</data>
8383
</entity>
84+
<entity name="EnableFlatRateShowMethodNoApplicableConfigData">
85+
<data key="path">carriers/flatrate/showmethod</data>
86+
<data key="scope">carriers</data>
87+
<data key="scope_id">1</data>
88+
<data key="label">Show Method if Not Applicable</data>
89+
<data key="value">1</data>
90+
</entity>
8491
<entity name="DisableFlatRateConfigData">
8592
<data key="path">carriers/flatrate/active</data>
8693
<data key="scope">carriers</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
<element name="shippingMethodLoader" type="button" selector="//div[contains(@class, 'checkout-shipping-method')]/following-sibling::div[contains(@class, 'loading-mask')]"/>
2121
<element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
2222
<element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/>
23+
<element name="price" type="text" selector="//*[@id='checkout-shipping-method-load']//td[@class='col col-price']"/>
2324
</section>
2425
</sections>

0 commit comments

Comments
 (0)