Skip to content

Commit c44db8f

Browse files
committed
MC-40651: A Configuration of a Configurable Product is reset when editing it in the Wish List
1 parent 0d3d7bb commit c44db8f

File tree

5 files changed

+193
-0
lines changed

5 files changed

+193
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AssertStorefrontProductDropDownOptionValueActionGroup">
12+
<annotations>
13+
<description>Validates that the provided Product Option is selected under the provided Drop-down Attribute.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/>
17+
<argument name="optionLabel" type="string" defaultValue="{{productAttributeOption1.label}}"/>
18+
</arguments>
19+
20+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeLabel)}}" stepKey="waitForAttributeVisible" />
21+
<seeOptionIsSelected selector="{{StorefrontProductInfoMainSection.attributeSelectByAttributeID(attributeLabel)}}" userInput="{{optionLabel}}" stepKey="assertAttributeOption"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Swatches/view/frontend/layout/wishlist_index_configure_type_configurable.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<arguments>
1616
<argument name="configurable_view_model"
1717
xsi:type="object">Magento\Swatches\ViewModel\Product\Renderer\Configurable</argument>
18+
<argument name="cache_lifetime" xsi:type="boolean">false</argument>
1819
</arguments>
1920
</block>
2021
</referenceBlock>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="StorefrontCustomerUpdateWishlistItemActionGroup">
12+
<annotations>
13+
<description>Navigates to the 'Update Wishlist Item' page by the provided Product name.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productName)}}" stepKey="waitForProductInfo"/>
20+
<scrollTo selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productName)}}" stepKey="scrollToProduct"/>
21+
<moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.ProductInfoByName(productName)}}" stepKey="mouseOverOnProduct"/>
22+
<click selector="{{StorefrontCustomerWishlistProductSection.editProduct}}" stepKey="clickEditButton"/>
23+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="waitForProductPageLoad"/>
24+
</actionGroup>
25+
</actionGroups>

app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<element name="pager" type="block" selector=".toolbar .pager"/>
2626
<element name="wishlistEmpty" type="block" selector=".form-wishlist-items .message.info.empty"/>
2727
<element name="removeProduct" type="button" selector=".products-grid a.btn-remove" timeout="30"/>
28+
<element name="editProduct" type="button" selector=".products-grid a.action.edit" timeout="30"/>
2829
<element name="productSeeDetailsByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]" parameterized="true"/>
2930
<element name="productSeeDetailsLabelByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]//dt[@class='label']" parameterized="true"/>
3031
<element name="productSeeDetailsValueByName" type="block" selector="//a[contains(text(), '{{productName}}')]/ancestor::div/div[contains(@class, 'product-item-tooltip')]//dd[@class='values']" parameterized="true"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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="StorefrontUpdateConfigurableProductAttributeOptionFromWishlistTest">
12+
<annotations>
13+
<features value="Wishlist"/>
14+
<stories value="Update from Wishlist"/>
15+
<title value="Update Configurable Product Option from Wishlist"/>
16+
<description value="Verify that Configurable Product Option has correct value after navigating to Wishlist Item editing page"/>
17+
<severity value="MAJOR"/>
18+
<useCaseId value="MC-40651"/>
19+
<group value="catalog"/>
20+
<group value="configurableProduct"/>
21+
<group value="wishlist"/>
22+
</annotations>
23+
<before>
24+
<!-- Create Customer -->
25+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
26+
27+
<!-- Create Product Attribute with two Options -->
28+
<createData entity="productDropDownAttribute" stepKey="createConfigurableProductAttribute"/>
29+
<createData entity="productAttributeOption1" stepKey="createAttributeFirstOption">
30+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
31+
</createData>
32+
<createData entity="productAttributeOption2" stepKey="createAttributeSecondOption">
33+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
34+
</createData>
35+
36+
<!-- Add attribute to Default Attribute Set -->
37+
<createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet">
38+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
39+
</createData>
40+
41+
<!-- Get Options of created Attribute -->
42+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigurableAttributeFirstOption">
43+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
44+
</getData>
45+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigurableAttributeSecondOption">
46+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
47+
</getData>
48+
49+
<!-- Create Configurable Product -->
50+
<createData entity="ApiConfigurableProductWithOutCategory" stepKey="createConfigurableProduct"/>
51+
52+
<!-- Create first Simple Product and assign Attribute with Option to it -->
53+
<createData entity="ApiSimpleOne" stepKey="createFirstChildProduct">
54+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
55+
<requiredEntity createDataKey="getConfigurableAttributeFirstOption"/>
56+
</createData>
57+
58+
<!-- Create second Simple Product and assign Attribute with Option to it -->
59+
<createData entity="ApiSimpleOne" stepKey="createSecondChildProduct">
60+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
61+
<requiredEntity createDataKey="getConfigurableAttributeSecondOption"/>
62+
</createData>
63+
64+
<!-- Create Configurable Product Options -->
65+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigurableProductOptions">
66+
<requiredEntity createDataKey="createConfigurableProduct"/>
67+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
68+
<requiredEntity createDataKey="getConfigurableAttributeFirstOption"/>
69+
<requiredEntity createDataKey="getConfigurableAttributeSecondOption"/>
70+
</createData>
71+
72+
<!-- Assign Simple Products to Configurable Product -->
73+
<createData entity="ConfigurableProductAddChild" stepKey="addConfigurableProductFirstChild">
74+
<requiredEntity createDataKey="createConfigurableProduct"/>
75+
<requiredEntity createDataKey="createFirstChildProduct"/>
76+
</createData>
77+
<createData entity="ConfigurableProductAddChild" stepKey="addConfigurableProductSecondChild">
78+
<requiredEntity createDataKey="createConfigurableProduct"/>
79+
<requiredEntity createDataKey="createSecondChildProduct"/>
80+
</createData>
81+
</before>
82+
<after>
83+
<!-- Delete Configurable Product data -->
84+
<deleteData createDataKey="createFirstChildProduct" stepKey="deleteFirstChildProduct"/>
85+
<deleteData createDataKey="createSecondChildProduct" stepKey="deleteSecondChildProduct"/>
86+
<deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigurableProduct"/>
87+
<deleteData createDataKey="createConfigurableProductAttribute" stepKey="deleteProductAttribute"/>
88+
89+
<!-- Logout from Customer account -->
90+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFromStorefront"/>
91+
92+
<!-- Delete Customer -->
93+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
94+
95+
<!-- Reindex invalidated indices after Product Attribute has been created/deleted -->
96+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
97+
</after>
98+
99+
<!-- Login as Customer -->
100+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
101+
<argument name="Customer" value="$createCustomer$"/>
102+
</actionGroup>
103+
104+
<!-- Open Product details page -->
105+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
106+
<argument name="productUrl" value="$createConfigurableProduct.custom_attributes[url_key]$"/>
107+
</actionGroup>
108+
109+
<!-- Select first Drop-down Attribute Option and click 'Add to Wish List' button -->
110+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectFirstOption">
111+
<argument name="attributeLabel" value="$createConfigurableProductAttribute.default_frontend_label$"/>
112+
<argument name="optionLabel" value="$getConfigurableAttributeFirstOption.label$"/>
113+
</actionGroup>
114+
<actionGroup ref="StorefrontCustomerAddProductToWishlistActionGroup" stepKey="addProductToWishlist">
115+
<argument name="productVar" value="$createConfigurableProduct$"/>
116+
</actionGroup>
117+
118+
<!-- Click 'Edit Item' button from Wishlist page and assert first Option in Drop-down Attribute -->
119+
<actionGroup ref="StorefrontCustomerUpdateWishlistItemActionGroup" stepKey="clickEditWishlistItem">
120+
<argument name="productName" value="$createConfigurableProduct.name$"/>
121+
</actionGroup>
122+
<actionGroup ref="AssertStorefrontProductDropDownOptionValueActionGroup" stepKey="assertAttributeFirstOption">
123+
<argument name="attributeLabel" value="$createConfigurableProductAttribute.default_frontend_label$"/>
124+
<argument name="optionLabel" value="$getConfigurableAttributeFirstOption.label$"/>
125+
</actionGroup>
126+
127+
<!-- Select second Drop-down Option and click 'Update Wish List' button -->
128+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectSecondOption">
129+
<argument name="attributeLabel" value="$createConfigurableProductAttribute.default_frontend_label$"/>
130+
<argument name="optionLabel" value="$getConfigurableAttributeSecondOption.label$"/>
131+
</actionGroup>
132+
<click selector="{{StorefrontProductInfoMainSection.productAddToWishlist}}" stepKey="clickUpdateWishlist"/>
133+
134+
<!-- Click 'Edit Item' button again and assert second Option in Drop-down Attribute -->
135+
<actionGroup ref="StorefrontCustomerUpdateWishlistItemActionGroup" stepKey="clickEditWishlistItemAgain">
136+
<argument name="productName" value="$createConfigurableProduct.name$"/>
137+
</actionGroup>
138+
<actionGroup ref="AssertStorefrontProductDropDownOptionValueActionGroup" stepKey="assertAttributeSecondOption">
139+
<argument name="attributeLabel" value="$createConfigurableProductAttribute.default_frontend_label$"/>
140+
<argument name="optionLabel" value="$getConfigurableAttributeSecondOption.label$"/>
141+
</actionGroup>
142+
</test>
143+
</tests>

0 commit comments

Comments
 (0)