Skip to content

Commit 10b5415

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into AC-1199
2 parents 66daede + f26ae80 commit 10b5415

File tree

38 files changed

+1124
-66
lines changed

38 files changed

+1124
-66
lines changed

app/code/Magento/Bundle/Model/Option/SaveAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class SaveAction
5050
* @param Type $type
5151
* @param ProductLinkManagementInterface $linkManagement
5252
* @param StoreManagerInterface|null $storeManager
53+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5354
*/
5455
public function __construct(
5556
Option $optionResource,
@@ -84,11 +85,10 @@ public function save(ProductInterface $bundleProduct, OptionInterface $option)
8485
$optionId = $option->getOptionId();
8586
$linksToAdd = [];
8687
$optionCollection = $this->type->getOptionsCollection($bundleProduct);
87-
$optionCollection->setIdFilter($option->getOptionId());
88-
$optionCollection->setProductLinkFilter($parentId);
8988

9089
/** @var \Magento\Bundle\Model\Option $existingOption */
91-
$existingOption = $optionCollection->getFirstItem();
90+
$existingOption = $optionCollection->getItemById($option->getOptionId())
91+
?? $optionCollection->getNewEmptyItem();
9292
if (!$optionId || $existingOption->getParentId() != $parentId) {
9393
//If option ID is empty or existing option's parent ID is different
9494
//we'd need a new ID for the option.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
<element name="asLowAsFinalPrice" type="text" selector="div.price-box.price-final_price p.minimal-price > span.price-final_price span.price"/>
1717
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price > span.price-final_price span.price"/>
1818
<element name="productBundleOptionsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/../input" parameterized="true" timeout="30"/>
19+
<element name="includingTaxPrice" type="text" selector=".//*[@class='price-wrapper price-including-tax']/span"/>
20+
<element name="excludingTaxPrice" type="text" selector=".//*[@class='price-wrapper price-excluding-tax']/span"/>
1921
</section>
2022
</sections>

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,20 @@
2929
<entity name="defaultProductPrice" type="default_product_price">
3030
<data key="value"/>
3131
</entity>
32+
<entity name="CustomCatalogPrices">
33+
<data key="path">tax/calculation/price_includes_tax</data>
34+
<data key="value">1</data>
35+
</entity>
36+
<entity name="CustomDisplayProductPricesInCatalog">
37+
<data key="path">tax/display/type</data>
38+
<data key="value">3</data>
39+
</entity>
40+
<entity name="CatalogPrices">
41+
<data key="path">tax/calculation/price_includes_tax</data>
42+
<data key="value">0</data>
43+
</entity>
44+
<entity name="DisplayProductPricesInCatalog">
45+
<data key="path">tax/display/type</data>
46+
<data key="value">1</data>
47+
</entity>
3248
</entities>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/AdminProductFormSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,7 @@
7979
<element name="newCategoryButton" type="button" selector="button[data-index='create_category_button']" timeout="30"/>
8080
<element name="footerBlock" type="block" selector="//footer"/>
8181
<element name="categories" type="text" selector="//*[@class='admin__action-multiselect-crumb']/span[contains(text(), '{{categoryName}}')]" parameterized="true"/>
82+
<element name="attributeRequiredLabelText" type="text" selector="//*[@class='admin__field-label']//span[text()='{{attributeLabel}}']" parameterized="true"/>
83+
<element name="newAddedAttributeValue" type="text" selector="//option[contains(@data-title,'{{attributeValue}}')]" parameterized="true"/>
8284
</section>
8385
</sections>
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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="AddNewProductAttributeInProductPageTest">
12+
<annotations>
13+
<stories value="Create Attribute from product"/>
14+
<title value="Create Attribute from Product Page"/>
15+
<description value="Login as admin and create new product attribute from product page with Text Field"/>
16+
<severity value="BLOCKER"/>
17+
<testCaseId value="MC-26654"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<!-- Login as admin -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
25+
<!--Create Category-->
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
28+
</before>
29+
<after>
30+
<!-- delete category -->
31+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
32+
<!-- delete created product attribute -->
33+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
34+
<argument name="ProductAttribute" value="newProductAttribute"/>
35+
</actionGroup>
36+
37+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
38+
</after>
39+
40+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/>
41+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="navigateToCreateProductPage">
42+
<argument name="product" value="SimpleProduct"/>
43+
</actionGroup>
44+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm">
45+
<argument name="product" value="SimpleProduct"/>
46+
</actionGroup>
47+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct">
48+
<argument name="categoryName" value="$createCategory.name$"/>
49+
</actionGroup>
50+
51+
<!-- Create New Product Attribute -->
52+
<actionGroup ref="AdminStartCreateProductAttributeOnProductPageActionGroup" stepKey="createDropdownAttribute">
53+
<argument name="attributeCode" value="{{newProductAttribute.attribute_code}}" />
54+
<argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}" />
55+
<argument name="inputType" value="Dropdown" />
56+
</actionGroup>
57+
58+
59+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/>
60+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible"/>
61+
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton"/>
62+
63+
<!-- Adding the values in the grid -->
64+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" stepKey="waitForDefaultStoreViewToVisible"/>
65+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" userInput="value 1" stepKey="fillDefaultStoreView"/>
66+
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('0')}}" userInput="value 1 admin" stepKey="fillAdminField"/>
67+
<checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}" stepKey="selectRadioButton"/>
68+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible2"/>
69+
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton2"/>
70+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" stepKey="waitForDefaultStoreViewToVisible2"/>
71+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" userInput="value 2" stepKey="fillDefaultStoreView2"/>
72+
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('1')}}" userInput="value 2 admin" stepKey="fillAdminField2"/>
73+
74+
<!-- Adding the values to the storefront properties -->
75+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/>
76+
<click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/>
77+
<waitForPageLoad stepKey="waitForStoreFrontToLoad"/>
78+
<scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/>
79+
<checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/>
80+
<checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/>
81+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/>
82+
83+
<!-- Save created Attribute -->
84+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
85+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
86+
87+
<!-- Verify product attribute added in product form -->
88+
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
89+
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
90+
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
91+
<seeElement selector="{{AdminProductFormSection.attributeRequiredLabelText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
92+
<seeElement selector="{{AdminProductFormSection.newAddedAttributeValue('value 1 admin')}}" stepKey="seeAttributeValue"/>
93+
94+
<!-- Save a Product -->
95+
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/>
96+
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
97+
98+
<!--Click on Go Back button -->
99+
<click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackToGridSimple"/>
100+
101+
<!-- Select created attribute as an column -->
102+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdown"/>
103+
<actionGroup ref="CheckAdminProductGridColumnOptionActionGroup" stepKey="checkCreatedAttributeColumn">
104+
<argument name="optionName" value="{{ProductAttributeFrontendLabel.label}}"/>
105+
</actionGroup>
106+
<wait stepKey="waitPostClickingCheck" time="5"/>
107+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdown"/>
108+
109+
<!-- Asserting the value of the created column -->
110+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeCreatedAttributeColumn">
111+
<argument name="row" value="1"/>
112+
<argument name="column" value="{{ProductAttributeFrontendLabel.label}}"/>
113+
<argument name="value" value="value 1 admin"/>
114+
</actionGroup>
115+
116+
<!--Verify Product Attribute is present in Category Store Front Page -->
117+
<amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage"/>
118+
<waitForPageLoad stepKey="waitForProductFrontPageToLoad"/>
119+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/>
120+
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
121+
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/>
122+
<waitForPageLoad stepKey="waitForProductToLoad1"/>
123+
<scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="scrollToMoreInformation"/>
124+
<see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/>
125+
<see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="value 1" stepKey="seeAttributeValueOnStorefront"/>
126+
127+
<!-- Return to catgeory page to assert the layered navigation -->
128+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategoryAgain"/>
129+
<waitForPageLoad stepKey="waitForCategoryPageToLoad2"/>
130+
<fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{SimpleProduct.name}}" stepKey="fillProductName"/>
131+
<waitForPageLoad stepKey="waitForSearchButtonEnabled"/>
132+
<click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/>
133+
134+
<!-- Assert that attribute values present in layered navigation -->
135+
<actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertAttributeWithOptionInLayeredNavigation">
136+
<argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}"/>
137+
<argument name="attributeOptionLabel" value="value 1 1"/>
138+
</actionGroup>
139+
140+
<!-- Click on the attribute -->
141+
<click selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('value 1')}}" stepKey="clickOnAttributeValue"/>
142+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingBy}}" stepKey="seeNowShoppingBy"/>
143+
<seeElement selector="{{StorefrontLayeredNavigationSection.actionRemove}}" stepKey="seeX"/>
144+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttribute(ProductAttributeFrontendLabel.label)}}" stepKey="seeNowShoppingByAttribute"/>
145+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttributeValue('value 1')}}" stepKey="seeNowShoppingByAttributeValue"/>
146+
147+
</test>
148+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateProductPricesOnTheFrontendWithTierPricingSetupTest">
11+
<annotations>
12+
<features value="Product and tax rule"/>
13+
<stories value="Create product and validate product prices on frontend"/>
14+
<title value="Create product and validate product tier prices on frontend"/>
15+
<description value="Create product and tax rule and validate product tier prices on frontend"/>
16+
<testCaseId value="MC-43283"/>
17+
<severity value="AVERAGE"/>
18+
</annotations>
19+
<before>
20+
<!-- Create category -->
21+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
22+
<!-- Admin Login -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<!--Create Product-->
25+
<createData entity="SimpleProduct2" stepKey="createProduct">
26+
<field key="price">100</field>
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
<!-- Create Tax Rate & Rule -->
30+
<createData entity="USFullTaxRate" stepKey="initialTaxRate"/>
31+
<actionGroup ref="AdminCreateTaxRuleActionGroup" stepKey="createTaxRule">
32+
<argument name="taxRate" value="$$initialTaxRate$$"/>
33+
<argument name="taxRule" value="SimpleTaxRule"/>
34+
</actionGroup>
35+
<!-- change configurations -->
36+
<magentoCLI command="config:set {{CustomCatalogPrices.path}} {{CustomCatalogPrices.value}}" stepKey="selectIncludingTax"/>
37+
<magentoCLI command="config:set {{CustomDisplayProductPricesInCatalog.path}} {{CustomDisplayProductPricesInCatalog.value}}" stepKey="selectInclAndExlTax"/>
38+
<magentoCLI command="cron:run --group=index" stepKey="runCronReindex"/>
39+
</before>
40+
<after>
41+
<!-- delete created product -->
42+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
43+
<!-- delete created category -->
44+
<deleteData createDataKey="createCategory" stepKey="deleteCategory1"/>
45+
<!-- delete created Tax Rate & Rule -->
46+
<actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule">
47+
<argument name="taxRuleCode" value="{{SimpleTaxRule.code}}"/>
48+
</actionGroup>
49+
<deleteData createDataKey="initialTaxRate" stepKey="deleteTaxRate"/>
50+
<!-- Revert back configurations -->
51+
<magentoCLI command="config:set {{CatalogPrices.path}} {{CatalogPrices.value}}" stepKey="setExlTax"/>
52+
<magentoCLI command="config:set {{DisplayProductPricesInCatalog.path}} {{DisplayProductPricesInCatalog.value}}" stepKey="selectExlTax"/>
53+
<magentoCron groups="index" stepKey="reindex"/>
54+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
55+
<argument name="tags" value="full_page"/>
56+
</actionGroup>
57+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
58+
</after>
59+
60+
<!-- Go to product page -->
61+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
62+
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
63+
</actionGroup>
64+
<waitForPageLoad stepKey="waitForAssertPrices"/>
65+
66+
<!-- Check Incl & Exl Tax prices -->
67+
<see stepKey="seeNewPriceSide" selector="{{StorefrontProductInfoMainSection.includingTaxPrice}}" userInput="$100.00"/>
68+
<see stepKey="seeNewPriceSide1" selector="{{StorefrontProductInfoMainSection.excludingTaxPrice}}" userInput="$90.91"/>
69+
70+
</test>
71+
</tests>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
<element name="productImage" type="text" selector="//ol[@id='mini-cart']//img[@class='product-image-photo']"/>
4747
<element name="productSubTotal" type="text" selector="//div[@class='subtotal']//span/span[@class='price']"/>
4848
<element name="productCountLabel" type="text" selector="//*[@id='minicart-content-wrapper']/div[2]/div[1]/span[2]"/>
49+
<element name="productCartName" type="text" selector="//tbody[@class='cart item']//strong[@class='product-item-name']//a[contains(text(),'{{var}}')]" parameterized="true"/>
4950
</section>
5051
</sections>

app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutCancelEditingBillingAddress.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<group value="checkout"/>
1919
</annotations>
2020
<before>
21+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2122
<!-- Create Simple Product -->
2223
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
2324
<field key="price">160</field>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutDataPersistTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<group value="checkout"/>
2020
</annotations>
2121
<before>
22+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2223
<createData entity="_defaultCategory" stepKey="createCategory"/>
2324
<createData entity="_defaultProduct" stepKey="createProduct">
2425
<requiredEntity createDataKey="createCategory"/>

0 commit comments

Comments
 (0)